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

用struts2的标签做了下面的程序,在strus.xml中提示the content of elements type ……,是怎么回事?
在myeclipse环境下,用用struts2的标签做了下面的程序,总共一个类和一个struts的配置文件,如下:

actionTag类的代码如下:

package com;
import com.opensymphony.xwork2.ActionSupport;
public class actionTag extends ActionSupport {

public String execute() throws Exception{ 
return SUCCESS; 
   }

}


struts.xml中的代码如下:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">

 <struts>

<bean  name="actionTag" class="com.actionTag" >
  <result name="success" >/succes.jsp</result>
</bean>

</struts>    

现在的问题是:在struts.xml文件中<bean  name="actionTag" class="com.actionTag" >这一行有错误(还没运行程序就提示错误),提示:the content of elements type "bean" must match "null"。请问:如何解决?分不够可以加分




------解决方案--------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="jc" namespace="/" extends="struts-default">
<!-- 用户注册 -->
<action name="register" class="userInfoAction" method="register">
<result>/regok.jsp</result>
<result name="error">/regfail.jsp</result>
<result name="codeErr">/register.jsp</result>
</action>
</package>
</struts>
struts.xml中配置出错了!!!!