- This topic has 1 reply, 2 voices, and was last updated 19 years, 1 month ago by Riyad Kalla.
-
AuthorPosts
-
rmanoj21MemberHi,
I am new to struts. i am trying to run a sample application in struts. I am stucking with this error.
javax.servlet.ServletException: No getter method for property lastName of bean org.apache.struts.taglib.html.BEAN
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:495)
at org.apache.jsp.submit_jsp._jspService(submit_jsp.java:97)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)root cause
javax.servlet.jsp.JspException: No getter method for property lastName of bean org.apache.struts.taglib.html.BEAN
at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:973)
at org.apache.struts.taglib.html.BaseFieldTag.prepareValue(BaseFieldTag.java:121)
at org.apache.struts.taglib.html.BaseFieldTag.renderInputElement(BaseFieldTag.java:102)
at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:81)
at org.apache.jsp.submit_jsp._jspx_meth_html_text_0(submit_jsp.java:178)
at org.apache.jsp.submit_jsp._jspx_meth_html_form_0(submit_jsp.java:129)
at org.apache.jsp.submit_jsp._jspService(submit_jsp.java:88)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)But i have getter method for the bean.
here is the form class/*
* Created on Nov 10, 2005
*
* TODO To change the template for this generated file go to
* Window – Preferences – Java – Code Style – Code Templates
*/
package hansen.playground;
import org.apache.struts.action.ActionForm;/**
* @author rramasub
*
* TODO To change the template for this generated type comment go to
* Window – Preferences – Java – Code Style – Code Templates
*/
public final class SubmitForm extends ActionForm {private String address;
private String lastName = “Hansen”;
private String sex;
private String age;
/**
* @return Returns the address.
*/
public String getAddress() {
return address;
}
/**
* @param address The address to set.
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return Returns the age.
*/
public String getAge() {
return age;
}
/**
* @param age The age to set.
*/
public void setAge(String age) {
this.age = age;
}
/**
* @return Returns the lastName.
*/
public String getLastName() {
return lastName;
}
/**
* @param lastName The lastName to set.
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* @return Returns the sex.
*/
public String getSex() {
return sex;
}
/**
* @param sex The sex to set.
*/
public void setSex(String sex) {
this.sex = sex;
}}
here is the action class
/*
* Created on Nov 10, 2005
*
* TODO To change the template for this generated file go to
* Window – Preferences – Java – Code Style – Code Templates
*/
package hansen.playground;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;/**
* @author rramasub
*
* TODO To change the template for this generated type comment go to
* Window – Preferences – Java – Code Style – Code Templates
*/
public class ActionClass extends Action{public ActionForward perform(ActionMapping mapping,ActionForm form,HttpServletRequest req,HttpServletResponse res){
SubmitForm f = (SubmitForm)form;
String LastName = f.getLastName();
req.setAttribute(“LastName”,LastName.toUpperCase());
return (mapping.findForward(“success”));
}
}here is the struts-config.xml file
<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
<!DOCTYPE struts-config PUBLIC
“-//Apache Software Foundation//DTD Struts Configuration 1.2//EN”
“http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd”><!–
This is a blank Struts configuration file with an example
welcome action/page and other commented sample elements.Tiles and the Struts Validator are configured using the factory defaults
and are ready-to-use.NOTE: If you have a generator tool to create the corresponding Java classes
for you, you could include the details in the “form-bean” declarations.
Otherwise, you would only define the “form-bean” element itself, with the
corresponding “name” and “type” attributes, as shown here.
–><struts-config>
<!– ========== Form Bean Definitions ================= –>
<form-beans><form-bean name=”SubmitForm” type=”org.apache.struts.validator.DynaValidatorForm”>
<form-property name = “LastName” type = “java.lang.String”/>
<form-property name = “Address” type = “java.lang.String”/>
<form-property name = “Sex” type = “java.lang.String”/>
<form-property name = “Age” type = “java.lang.Integer”/>
</form-bean></form-beans>
<!– ========== Action Mapping Definitions ============ –>
<action-mappings><action path=”/submit” type=”hansen.playground.ActionClass”
name=”SubmitForm”
input = “/submit.jsp”
scope=”request”>
<forward name=”success” path=”/submit.jsp”/>
<forward name=”failure” path=”/submit.jsp”/>
</action>
</action-mappings><!– ============================================= Controller Configuration –>
<controller
processorClass=”org.apache.struts.tiles.TilesRequestProcessor”/><!– ======================================== Message Resources Definitions –>
<message-resources parameter=”MessageResources” />
<!– =============================================== Plug Ins Configuration –>
<!– ======================================================= Tiles plugin –>
<!–
This plugin initialize Tiles definition factory. This later can takes some
parameters explained here after. The plugin first read parameters from
web.xml, thenoverload them with parameters defined here. All parameters
are optional.
The plugin should be declared in each struts-config file.
– definitions-config: (optional)
Specify configuration file names. There can be several comma
separated file names (default: ?? )
– moduleAware: (optional – struts1.1)
Specify if the Tiles definition factory is module aware. If true
(default), there will be one factory for each Struts module.
If false, there will be one common factory for all module. In this
later case, it is still needed to declare one plugin per module.
The factory will be initialized with parameters found in the first
initialized plugin (generally the one associated with the default
module).
true : One factory per module. (default)
false : one single shared factory for all modules
– definitions-parser-validate: (optional)
Specify if xml parser should validate the Tiles configuration file.
true : validate. DTD should be specified in file header (default)
false : no validationPaths found in Tiles definitions are relative to the main context.
–><plug-in className=”org.apache.struts.tiles.TilesPlugin” >
<!– Path to XML definition file –>
<set-property property=”definitions-config”
value=”/WEB-INF/tiles-defs.xml” />
<!– Set Module-awareness to true –>
<set-property property=”moduleAware” value=”true” />
</plug-in><!– =================================================== Validator plugin –>
<plug-in className=”org.apache.struts.validator.ValidatorPlugIn”>
<set-property
property=”pathnames”
value=”/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml”/>
</plug-in><plug-in className=”form-def.plugin.FormDefPlugIn”>
<set-property property=”pathnames” value = “/WEB-INF/form-defs.xml”/>
</plug-in></struts-config>
can anyone help me in this issue?
Thanks for all your response
Riyad KallaMemberMoving to OT > Soft Dev
I’ve never used the <property> fields for form-beans before, I’ve always hand coded them and not used Dyna, if you change the LastName to lastName, does it work out of curiosity?
-
AuthorPosts