• Post Reply Bookmark Topic Watch Topic
  • New Topic

When is "setProperty" executed?

 
Mike Han
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
  • 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)
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • 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
  • 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).]
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!