游戏排行榜前十名:求助struts-config.xml配置问题!!

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 04:42:38
目的是要验证输入是否是三角形。输入页面:index.jsp;如果判断通过,则跳转至success.jsp;否则,跳转到failure.jsp
我继承建立了一个ValidatorForm类和一个Action类,分别叫IndexForm和InputAction。
struts-config.xml文件如下:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>
<form-beans>

<!-- index form bean -->
<form-bean name="IndexForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="a" type="java.lang.String"/>
<form-property name="b" type="java.lang.String"/><form-property
name="c" type="java.lang.String">
</form-property>
</form-bean>

<!-- Subscription form bean -->

</form-beans>
<global-forwards>
<forward name="failure" path="/failure.jsp"/>
<forward name="success" path="/success.jsp"/>
</global-forwards>
<action-mappings>

<!-- Edit mail subscription -->
<action path="/index"
type="org.apache.struts.webapp.example.EditRegistrationAction"
attribute="IndexForm" scope="request" validate="false" input="index">
<forward name="failure" path="/failure.jsp" ></forward>
<forward name="success" path="/success.jsp"></forward>
</action>

<!-- Save mail subscription -->
<action path="/success"
forward="/index.jsp">
</action>

</action-mappings>

<controller>
<!-- The "input" parameter on "action" elements is the name of a
local or global "forward" rather than a module-relative path -->
<set-property property="inputForward" value="true"/>
</controller>
</struts-config>

启动tomcat则报错:
严重: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at org.apache.catalina.core.StandardHostDeployer.addChild(StandardHostDeployer.java:833)
... 38 more
2006-1-13 11:26:39 org.apache.catalina.startup.HostConfig deployDescriptors
严重: Error deploying configuration descriptor Struts_Triangle.xml
java.io.IOException: java.lang.IllegalStateException: Context path /Struts_Triangle is already in use
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:526)
请高手指点!谢谢啦!

感觉跟struts的配置文件没什么关系,看看web.xml是否正确吧