| Author |
No getter method for bean write in Struts
|
Robert Wiscup
Ranch Hand
Joined: Oct 18, 2009
Posts: 45
|
|
Hi All,
Ok . . . like so many others I'm getthing the "No getter method for property: "severity" of bean: "Defects" Error Message . . .
Here are the relevant code snippets
******** JSP ************
*********** Defect.java ***************
In my action class I'm doing a Hibernate fetch which populates a list of Defect Objects and then putting it in Request Scope:
request.setAttribute("Defects", results);
If someone could help me out here I'd appreciate it . . .
Thanks!
Rob
|
 |
Siva Masilamani
Ranch Hand
Joined: Sep 19, 2008
Posts: 377
|
|
Check the scope.If possible try it with session scope.
Visit here
webpage
|
SCJP 6,SCWCD 5,SCBCD 5
Failure is not an option.
|
 |
Robert Wiscup
Ranch Hand
Joined: Oct 18, 2009
Posts: 45
|
|
I tried changing the scope from Request to Session with no luck . . . does anyone else have any ideas here?
Thanks,
Rob
|
 |
Siva Masilamani
Ranch Hand
Joined: Sep 19, 2008
Posts: 377
|
|
The rule of thumb is that the property name should start with lowercase letter.
So try changing the name to defaults.
Also
paste your Action class and struts-config.xml if possible
|
 |
Robert Wiscup
Ranch Hand
Joined: Oct 18, 2009
Posts: 45
|
|
Hi Siva,
It looks like all my property names are in lowercase . . .
********** Struts-Config
****** Action Class ********
|
 |
Siva Masilamani
Ranch Hand
Joined: Sep 19, 2008
Posts: 377
|
|
Try changing request.setAttribute("Defects", results); to request.setAttribute("defects", results); and use
<bean:write name="defects" property="severity"/>
because i was helping someone alomost like the problem the problem you have and it did resolved his problem and hope it shoud do the same for you too.
Also where did you define your forward.
I did not see one in your action class
|
 |
Robert Wiscup
Ranch Hand
Joined: Oct 18, 2009
Posts: 45
|
|
Hi Siva,
Tried that . . . Unfortunately, that didn't work either . . . hmmmm
Rob
|
 |
Siva Masilamani
Ranch Hand
Joined: Sep 19, 2008
Posts: 377
|
|
Robert Wiscup wrote:Hi Siva,
Tried that . . . Unfortunately, that didn't work either . . . hmmmm
Did you mention the forward.The return type shoud be mapping.findForward("success/failure");
Rob
|
 |
Siva Masilamani
Ranch Hand
Joined: Sep 19, 2008
Posts: 377
|
|
did you visit this link?
webpage
Try some of their solutions.
|
 |
Robert Wiscup
Ranch Hand
Joined: Oct 18, 2009
Posts: 45
|
|
Hi Siva,
I was able to solve this problem . . .
Thanks for your help . . .
Rob
|
 |
Siva Masilamani
Ranch Hand
Joined: Sep 19, 2008
Posts: 377
|
|
|
what was the problem actually?
|
 |
Robert Wiscup
Ranch Hand
Joined: Oct 18, 2009
Posts: 45
|
|
Hi Siva,
Actually I abandoned that approach and used a different approach which worked fine . . . below is some of the code I used in my solution . . .
I really appreciate your help . . .
Thanks!
Rob
|
 |
 |
|
|
subject: No getter method for bean write in Struts
|
|
|