Struts1 源代码笔记

来源:互联网 发布:网络电话卡代理销售 编辑:程序博客网 时间:2024/06/06 12:49


//jsp页面获取ActionMapping

request.setAttribute(Globals.MAPPING_KEY, mapping);//MAPPING_KEY = "org.apache.struts.action.mapping.instance";

//jsp页面获取ActionForm:一

request.setAttribute(mapping.getAttribute(), instance);/*public String getAttribute() {if (this.attribute == null) {  return (this.name);} else {  return (this.attribute);}}*/

//jsp页面获取ActionForm:二
request.getAttribute(org.apache.struts.taglib.html.Constants.BEAN_KEY)

//该方法只能用在struts标签中,例如:

<html:form>request.getAttribute(org.apache.struts.taglib.html.Constants.BEAN_KEY);</html:form>


org.apache.struts.taglib.html.FormTag源代码

doStartTag():pageContext.setAttribute(Constants.BEAN_KEY, bean, PageContext.REQUEST_SCOPE);doEndTag():pageContext.removeAttribute(Constants.BEAN_KEY, PageContext.REQUEST_SCOPE);


//struts填充参数用到的方法

BeanUtils.populate(bean, properties);



原创粉丝点击