急!!!我是个struts的初学者,一天一个程序都没调试出来,急死我了.请大家帮帮忙!大恩不言谢!
我是struts初学者,做了个登录,可怎么也运行不了。以下是目录结构:
TryStruts
| src
| app
| RegisterForm.java
| RegisterAction.java
| TryStrus
| WEB-INF
|success.html
|failure.html
|struts-config.xml
|struts-html.tld
|web.xml
| Register.jsp
开发工具:MyEclipse, Tomcat5.5, jdk6.0
Register.jsp源代码如下:
<%@ page language= "java " import= "java.util.* " pageEncoding= "gbk "%>
<%@ taglib uri= "WEB-INF/struts-html.tld " prefix= "html "%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+ ":// "+request.getServerName()+ ": "+request.getServerPort()+path+ "/ ";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html:form action= "/Register.do ">
rUsername <html:text property= "username "/> <br>
enter password <html:password property= "password1 "/> <br>
re-enter password <html:password property= "password1 "/> <br>
<html:submit value= "Register "/>
</html:form>
Struts-config.xml代码如下:
<?xml version= "1.0 " encoding= "UTF-8 "?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN " "http://struts.apache.org/dtds/struts-config_1_2.dtd ">
<struts-config>
<data-sources />
<form-beans>
<form-bean name= "registerForm " type= "app.RegisterForm "/>
</form-beans>
<global-exceptions />
<global-forwards />
<action-mappings>
<action path= "/Register " type= "app.RegisterForm " name= "registerForm ">
<forward name= "success " path= "/success.html "/>
<forward name= "failure " path= "/failure.html "/>
</action>
</action-mappings>
<message-resources parameter= "ly.ApplicationResources " />
</struts-config>
RegisterAction.java代码如下:
package app;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
public class RegisterAction extends Action {
public ActionForward perform (ActionMapping mapping,ActionForm form,HttpServlet request,HttpServlet response) {
RegisterForm rf = (RegisterForm)form;
String user