Forums Register Login

passing object from jsp to java class

+Pie Number of slices to send: Send
Hi

How do I pass an object from jsp to my java class using input tag or something else. Currently I have the follwoing code

<input name="editQuestion" type="image"
src="images/edit.gif"
alt="Edit Question"
title="Edit Question"
onnClick="setAction('editQuestion', 'surveyQuestion.do?surveyQuestion.surveyName&surveyQuestion.sequence&....)

I actually want to be able to pass the while surveyQuestion object. How do I do that.
Thanks
+Pie Number of slices to send: Send
You don't. Firstly, any object that is in scope while the JSP is executing on the server goes out of scope as soon as the response is sent to the client.

Secondly, the HTTP protocol limits you to submitting strings as request parameters via a form submission. No objects -- no nothing, except strings.

Perhaps this article on the life-cycle of JSP pages will help you understand these concepts.

If you want/need a server-side object to have a scope greater than the lifetime of the current request, you will need to explore alternate means to do so. Perhaps as a scoped variable in session scope?
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 741 times.
Similar Threads
pass object from one jsp to other using html:link
JSF Edit Page
Getting input from the User
How to pass a class object from servlet to jsp page
using model 1 Architecture for inserting row into DB...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:06:58.