• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

No getter method for property

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi fellaz.

i know u guys probably heard millions of times about this error, but i need a little help...

i've been reading these topicz about getter not found, and tried most of the things posted but i'm still getting the frustrating error.

"No getter method for property usrID of bean rg.apache.struts.taglib.html.BEAN"

when I was using "ActionForm" class i wasn' getting this error but when i created the new project and using "DynaActionForm", it started the error...



**************DynaActionForm***********

public class TozaiApplicationForm extends DynaActionForm {
private String usrID;

public String getUsrID() {
return usrID;
}

public void setUsrID(String usrID) {
this.usrID = usrID;
}
}



**************struts-config***********

<struts-config>
<data-sources>
</data-sources>

<form-beans>
<form-bean name="TozaiApplicationForm" type="TozaiApplicationForm"/>
</form-beans>

<global-exceptions>
</global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>

<action path="/apply"
name="TozaiApplicationForm"
type="TozaiApplicationAction"
input="/TozaiApplicationForm.jsp"
attribute="TozaiApplicationForm">
<forward name="success" path="/TozaiConfirmation.jsp"/>
</action>

</action-mappings>
<controller/>
<message-resources parameter="MessageResources"/>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
</struts-config>


*********************TozaiApplicationForm.jsp************
<body>
<html:form method="POST" action="/apply">
<html:text property="usrID"></html:text>
<html:submit value="Submit"></html:submit>
</html:form>
</body>

*********************TozaiApplicationAction.java************

public class TozaiApplicationAction extends Action {

public ActionForward execute(ActionMapping arg0, ActionForm arg1,
HttpServletRequest arg2, HttpServletResponse arg3) throws Exception {

TozaiApplicationForm appform = (TozaiApplicationForm)arg1;
System.out.println(appform.getUsrID());

return arg0.findForward("success");
}

}


...I don think Action.java is necessary to post 'cause it's not even reaching there, but just in case...


anyway, it's just a simplest app...
how is it possible to go wrong??
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have very little experience with DynaActionForm, (I prefer to create actual ActionForm classes), but I know enough to think that you have some things messed up. The idea of DynaActionForm is that you do not need to create a bunch of classes derived from ActionForm. Instead you dynamically create these forms through configuration entries in your struts-config file.

Here is an example taken from http://struts.apache.org/struts-action/userGuide/building_controller.html

<form-bean
name="UserForm"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="givenName"
type="java.lang.String"
initial="John"/>
<form-property
name="familyName"
type="java.lang.String"
initial="Smith"/>
</form-bean>

- Brent

[ February 09, 2006: Message edited by: Brent Sterling ]
[ February 09, 2006: Message edited by: Brent Sterling ]
 
merabi kamjin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thnx for reply, Brent Sterling.

I think u just solve the prob!

The reason y i wanted 2 use dynaction is to use the validator.
 
merabi kamjin
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...self replay here...

just found out the validatorform class yo...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic