ǰλã >> Java Web >> Ϊʲô,Ϊʲô,һССйСһ,鷳ǰС,СҲ˵,ΪС,Բ¹
  ϸ

Ϊʲô,Ϊʲô,һССйСһ,鷳ǰС,СҲ˵,ΪС,Բ¹

ȶȣ305   ʱ䣺2016-04-17 15:31:48.0
Ϊʲô,Ϊʲô,һССһ,鷳ǰ,Ҳ˵,Ϊ,Բ¹
struts   ż....ǣregedit.jspҳû,һ,뻶ӭҳ,벻һ,ʾ,ûΪadmin,ʾûûΪadmin,һҲ,鷳ǰָһ.
regedit.jspĴ룺
<html:form   action= "/regedit ">
pass1   :   <html:password   property= "pass1 "/> <html:errors   property= "pass1 "/> <br/>
pass   :   <html:password   property= "pass "/> <html:errors   property= "pass "/> <br/>
name   :   <html:text   property= "name "/> <html:errors   property= "name "/> <br/> <html:errors   property= "notname "/>
<html:submit   value= "azafvgafadfs "/> <html:cancel/> <br>
ϢΪ <html:errors/>
</html:form>


ɹok.jspĴ룺
    <body>
        welcome   come!   <br>
    name:   ${use.name   }pass:${use.pass   }
    </body>

regeditActionĴ
public   ActionForward   execute(ActionMapping   mapping,   ActionForm   form,
HttpServletRequest   request,   HttpServletResponse   response)   {
RegeditForm   regeditForm   =   (RegeditForm)   form;//   TODO   Auto-generated   method   stub
ActionForward   forward   =new     ActionForward();

ActionMessages   message   =   null;
if(!regeditForm.getName().equalsIgnoreCase( "admin ")){
message=new   ActionMessages();
  message.add( "notname ",   new   ActionMessage( "regedit.name.not "));
  saveMessages(request,   message);
  forward=   mapping.findForward( "error ");
}else{
request.setAttribute( "use ",   regeditForm);
forward=   mapping.findForward( "ok ");
}

return   forward;
}
struts-config.xml룺
  <form-beans   >
        <form-bean   name= "regeditForm "   type= "com.yourcompany.struts.form.RegeditForm "   />

    </form-beans>

    <global-exceptions   />
    <global-forwards   />
    <action-mappings   >
        <action
            attribute= "regeditForm "
            input= "/regedit.jsp "
            name= "regeditForm "
            path= "/regedit "
            scope= "request "
            type= "com.yourcompany.struts.action.RegeditAction "   >
            <forward   name= "success "   path= "/ok.jsp "   />
            <forward   name= "error "   path= "/error.jsp "   />
        </action>


    </action-mappings>

    <message-resources   parameter= "com.yourcompany.struts.ApplicationResources "   />
error.jspĴ
<body>
վݲעᣡ
ڲ׶ֻͨעᣡ
 
  • ¼Mon Feb 19 13:49:21 CST 2018
  • ¼Mon Feb 19 13:49:21 CST 2018
  • ¼Mon Feb 19 13:49:21 CST 2018
  • ¼Mon Feb 19 13:49:21 CST 2018
  • ¼Mon Feb 19 13:49:21 CST 2018