[b]1 表单属性设置问题[/b]
1.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[b]2 Struts标签[/b]
0 Struts的跳转时forward跳转
1 Struts的form可以给页面表单元素property为form属性的自动设置上值
2 Struts的form可以给页面非表单元素property为form属性的自动设置上值
但是必须指定form-bean的name;例如
<logic:equal name = "loginForm" property="tag" value="user">用户</logic:equal>
name = "loginForm"制定的是配置文件中的formBean
[b]3 Struts标签[/b]
name属性:
Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.
property属性,是request.getAttribute中得到的Bean的属性的值
当程序遇到<html:form>标签会去执行相应的程序,会把formBean放在pageContext中,
然后再<html:form>中的其他标签,例如<html:text>就会去执行相应的程序,其中有
pageContext.findAttribute(name);该方法的解释是 Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.
// Store this tag itself as a page attribute
pageContext.setAttribute(Constants.FORM_KEY, this,
PageContext.REQUEST_SCOPE);
所以 在action的配置文件中formBean命名为 testForm,如果在action中在request中放了一个request.setAttribute("testForm",new testDTO());form中标签text标签找的时候 (Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null. ) 则会找到request中的这个testForm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010-5-12
页面上form里的元素,style.display = "none"的也可以提交到action
1.1
<input name="parentName" id="parentName" class="s_input" value="123" readonly="readonly"/>
这种StrutsForm 可以获取
<input name="parentName" id="parentName" class="s_input" value="123" disabled="disabled">
这种获取不到
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[b]2 Struts标签[/b]
0 Struts的跳转时forward跳转
1 Struts的form可以给页面表单元素property为form属性的自动设置上值
2 Struts的form可以给页面非表单元素property为form属性的自动设置上值
但是必须指定form-bean的name;例如
<logic:equal name = "loginForm" property="tag" value="user">用户</logic:equal>
name = "loginForm"制定的是配置文件中的formBean
<body>
<html:form styleId="loginForm" action="/login" method="post">
<html:checkbox property="boxoyp" value="0"></html:checkbox>
username: <html:text property="username"/><html:errors property="username"/><br/>
password: <html:text property="password"/><html:errors property="psw"/><br/>
<html:submit /><html:reset/>
</html:form>
</body>
<logic:equal name = "loginForm" property="tag" value="user">用户</logic:equal>
<logic:equal name = "loginForm" property="tag" value="admin">管理员</logic:equal>
[b]3 Struts标签[/b]
<logic:equal name = "loginForm" property="tag" value="user">用户</logic:equal>
name属性:
Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.
property属性,是request.getAttribute中得到的Bean的属性的值
当程序遇到<html:form>标签会去执行相应的程序,会把formBean放在pageContext中,
然后再<html:form>中的其他标签,例如<html:text>就会去执行相应的程序,其中有
pageContext.findAttribute(name);该方法的解释是 Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null.
// Store this tag itself as a page attribute
pageContext.setAttribute(Constants.FORM_KEY, this,
PageContext.REQUEST_SCOPE);
所以 在action的配置文件中formBean命名为 testForm,如果在action中在request中放了一个request.setAttribute("testForm",new testDTO());form中标签text标签找的时候 (Searches for the named attribute in page, request, session (if valid), and application scope(s) in order and returns the value associated or null. ) 则会找到request中的这个testForm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2010-5-12
页面上form里的元素,style.display = "none"的也可以提交到action