• 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

doubt in Struts application

 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Anil!!!

Now i'm clear with the concept.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic