Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Portals and Portlets
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework
this week in the
Java in General
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
Portals and Portlets
How to pass instance variable to the JSP
Zandis Murāns
Ranch Hand
Posts: 174
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How can I access passed variable (for example, an instance of List) to the
JSP
?
Here's how I'm trying to accomplish this:
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/view.jsp"); rd.include(request,response); } public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException { List<String> aList = new ArrayList<String>(1); aList.add("Item1"); request.setAttribute("List", aList); }
view.jsp:
... <portlet:defineObjects /> <% List<String> list = request.getAttribute("List"); // null %> ...
So how comes request.getAttribute("List") is null at this point?
Philip Thamaravelil
Ranch Hand
Posts: 99
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Move you request.setAttribute("List", aList); to the doView and it will work.
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Showing a list result in jsp view page from database
Settings for portlet
not opening a page in browser
Portlet Configuration
linking jsp pages in a liferay portlet
More...