I figured it out. Here is the code :

public class LoginClass extends javax.portlet.GenericPortlet {
                /**URI for the VIEW mode JSP page*/
                private String VIEW_URI ="/pages/LoginJSP.jsp";
                /**URI for the EDIT mode JSP page*/
                private static final String EDIT_URI =
"/pages/LoginJSP.jsp";
                /**URI for the Action JSP page*/
                private String ACTION_URI = "/pages/ActionJSP.jsp";
                private String action;
                public LoginClass() {action = "no";}
        public void doView(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response) throws
javax.portlet.PortletException, java.io.IOException {
                
                if(action=="no")
                {
                        response.setContentType("text/html");
                        response.setTitle("WelcomePiyush");
                        javax.portlet.PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher(VIEW_URI);
                        rd.include(request, response);
                }
                
                if(action == "yes")
                {
                        response.setContentType("text/html");
                        response.setTitle("WelcomePiyush");
                        javax.portlet.PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher(ACTION_URI);
                        rd.include(request, response);                  
                }
        }

        public void doEdit(javax.portlet.RenderRequest request,
javax.portlet.RenderResponse response) throws
javax.portlet.PortletException, java.io.IOException {
                response.setContentType("text/html");
                javax.portlet.PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher(EDIT_URI);
                rd.include(request, response);
        }
        
        public void processAction(ActionRequest request,ActionResponse
response)
        {
                action= "yes";
                try
                {
                        response.setWindowState(WindowState.MAXIMIZED);
                }
        catch (WindowStateException e)
                {
                        e.printStackTrace();
                }       
        }
        
Thanks, for the help.

-P

-----Original Message-----
From: David Sean Taylor [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 12, 2005 2:22 AM
To: Jetspeed Users List
Subject: Re: help with portlets

Hari, Piyush wrote:
> I want to display another JSP page in a portlet once the user clicks on a
> 'Submit' button. I associated the action to the
processAction(ActionRequest
> request, ActionResponse response)  function. I am sure it gets called.
What
> should I include under this to accomplish my goal ?
> 
> Please help . Your hel would be greatly appreciated. I am sitting over
this
> issue for long now.
> 
> Thanks in advance,
> Piyush
> 
Hi Piyush,

Try the Bridges GenericServletPortlet, or a similar approach.
It allows you to override the view page in a request attribute, and then 
fall back to the prefs. Could probably use a PORTLET_SCOPE session 
variable as well here.

     public void doView(RenderRequest request, RenderResponse response)
     throws PortletException, IOException
     {
         String viewPage = this.defaultViewPage;

          //    allow ViewPage override by the request
                String reqViewPage = (String)
request.getAttribute(PARAM_VIEW_PAGE);
                if(reqViewPage != null)
                {
                        viewPage = reqViewPage;
                }
                
         if (this.allowPreferences == true)
         {
             PortletPreferences prefs = request.getPreferences();


             if (prefs != null && reqViewPage == null)
             {
                 viewPage = prefs.getValue(PARAM_VIEW_PAGE, 
this.defaultViewPage);
             }
         }

         if (viewPage != null)
         {
             PortletContext context = getPortletContext();
             PortletRequestDispatcher rd = 
context.getRequestDispatcher(viewPage);
             rd.include(request, response);
         }
         return;
     }


-- 
David Sean Taylor
Bluesunrise Software
[EMAIL PROTECTED]
[office] +01 707 773-4646
[mobile] +01 707 529 9194

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to