• 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

When is "setProperty" executed?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
If I use
<jsp:useBean id ="beanname" scope ="session" class="..."/>
<jsp:setProperty name="beanname",property="*" />
to transfer the request parameters to the javabean, in the mean time the form's action attribut specifies a servlet to send the request to.
Can both of them receive the request parameters?
Which one receives first?
Thanks in advance.
Mike
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mike,
When you click the Submit button, i.e when the form action is executed, the bean specified in the requested JSP gets created for the session (assuming that it is the first time you are creating it!) and thereafter the setProperty initializes the attributes of the Bean.
So the bean instance property initialization is dependent on the form action tag.
Hope this helps,
Sandeep
SCJP2, OCSD(Oracle JDeveloper), OCED(Oracle Internet Platform)
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There seems to be some confusion here.
If "in the mean time the form's action attribute specifies a servlet to send the request to."
Then the servlet certainly sees the request first. The JSP will not see the parameters unless the servlet forwards the request.
Bill

------------------
author of:
 
Mike Han
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to Desai and William
I think I understand it, it's the servlet rather than the bean who sees the request data.
Thank you very much!
Mike
[This message has been edited by Mike Han (edited July 29, 2001).]
 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right, the bean was bound in a SessionContext and none of its parameters are of HttpServletRequest type. The bean will be created and initialized within the JSP. The servlet specified in will not be called until the form is submitted.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic