Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to pass obejcts back to jsp from java  RSS feed

 
Kaylee Sebi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I coded java code into jsp and at the end I need to pass a java.util.List object back to JSP. I used

pageContext.setAttribute( "jspListName", javaListName);

But when jsp page get the jspListName object, it treated it a string instead of an Object ( a java.util.List). So I can't retrieve anything out.

How do I pass an object back to JSP from inline java.

Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kaylee Sebi:

I coded java code into jsp


Fristly, in this day and time you should be following accepted practices and no longer putting Java into JSPs. Please read this article for details.

Next, I'm not sure what you mean by:

and at the end I need to pass a java.util.List object back to JSP.


You are already in the JSP, how can you "pass it back" to the JSP? Or are you talking about a subsequent submission after the page has been sent to the browser?

If so, then setting a page attribute will not work. Page and request lelvel attributes only have scope during the current request.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!