A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Frameworks
»
Struts
Author
error comes while running the struts application please see the source code for detail
tamnna arzoo
Greenhorn
Joined: Mar 23, 2010
Posts: 23
posted
Mar 30, 2010 01:16:15
0
Name ActionForm.java when i run my web application using the eclipse following error comes here iam doing nothin just compile the jsp page package de.laliluna.tutorial.actionform.action; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class ExampleForm extends ActionForm { public String name; public int age; public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void reset(ActionMapping mapping, HttpServletRequest request) { name = "Adam Weisshaupt"; age = 23; } } ExampleAction.java package de.laliluna.tutorial.actionform.form; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import de.laliluna.tutorial.actionform.action.ExampleForm; public class ExampleAction extends Action { public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) { ExampleForm exampleForm = (ExampleForm) form; System.out.println(exampleForm.getName()); System.out.println(exampleForm.getAge()); return mapping.findForward("showExample"); } } example.jsp <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <html> <head> <title>JSP for exampleForm</title> </head> <body> <html:form action="/example"> <html:errors /> <br> Name: <html:text property="name" /> <br> Age: <html:text property="age" /> <br> <html:submit value="Send"/> </html:form> </body> </html> struts-config.xml <?xml version="1.0" encoding="UTF-8"?> <!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> <data-sources/> <form-beans> <form-bean name="exampleForm" type="de.laliluna.tutorial.actionform.action.ExampleForm" /> </form-beans> <global-exceptions/> <global-forwards/> <action-mappings> <action attribute="/exampleForm" input="/example.jsp" name="exampleAction" path="/example" scope="request" type="de.laliluna.tutorial.actionform.form.ExampleAction"> <forward name="showExample" path="/example.jsp"/> </action> </action-mappings> </struts-config> web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>3</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>3</param-value> </init-param> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>example.jsp</welcome-file> </welcome-file-list> </web-app> HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /example.jsp at line 15 12: 13: <body> 14: 15: <html:form action="/example"> 16: 17: <html:errors /> <br> 18: Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:515) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:408) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) root cause javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean: "exampleAction" on action: "/example" org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:855) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784) org.apache.jsp.example_jsp._jspService(example_jsp.java:93) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) root cause javax.servlet.jsp.JspException: Cannot retrieve definition for form bean: "exampleAction" on action: "/example" org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:881) org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:488) org.apache.jsp.example_jsp._jspx_meth_html_005fform_005f0(example_jsp.java:110) org.apache.jsp.example_jsp._jspService(example_jsp.java:81) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs. -------------------------------------------------------------------------------- Apache Tomcat/6.0.10
Rajkumar balakrishnan
Ranch Hand
Joined: May 29, 2008
Posts: 445
I like...
posted
Mar 30, 2010 01:20:06
0
Just remove the name attribute from struts-config.xml and let us know what happens.
Never try to be a hard-worker. Be a smart-worker.
My Blog
tamnna arzoo
Greenhorn
Joined: Mar 23, 2010
Posts: 23
posted
Mar 30, 2010 01:32:15
0
from which tag i have to remove the name attribute please help me
Rajkumar balakrishnan
Ranch Hand
Joined: May 29, 2008
Posts: 445
I like...
posted
Mar 30, 2010 01:35:26
0
tamnna arzoo wrote:
from which tag i have to remove the name attribute please help me
Action tag under action-mappings.
Rajkumar balakrishnan
Ranch Hand
Joined: May 29, 2008
Posts: 445
I like...
posted
Mar 30, 2010 01:48:38
0
Why you're creating a new thread when one already exist for discussion.
Anyway try rename your name attribute as exampleForm.
I agree. Here's the link:
http://aspose.com/file-tools
subject: error comes while running the struts application please see the source code for detail
Similar Threads
compilation problem
please help me error comes on my struts application see the source code for details
I need a help to solve this error
stucts application exception
when iam running my struts application following error comes please help me
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter