1 表单属性设置问题
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">
这种获取不到
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 Struts标签
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>
3 Struts标签
<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
分享到:
相关推荐
struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子
struts2例子struts2例子struts2例子struts2例子struts2例子struts2例子struts2例子struts2例子
struts2标签使用例子 struts2标签使用例子 struts2标签使用例子struts2标签使用例子
struts2完整例子struts2完整例子struts2完整例子struts2完整例子struts2完整例子struts2完整例子
在myeclipse中使用struts1编程的例子
struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别struts1和struts2的区别...
jquery + struts1 + ajax学习例子
struts1的例子,struts1标签使用的例子,很不错
struts2简单例子,struts2实例开发
struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子struts例子
Struts例子,Struts是Apache软件基金下Jakarta项目的一部分,Struts的优点主要集中体现在两个方面:Taglib和页面导航。Taglib是Struts的标记库,灵活动用,能大大提高开发效率。另外,就目前国内的JSP开发者而言,除了...
搭建struts1.x环境例子源码,可作为初学者使用,由于上传大小有限,所以例子中jar包被分离出去,可在我空间里下载struts1.2jar包
主要介绍了struts2的标签的详细使用例子说明
struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts 项目 例子struts ...
最简单的sturts运用例子,包含struts所必需的jar包
自己写的struts 的例子,自己写的struts 的例子,自己写的struts 的例子,自己写的struts 的例子,
Struts2入门的简单例子 博文链接:https://zmx.iteye.com/blog/441822
一个关于struts拦截器的简单例子,适合初学者!
本文讲述了使用Struts 2标签的注意事项,并介绍了学习Struts 2标签比较权威的网站。