File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSP request object. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP request object." Watch "JSP request object." New topic
Author

JSP request object.

Zafar Anwar
Greenhorn

Joined: Jun 06, 2012
Posts: 3

In JSP I have.

<%
request.setAttribute("names", new ArrayList().add("ABC"));
out.println(request.getAttribute("names")); // It should print arraylist object. But it prints true. Can you anyone help me?
%>

getAttribute() should return either Object or null.

// But it prints true. Can you anyone help me?
Sabarish Venkat
Ranch Hand

Joined: Jan 18, 2012
Posts: 136

The array list values are been hold by object so when ever you call the object directly it will show Boolean value alone. what you have to do is keep an iterator and retrieve the values from the array list
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60045
    
  65

Please read this JspFaq entry.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Zafar Anwar wrote:
But it prints true. Can you anyone help me?


because, java.util.ArrayList.add(E) returns boolean
Zafar Anwar
Greenhorn

Joined: Jun 06, 2012
Posts: 3
Seetharaman Venkatasamy wrote:
Zafar Anwar wrote:
But it prints true. Can you anyone help me?


because, java.util.ArrayList.add(E) returns boolean


I got it, thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP request object.
 
Similar Threads
Sort this!!!!!
Doubt about JWeb+ mock exam question
help with a statement
File Operations Program Problem
Sorting