aspose file tools
The moose likes JSP and the fly likes JSP request object. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply 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: 133

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: 56185
    
  13

Please read this JspFaq entry.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JSP request object.
 
Similar Threads
Sorting
Sort this!!!!!
File Operations Program Problem
Doubt about JWeb+ mock exam question
help with a statement