日期:2014-05-17  浏览次数:20825 次

struts2的配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
  http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


<struts>//报错在这里
<!--<constant name="struts.i18n.encoding" value="gbk"/>
<constant name="struts.local" value="zh_CN"/>
<constant name="struts.custom.i18n.resources" value="messageRsource"/>
<constant name="struts.devMode" value="true"/>
<constant name="struts.ui.theme" value="simple"/>-->

<package name="struts2" extends="struts-default" >
  <action name="login" class="com.shengsiyuan.struts2.login" >  
  <result name="SUCCESS">/result.jsp</result>
<result name="ERROR">/result.jsp</result>
</action>

<action name="userAction"class="com.shengsiyuan.struts2.UserAction">
<result name="SUCCESS">/output.jsp</result>
</action>
</package>
</struts>//报错在这里



<!--我现在用的是struts2.3.8-->
请问各位大虾我上面的struts.xml配置文件哪里出错了?
struts xml?????jsp

------解决方案--------------------
引用:
我的web.xml配置文件代码如下:
<?xml version="1.0" encoding="utf-8"?>
<web-app version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:……


因为在struts.xml文件中缺少了DOCTYPT定义,在文件中加入:
<!DOCTYPE struts-config PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
       "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">即可。
------解决方案--------------------
引用:
引用:我的web.xml配置文件代码如下:
<?xml version="1.0" encoding="utf-8"?>
<web-app version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XML……
你确定http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd这句话是什么意思呢?
------解决方案--------------------
<action name="Login" class="com.shengsiyuan.struts2.LoginAction">
包错了  把struts2包改名成action   struts2 不允许action在别的吧