| Author |
pass object from jsp to controller command
|
|
|
| How do I pass an object from jsp to a controller command or from jsp to jsp
Thanks
| |
|
| Hi,
Please note that these are educated guesses as to how you might be
able to accomplish the 2 tasks. You can either try some of these
suggestions or perhaps wait for a more experienced developer to post a
response.
I am not sure if this would work but you should be able to save the
object to the session from within the JSP and then access that object
within the controller command. If you are calling the controller
command from within a JSP scriptlet, by using the
ControllerCommandInvokerDataBean, then you should be able to add the
object to the request properties that you set for the command.
If a jsp is including another jsp then should be able to just add the
object to the request before including the other jsp. Then within the
included JSP you should be able to pull the object off of the request.
If by "from jsp to jsp" you mean an html link in the content generated
by 1 jsp that points to another jsp then I am not sure how you would
do this other than by saving the object to the session in jsp 1 and
then retrieving it from the session in jsp 2.
Hopefully this is somewhat helpful. Perhaps one of the more
experienced readers of this newsgroup might be able to provide some
better guidance.
Good Luck,
John
On Tue, 19 Apr 2005 10:52:12 EDT, <scheng@sharedvision.com> wrote:
>How do I pass an object from jsp to a controller command or from jsp to jsp
>Thanks
| |
|
| Thanks for your reply.
I am not allow to use the session object. And I am trying need to pass an object from JSP to servlet using the post method.
Thanks
| |
|
| If the object is serializable could you serialize it, add it to a
hidden field as text and then in the servlet get the value of that
hidden field as a string and then deserialize back to an object? This
is just a thought based on very little knowledge about serialization.
I am also not sure about whether this violates any "best practices"
rules but my guess is that it might.
- John
On Tue, 19 Apr 2005 12:25:26 EDT, <scheng@sharedvision.com> wrote:
>Thanks for your reply.
>
>I am not allow to use the session object. And I am trying need to pass an object from JSP to servlet using the post method.
>
>Thanks
| |
| George Niece 2005-04-19, 6:11 pm |
| What kind of object?
Do you work for Drake Philbrook, by chance?
<scheng@sharedvision.com> wrote in message
news:1244248791.1113922364289.JavaMail.wassrvr@ltsgwas007.sby.ibm.com...
> How do I pass an object from jsp to a controller command or from jsp to
jsp
> Thanks
>
| |
|
| It's a search resultset. yes I work for Drake. You know him? What a coincidence.
thanks
| |
| George Niece 2005-04-19, 6:11 pm |
| I should have asked this before, but how big is the object?
<scheng@sharedvision.com> wrote in message
news:472349423.1113947022259.JavaMail.wassrvr@ltsgwas007.sby.ibm.com...
> It's a search resultset. yes I work for Drake. You know him? What a
coincidence.
> thanks
| |
|
| It's pretty big, so we don't want to store that in the session.
Thanks
| |
| George Niece 2005-04-20, 5:53 pm |
| I can definitely understand the desire not to make the session too big,
however, as long as you are removing the attribute upon arriving at the
ControllerCmd invoked, what is the issue with using it in this instance
where it appears appropriate. If the resultset is not database derived then
I think you are best off using session. If the resultset is derived from
database queries then just pass the appropriate row ids rather than the full
resultset and retrieve the appropriate data in the ControllerCmd using those
row ids.
Having said the above, if the data is not derived from the database and is
going to be used by multiple chained commands or page flows then it should
be serialized in the database and retrieved at each access point.
<scheng@sharedvision.com> wrote in message
news:1028880677.1114003520499.JavaMail.wassrvr@ltsgwas007.sby.ibm.com...
> It's pretty big, so we don't want to store that in the session.
>
> Thanks
|
|
|
|