• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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: 42022
916
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.
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic