Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find ActionMappings or ActionFormBeans collection

 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any ideas wot would throw this error???

javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.registeruser.index_jsp._jspService(index_jsp.java:90)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

root cause

javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
org.apache.jsp.registeruser.index_jsp._jspx_meth_html_form_0(index_jsp.java:146)
org.apache.jsp.registeruser.index_jsp._jspx_meth_html_html_0(index_jsp.java:122)
org.apache.jsp.registeruser.index_jsp._jspService(index_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)


Thanx for any help you can give me because im realy stuck
 
Pankaj Narang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guy

The problem you arer getting is due to the action maping or bean not present in the struts-config file

Check in your jsp file whether the path given in form:action is present in your struts-config file.

Best regards
Pankaj
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I can tell the action mappings and the form beans are both there.

This is the file index.jsp that creates the bean:



<%@ page language="java" %>

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

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

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

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

<html:html locale="true">

<head>

<title>Welcome to RegisterUser</title>

</head>

<body>

<html:form action="/login.do">

<bean:message key="prompt.login" />

<html:text property="login" />

<br />

<bean:message key="prompt.password" />

<html assword property="password" />

<br />

<html:submit>

<bean:message key="index.login" />

</html:submit>

</html:form>

</body>

</html:html>




And this is the struts-config.xml file that has the mappings and beans:



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

<!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>
<!-- Logon form bean -->
<form-bean name="loginForm"
type="/src/LoginForm"/>
</form-beans>

<global-forwards>
<forward name="mainmenu"path="/mainmenu.jsp" />


<forward name="login" path="/login.jsp"/>
</global-forwards>

<action-mappings>

<!-- Process a user logon -->
<action path="/login.do"
type="/src/LoginAction"
name="loginForm"
scope="session"
input="/index.jsp">
</action>

<action>
name ="LoginForm"
</ action>
</action-mappings>

<message-resources parameter="application"/>


</struts-config>



Can u help with that?
 
Pankaj Narang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guy

I think the path given in the action mapping should be only "/login" and check for the struts-config path given in web.xml that may solve the problem

Best Regards
Pankaj
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I only added the .do as a last resort, didn't think it would work anyway.

heres my web.xml file i still can't see a problem

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



<!DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"

"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">



<web-app>



<!-- Action Servlet Configuration -->

<servlet>

<servlet-name>action</servlet-name>

<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>



<!-- Resources bundle base class -->

<init-param>

<param-name>application</param-name>

<param-value>ApplicationResources</param-value>

</init-param>



<!-- Context-relative path to the XML resource containing Struts configuration information -->

<init-param>

<param-name>config</param-name>

<param-value>/WEB-INF/struts-config.xml</param-value>

</init-param>


<!-- Setting the locale parameter -->

<init-param>

<param-name>locale</param-name>

<param-value>true</param-value>

</init-param>


<!-- The debugging detail level for this servlet, which controls how much information is logged. -->

<init-param>

<param-name>debug</param-name>

<param-value>2</param-value>

</init-param>



<load-on-startup>0</load-on-startup>

</servlet>





<!-- Action Servlet Mapping -->

<servlet-mapping>

<servlet-name>action</servlet-name>

<url-pattern>*.do</url-pattern>

</servlet-mapping>





<!-- The Welcome File List -->

<welcome-file-list>

<welcome-file>registeruser/index.jsp</welcome-file>

</welcome-file-list>



<!-- Struts Tag Library Descriptors -->

<taglib>

<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>

</taglib>



<taglib>

<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-html.tld</taglib-location>

</taglib>



<taglib>

<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>

<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>

</taglib>



</web-app>
 
Pankaj Narang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guy

your web.xml is correct but i think problem is with path only you should check that one .

Best Regards
pankaj
 
Pankaj Narang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this also wont work try one more thing in your action mapping and form bean mapping , put the value of type as the full package of the formbean like if u have something like this com.test.Loginform and com.test.loginaction as you know the package is displayed at the top of your java file try this also.

Best Regards
Pankaj
 
Nicola Guy
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just want to say thanx for your help. I still can't get it working but i appriciate you trying
 
Faris Syed
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if you got your answer yet, but here is a suggestion

you have defined your form-bean in a wrong way, bean has to be in a package under web-inf/classes/ folder not in src folder

for example if your class is in com/user/mypack/LoginForm.java after you compiled it put your class file under
web-inf/classes/com/user/mypack/LoginForm.class

then your struts-config.xml file should have this entry

<form-beans>
<!-- Logon form bean -->
<form-bean name="loginForm"
type="com.user.mypack.LoginForm"/>
</form-beans>

good luck
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic