• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

New to struts, please help

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Iam totally new to struts,
I have a jsp named Trial.jsp which has tag
<html:select property = 'selName' name="TrialFormBean">
<html ptions .....>
</html:select>
Also have a formBean by name TrialFormBean which contains the following code,
private String selName;
...
...
public String getName()
{
return strName;
}

public void setName(String Name)
{
strName = Name;
}
In struts-config.xml have included TrialFormBean as

<form-beans>
<form-bean name="TrialFormBean"
type="formBeans.TrialFormBean"/>
</form-beans>

<action-mappings>
<action
path="/Trial"
type="actions.TrialAction"
name="TrialFormBean">
</action>
</action-mappings>

But i get the following error message:
No getter method available for property selName for bean under name TrialFormBean

What could be my mistake.
 
san geetha
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kindly excuse for being so ignorant.
solved the issue myself.
Today is day 2 of struts learning.

Can anyone let me knw the difference between property attribute and labelproperty attribute in <options> tag present in HTML taglib.

Thanks in advance.
Regards,
Sangeetha
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The property attribute is what gets passed to the Action class when u submit your form. It is the value of ur current option selection, whereas the labelProperty attribute is what is displayed as the option text.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi geetha

U have written the property in select as selName so ue formabean should contain setter and getter for this name i.e. setSelName and getSelName be sure that u have 'S' capital in both the cases that is required than only ur value will be set in the formbean otherwise not.

Try this if solved do tell me , and if not then also

Best Regard
Pankaj Narang
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Geetha,

form bean should contain the accessor methods form fields.

i.e setXXX(..)
getXXX()

methods
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by san geetha:
Iam totally new to struts,
I have a jsp named Trial.jsp which has tag
<html:select property = 'selName' name="TrialFormBean">
<html ptions .....>
</html:select>
Also have a formBean by name TrialFormBean which contains the following code,
private String selName;
...
...
public String getName()
{
return strName;
}

public void setName(String Name)
{
strName = Name;
}
In struts-config.xml have included TrialFormBean as

<form-beans>
<form-bean name="TrialFormBean"
type="formBeans.TrialFormBean"/>
</form-beans>

<action-mappings>
<action
path="/Trial"
type="actions.TrialAction"
name="TrialFormBean">
</action>
</action-mappings>

But i get the following error message:
No getter method available for property selName for bean under name TrialFormBean

What could be my mistake.

 
Bikramjit Debnath
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should have a field (veriable, not function) called "selName" in your bean, and a getter method for it(getselName() , and that's all...your code should give no error next time you rebield it !

After all your code says that you want to see a property selName in the "select" options...(combobox) fetching it from the bean.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic