初作struts 报错误

05-04-16 Javalga

javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection

以下为struts in action 中的例子配置:运行时报上面的错误

<?xml version="1.0" encoding="UTF-8"?>

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

<struts-config>

<form-beans>

<form-bean name="RegisterForm" type="com.sxf.struts.actionform.RegisterForm" />

</form-beans>

<action-mappings type="org.apache.struts.action.ActionMapping">

<action path="/struts" type="com.sxf.struts.action.register" name="RegisterForm" input="/register.jsp">

<forward name="success" path="/success.html" />

<forward name="failure" path="/failure.html" />

</action>

</action-mappings>

</struts-config>

以下为register.jsp文件:

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="ht" %>

<ht:form action="struts.do">

UserName:<ht:text property="username"/><br>

enter password:<ht:password property="password1"/><br>

re-enter password:<ht:password property="password2"/><br>

<ht:submit value="Register"/>

</ht:form>

这个问题怎么解决啊??????????

是配置的问题吗???

Javalga
2005-04-16 13:46

regiser.jsp

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="ht" %>
<ht:form action="struts.do">
UserName:<ht:text property="username"/><br>
enter password:<ht:password property="password1"/><br>
re-enter password:<ht:password property="password2"/><br>
<ht:submit value="Register"/>
</ht:form>

以下为配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
  <form-beans>
    <form-bean name="RegisterForm" type="com.sxf.struts.actionform.RegisterForm" />
  </form-beans>
  <action-mappings type="org.apache.struts.action.ActionMapping">
    <action  path="/struts" type="com.sxf.struts.action.register" name="RegisterForm" input="/register.jsp">
      <forward name="success" path="/success.html" />
      <forward name="failure" path="/failure.html" />
    </action>
  </action-mappings>
</struts-config>

这个错误到底是怎么回事啊?

Javalga
2005-04-16 13:47

regiser.jsp

<!--<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="ht" %>
<ht:form action="struts.do">
UserName:<ht:text property="username"/><br>
enter password:<ht:password property="password1"/><br>
re-enter password:<ht:password property="password2"/><br>
<ht:submit value="Register"/>
</ht:form>-->

以下为配置文件:

<!--<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software //Foundation//DTD Struts Configuration //1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
  <form-beans>
    <form-bean name="RegisterForm" type="com.sxf.struts.actionform.RegisterForm" />
  </form-beans>
  <action-mappings type="org.apache.struts.action.ActionMapping">
    <action  path="/struts" type="com.sxf.struts.action.register" name="RegisterForm" input="/register.jsp">
      <forward name="success" path="/success.html" />
      <forward name="failure" path="/failure.html" />
    </action>
  </action-mappings>
</struts-config>-->

这个错误到底是怎么回事啊?

Javalga
2005-04-16 14:02

晕死,这个论坛这个都处理不了啊,code标记没有效果啊

banq
2005-04-16 15:30

Cannot find ActionMappings or ActionFormBeans collection

很明显,你试图使用Jsp的Collection相关标签 ,但是没有发现ActionFormBeans的Collection,

注意标签中name和property用法。