大神们,本人菜鸟一个,望指教~~~
网上的方法都解决不了,工程和包的结构如图
struts-config.xml代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
-->
<struts-config>
<form-beans>
<form-bean name="HelloForm" type="actionform.HelloForm"></form-bean>
</form-beans>
<action-mapping>
<action path="/hello" name="HelloForm" type="action.HelloAction"
/>
<forward name="success" path="/success.jsp"/>
<forword name="failure" path="/failure.jsp"/>
</action-mapping>
<message-resources parameter="WEB-INF.Application"/>
</struts-config>
web.xml代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name>
<!--
<welcome-file-list>
<welcome-file>hello.jsp</welcome-file>
</welcome-file-list>
-->
<servlet>
<servlet-name>ActionServlet</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<!-- <init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param> -->
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ActionServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
hello.jsp代码如下:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Logining html</title>
</head>
<body>
<center>
<form action="<%=request.getContextPath()%>/hello.do" method="get">
username:<input type="text" name="userName"/><br/><br/>
password:<input type="text" name="password"/><br/><br/>
<input type="submit" value="submit"/>
</form>
</center>
</body>
</html>
顺便问下,Application.property里应该写些什么吗