struts2学习笔记

来源:互联网 发布:js将字符串转为数组 编辑:程序博客网 时间:2024/05/17 06:43


想用struts2的ActionForm和拦截器但是不想用标签的时候,通常会在页面上直接写html标签并把标签的name命名成FormBean的名字,这样ActionForm即能完成他的功能还不用受struts2标签的限制。

在用html的<form>的时候有一点和struts2的form不同就是html的form需要在action里指定你的action的完整名和完整个命名空间名即


@ParentPackage("basePackage")@Action(value="userAction")@Namespace("/")   //这里的斜杠"/"必须写,不写不行,前面会访问不到action@Result(name="userCenter", location="/user/userCenter.jsp" )public class UserAction 


<form action="./login/loginAction!login.action" id="loginform" method="post">     <input id="username" name="user.username" type="text" maxlength="50" class="inp"/>     <input id="password" name="user.password"  type="password"  class="inp" maxlength="50"/>     <input type="submit" id="submit_login" value="登陆"  class="loginbutton"/>     </form>

0 0
原创粉丝点击