struts 工作流程
用struts做的一个简单的登陆页面
action
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
String name = loginForm.getName() ;
String password = loginForm.getPassword() ;
if("mldn".equals(name)&&"lxh".equals(password))
{
// 跳转到成功页
return mapping.findForward("suc") ;
}
else
{
// 跳转到失败页
return mapping.findForward("fal") ;
}
}
form
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
ActionErrors errors = new ActionErrors() ;
if(this.name==null||"".equals(this.name))
{
errors.add("name",new ActionMessage("name.null")) ;
}
if(this.password==null||"".equals(this.password))
{
errors.add("name",new ActionMessage("password.null")) ;
}
return errors;
}
struts-config.xml里的配置
<action
attribute="loginForm"
input="/errors.jsp"
name="loginForm"
path="/login"
scope="request"
type="cn.answer.struts.action.LoginAction" >
<forward name="suc" path="/login_success.jsp"></forward>
<forward name="fal" path="/login_failure.jsp"></forward>
</action>
想请问下从我按下提交按钮后 整个流程是怎么处理的
form里的信息 先传送到那里 然后怎么处理的(分3种情况 输入为空和不为空,错误输入)
还有就是config.xml里的配置是什么意思
有点多哈 还忘各高手不吝赐教