File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New to struts, please help

 
san geetha
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Kedar Dravid
Ranch Hand
Posts: 333
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Tinku Narang
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
siva kumar
Ranch Hand
Posts: 86
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Geetha,

form bean should contain the accessor methods form fields.

i.e setXXX(..)
getXXX()

methods
 
Bikramjit Debnath
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic