关于网友提出的“ struts的困惑”问题疑问,本网通过在网上对“ struts的困惑”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: struts的困惑
描述: tomcat:4.0
struts:1.2
webapps\strutstest
webapps\register.jsp;success.html;failure.html
webapps\WEB-INF\classes\app\RegisterAction.class;RegisterForm.class
webapps\WEB-INF\struts-config.xml;web.xml
webapps\WEB-INF\lib\....
webapps\tld\....
struts-config.xml
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
web.xml
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
action
org.apache.struts.action.ActionServlet
config
/WEB-INF/struts-config.xml
debug
2
detail
2
2
action
*.do
register.jsp
/WEB-INF/struts-bean.tld
/WEB-INF/struts-bean.tld
/WEB-INF/struts-html.tld
/WEB-INF/struts-html.tld
/WEB-INF/struts-logic.tld
/WEB-INF/struts-logic.tld
/WEB-INF/struts-template.tld
/WEB-INF/struts-template.tld
package app;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class RegisterAction extends Action{
public ActionForward perform(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException{
RegisterForm rf=(RegisterForm)form;
String username=rf.getUsername();
String password1=rf.getPassword1();
String password2=rf.getPassword2();
if(password1.equals(password2)){
return mapping.findForward("success");
}
return mapping.findForward("failure");
}
}
package app;
import org.apache.struts.action.*;
public class RegisterForm extends ActionForm{
protected String username;
protected String password1;
protected String password2;
public String getUsername(){return this.username;}
public String getPassword1(){return this.password1;}
public String getPassword2(){return this.password2;}
public void setUsername(){this.username=username;}
public void setPassword1(){this.password1=password1;}
public void setPassword2(){this.password2=password2;}
}
运行后不报错。显示空白页面。如何是好呀。
以上介绍了“ struts的困惑”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3490639.html