日期:2014-05-17 浏览次数:20673 次
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.i18n.encoding" value="utf-8" /> <constant name="struts.devMode" value="true" /> <constant name="struts.configuration.xml.reload" value="true"/> <include file="struts-default.xml"/> <package name="Login" namespace="/" extends="struts-default"> <action name="login" class="suncw.demo.action.LoginAction"> <result name="input">/login.jsp</result> <result name="success">/index.jsp</result> </action> </package> </struts>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>登陆</title> </head> <body> <s:form action="login.action" method="post"> <s:textfield name="user.username" label="用户"></s:textfield> <s:textfield name="user.password" label="密码"></s:textfield> <s:submit value="提交"></s:submit> </s:form> <a href="Copy">aaaad</a> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>登陆</title> </head> <body> dfsafdasfd </body> </html>
//看看web.xml这里url-pattern里的URL路径有没有配置错误 <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping>
------解决方案--------------------
路径的问题吧,我也出现过,你把路径改一下,或者 把文件放其他地方试一试