I have a Form Portlet, which takes the information from the user. I am processing the information in processAction method. After this i need to forward the user to another jsp. How can this be done ?
I cannot use PortletRequestDispatcher include method since it has normal RenderRequest and RenderResponse not ActionRequest and ActionResponse ?
Give me a bit of background...For instance, why can't you forward to the appropriate JSP from the doView method. The doView method will be invoked after the processAction.
You could add a parameter to the actionresponse, and read it in the renderresponse, and take the appropriate action depending upon this parameter. You could even put it in the portletsession if it were a permanent type of state change.
Here's a tutorial on rendering to JSP using a portlet:
Thanks for the reply. I am rendering my first jsp in doView method which shows a form. After the user hits submit button, ( this information i am processing in process Action method), it should take the user to next page. From processAction i cannot forward to second jsp. The PortalRequestDispatcher won't work since PortalRequestDispatcher's include method takes RenderRequest and RenderResponse and not ActionRequest &ActionResponse.
Please help.
thanks
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Here's what you're going to have to do. The ActionResponse has a method called setRenderParameter(key, value). What you'll have to do in the action processing phase is set something into the response:
setRenderParameter("pagetodisplay", "page2.jsp");
This will set the parameter in the action phase. Then you read it back in the render phase through.
Then, in the doView method you have something like this:
if (pageToDisplay == null) { //send user to the default landing page } else { //send user to pageToDisplay }
I think that's the way you're going to want to work it. Throw some data into the request or response object in the action phase, and then read it out during the view phase, and in the view phase, redirect to the appropriate page.
Think that will work?
-Cameron McKenzie
John Lincoln
Ranch Hand
Joined: Feb 11, 2003
Posts: 192
posted
0
Hi,
Thanks for the reply. I tried your sugesstion, did not work as expected. Below is the code.
Here are my observations: If i have just have following in the code, it works, but cannot see the next jsp
If i change it to
It says portlett is unavailable.
Following are doView and ProcessAction methods
BTW is doView called again after processAction ?.. Please help
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
But to answer your latter question, doView is indeed invoked after the event processing phase. Note though: the event processing phase isn't always called. The portlet has to be specifically invoked from an actionURL to trigger the action processing phase. Otherwise, the doView method is called.
Caching issues aside, the doView method of every portlet on the portal page is invoked when the portal renders a given portal page.
-Cameron McKenzie
John Lincoln
Ranch Hand
Joined: Feb 11, 2003
Posts: 192
posted
0
Hi,
I have tried you suggestion again and it seems to work. Thank you very much.
I have to look into why i get message"This Portlet Unavailable" at the end of the form"
Can you provide me with any pointers.
thanks
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
I get frustrated with the "Portlet Unavailable" message on JetSpeed2. I often stop the server, delete all references to the portlet application/war file, start the server, and then throw the war into the deploy directory. All of a sudden, a portlet that was unavailable becomes available again.
I can't tell you how much time I've wasted troubleshooting a portlet that was fully functional.
Happy Portal!
-Cameron McKenzie
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.