Hi All,
I am trying to execute following
struts application but I am receiving following error, could any one please help me.I searched the posts, I tried all the solutions but my application is still not working.
============================Error==========================================
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
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.VASIndex_jsp._jspService(VASIndex_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
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:802)
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.VASIndex_jsp._jspx_meth_html_form_0(VASIndex_jsp.java:116)
org.apache.jsp.VASIndex_jsp._jspService(VASIndex_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
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:802)
===========================================================================
Following is my directory structure
C:\VASVijay\Tomcat 5.0\webapps\VASEcl03
|-VASIndex.jsp
|-VASResult.jsp
|-WEB-INF
|
|-classes
| |
| |-ch03
| |-LookUpAction
| |-LookUpForm
|-lib
| |-All my jar files are placed here
|-web.xml
|-struts-config.xml
=============================web.xml=======================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Welcome to
Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<
servlet>
<servlet-name>FrontController</servlet-name>
<servlet-class>org.apache.struts.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>FrontController</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>VASIndex.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/WEB-INF/myTld/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/myTld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/myTld/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/myTld/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/myTld/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/myTld/struts-html.tld</taglib-location>
</taglib>
</web-app>
===========================================================================
============================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>
<form-bean name="LookUpForm" type="ch03.LookUpForm" />
</form-beans>
<action-mappings>
<action path="/LookUp"
type="ch03.LookUpAction"
name="LookUpForm"
scope="session"
validate="true">
<forward name="success" path="/VASResult.jsp" />
<forward name="failure" path="/VASIndex.jsp" />
</action>
</action-mappings>
</struts-config>
===========================================================================
Source code for the classes "LookUpAction" and "LookUpForm"
==============================LookUpAction.java============================
package ch03;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.Action;
public class LookUpAction extends Action
{
private
String target="success";
private Double quote=null;
protected Double getQuote(String symbol)
{
if(symbol.equalsIgnoreCase("SUNW"))
{
return new Double(99.00);
}
return null;
}
public ActionForward excute(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse res)
{
ch03.LookUpForm lookupform=(ch03.LookUpForm)form;
String symbol=lookupform.getSymbol();
quote=this.getQuote(symbol);
if(quote==null)
{
target="failure";
}
else
{
req.setAttribute("PRICE",quote);
}
return mapping.findForward(target);
}
}
===========================================================================
==============================LookUpForm.java============================
package ch03;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class LookUpForm extends ActionForm
{
private String symbol=null;
public void setSymbol(String symbol)
{
this.symbol=symbol;
}
public String getSymbol()
{
return symbol;
}
public void reset(ActionMapping mapping,HttpServletRequest request)
{
this.symbol=null;
}
}
===========================================================================