struts 及使用标签的一些步骤
2008-11-15 12:43
281 查看
1配置struts
copy lib web.xml struts-config.xml
配制Action (注意path=/login 有/无.do 但是在其他jsp向转发则需写login.do 不是/login.do)
<action path="/login" type="login.LoginAction" name="loginForm"
scope="request">
<forward name="success" path="/loginSuccess.jsp"></forward>
<forward name="error" path="/loginError.jsp"></forward>
</action>
struts标签配制
1 struts-config中加入
<message-resources parameter="ApplicationResources" />
2
复制ApplicationResources.properties 到src目录下
3
jsp 中加
<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
/////////////logic 中的id 变量是把其存为一个变量,默认是page 范围内的变量
/////////////
<logic:notEmpty name="list">
<logic:iterate id="index" name="list">
用户名
<bean:write name="index" property="username" />
<br>年龄
<bean:write name="index" property="age" />
<br>所属组名:
<bean:write name="index" property="g.name" /><br><p><p>
</logic:iterate>
<bean:write name="index" />
</logic:notEmpty>
struts 文件上传的一些注意:
<form action="uploadAction.do" method ="post"enctype="multipart/form-data">
文件名:
<input type="text" name="filename"><br>
file: <input type="file" name="file"><br>
<input type="submit" value="submit"><br>
</form>
file: <input type="file" name="file"><br> 这一行的name="file" 的"file"中不能出现空格,file在struts Form类中必须具有同样的名字,且为org.apache.struts.upload.FormFile;类
method ="post"enctype="multipart/form-data" 要同时存在,不能只具其一
一些关于上传的配置可以在struts-config中配制,例如文件最大大小等:如下
<controller maxFileSize="10M" ></controller>
copy lib web.xml struts-config.xml
配制Action (注意path=/login 有/无.do 但是在其他jsp向转发则需写login.do 不是/login.do)
<action path="/login" type="login.LoginAction" name="loginForm"
scope="request">
<forward name="success" path="/loginSuccess.jsp"></forward>
<forward name="error" path="/loginError.jsp"></forward>
</action>
struts标签配制
1 struts-config中加入
<message-resources parameter="ApplicationResources" />
2
复制ApplicationResources.properties 到src目录下
3
jsp 中加
<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
/////////////logic 中的id 变量是把其存为一个变量,默认是page 范围内的变量
/////////////
<logic:notEmpty name="list">
<logic:iterate id="index" name="list">
用户名
<bean:write name="index" property="username" />
<br>年龄
<bean:write name="index" property="age" />
<br>所属组名:
<bean:write name="index" property="g.name" /><br><p><p>
</logic:iterate>
<bean:write name="index" />
</logic:notEmpty>
struts 文件上传的一些注意:
<form action="uploadAction.do" method ="post"enctype="multipart/form-data">
文件名:
<input type="text" name="filename"><br>
file: <input type="file" name="file"><br>
<input type="submit" value="submit"><br>
</form>
file: <input type="file" name="file"><br> 这一行的name="file" 的"file"中不能出现空格,file在struts Form类中必须具有同样的名字,且为org.apache.struts.upload.FormFile;类
method ="post"enctype="multipart/form-data" 要同时存在,不能只具其一
一些关于上传的配置可以在struts-config中配制,例如文件最大大小等:如下
<controller maxFileSize="10M" ></controller>
相关文章推荐
- Struts 1 学习笔记-2-1(Struts标签的使用步骤)
- 转:Struts2<s:iterator value="" var="lst">中var的使用和一些标签的使用体会
- Struts的FormBean及常见错误和标签的使用
- 学习笔记---使用prototype.js扩展struts标签实现xmlhttprequest
- struts标签的使用
- 关于struts:errors标签的几点使用心得和经验
- 这篇文章不需要在modelsim中建库、映射、建工程等一些繁琐的步骤,直接使用modelsim中的默认work库。使用quartus+modelsim联合仿真。
- 在jsp中使用Struts标签
- struts 怎么使用 s标签 迭代 map
- struts标签<s:date>的使用
- struts1 logic:iterate bean:write标签使用
- struts标签使用举例-logic
- 关于struts中使用Tiles的初级步骤【非转载】
- jsp中使用c:if动态加载一些属性到标签 jsp中添加锚点,页面自动定位
- Struts中使用Tiles标签后,title的国际化
- struts标签的的一些基本用法(ognl)
- struts的if标签使用
- The Struts dispatcher cannot be found. 使用struts标签时该报错的解决方案
- Struts中iterator标签的使用
- Struts、JSTL标签库的基本使用方法