Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt in Struts application

 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i'm new to struts.I'm just trying to create one application.

search.jsp
==========


Can anyone please let me know how the setname and set ssnum as there is no call for setName() and setSsNum().

Can anyone please tell where it is being set?

Thanks in Advance.


[/CODE]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jay Shukla:
Can anyone please let me know how the setname and set ssnum as there is no call for setName() and setSsNum().

Can anyone please tell where it is being set?

Struts automatically calls setters for the form fields. So "name" calls "setName" and "ssNum" calls "setSsNum".
 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,

Thanks for your valuable reply!!!

But how struts will know that ssNum is being(will be) set setSsNum() method as it does not match with property name in JSP.

I mean to say is in .jsp property name is ssNum where as in SearchForm it is setSsNum().

Please help mein clearing above concept.

Thanks in Advance.
 
Anil Mundra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
as you wrote..............
I mean to say is in .jsp property name is ssNum where as in SearchForm it is setSsNum().

Here the concept is that the property name which is given in jsp file i.e. ssNum will be autometically retrived in bean class in the variable with same name.

Now I think you are confusing in it:-
In jsp property name ssNum
In Bean class variable name ssNum

Mean both are same

But the standard syntax of getters and setters is
setSsNum and getSsNum
Here we have to use the first letter as capital. So these above two method works for ssNum.

Now I think it is clear to you.........
Cheers
 
Jay Shukla
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Anil!!!

Now i'm clear with the concept.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic