aspose file tools*
The moose likes JSP and the fly likes passing object from jsp to java class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "passing object from jsp to java class" Watch "passing object from jsp to java class" New topic
Author

passing object from jsp to java class

Muhammad Imad Qureshi
Ranch Hand

Joined: Sep 13, 2005
Posts: 238
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

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?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing object from jsp to java class