// Created by Xslt generator for Eclipse. // XSL : not found (java.io.FileNotFoundException: (Bad file descriptor)) // Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xslpackage com.youcompany.struts.form;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping;/** * RegisterForm.java created by EasyStruts - XsltGen. * http://easystruts.sf.net * created on 02-15-2005 * * XDoclet definition: * @struts:form name="registerForm" */ public class RegisterForm extends ActionForm { // --------------------------------------------------------- Instance Variables 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(String username){this.username=username;} public void setPassword1(String password){this.password1=password;} public void setPassword2(String password){this.password2=password;}
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<!-- ========== Data Source Configuration =============================== -->
<data-sources />
<!-- ========== Form Bean Definitions ================================== -->
<form-beans>
<form-bean name="registerForm" type="com.youcompany.struts.form.RegisterForm" />
</form-beans>
<!-- ========== Global Exception Definitions ============================== -->
<global-exceptions />
<!-- ========== Global Forward Definitions =============================== -->
<global-forwards />
<!-- ========== Action Mapping Definitions =============================== -->
<action-mappings>
<action
input="/form/register.jsp"
name="registerForm"
path="/register"
type="com.youcompany.struts.action.RegisterAction"
validate="false">
<forward name="success" path="/success.html" />
<forward name="failed" path="/failed.html" />
</action>
</action-mappings>
<!-- ========== Controller Configuration ================================ -->
<controller />
<!-- ========== Message Resources Definitions ============================ -->
<!-- ========== Plug Ins Configuration ================================= -->
<message-resources parameter="com.youcompany.struts.ApplicationResources" />
</struts-config>
// XSL : not found (java.io.FileNotFoundException: (Bad file descriptor))
// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xslpackage com.youcompany.struts.form;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;/**
* RegisterForm.java created by EasyStruts - XsltGen.
* http://easystruts.sf.net
* created on 02-15-2005
*
* XDoclet definition:
* @struts:form name="registerForm"
*/
public class RegisterForm extends ActionForm { // --------------------------------------------------------- Instance Variables
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(String username){this.username=username;}
public void setPassword1(String password){this.password1=password;}
public void setPassword2(String password){this.password2=password;}
// --------------------------------------------------------- Methods /**
* Method validate
* @param ActionMapping mapping
* @param HttpServletRequest request
* @return ActionErrors
*/
public ActionErrors validate(
ActionMapping mapping,
HttpServletRequest request) { throw new UnsupportedOperationException("Generated method 'validate(...)' not implemented.");
}}
// XSL : not found (java.io.FileNotFoundException: (Bad file descriptor))
// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xslpackage com.youcompany.struts.action;import com.youcompany.struts.form.*;//import java.io.*;
//import java.sql.*; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
/**
* RegisterAction.java created by EasyStruts - XsltGen.
* http://easystruts.sf.net
* created on 02-15-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class RegisterAction extends Action { // --------------------------------------------------------- Instance Variables // --------------------------------------------------------- Methods /**
* Method execute
* @param ActionMapping mapping
* @param ActionForm form
* @param HttpServletRequest request
* @param HttpServletResponse response
* @return ActionForward
* @throws Exception
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
RegisterForm rf =(RegisterForm)form;
String username = rf.getUsername();
String password1 = rf.getPassword1();
String password2 = rf.getPassword2();
if(password1.equals(password2))
return mapping.findForward("success");
else
return mapping.findForward("failed");
//throw new UnsupportedOperationException("Generated method 'execute(...)' not implemented.");
}}
<head>
<meta name = "Generator" content = "Easy Struts Xslt generator for Eclipse (http://easystruts.sf.net)."> <title>Struts Form for registerForm</title>
</head>
<body>
<html:form action="register.do" focus="username">
username:<html:text property="username" size="25"/>
password:<html:password property="password1" size="25"/>
re-enter password:<html:password property="password2"size="25"/>
<form:submit property=”regeister”/>
</html:form>
<body>
</html>
改成
<form:submit />
这样不对吗
那么这个提交按钮应该怎么写呢?
改成
<form:submit />
改成<form:submit />
也不行!