You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by priyapratheep <dp...@gmail.com> on 2013/03/26 03:18:25 UTC

How to redirect ?

Hi friends 

I am using Lifray portlet and struts. I am redirection from one portlet to
another portlet 

Below is my code 
>From Portlet 
  
    <liferay-portlet:actionURL var="linkURL" name="prepareObjects" 
portletName="apseprojectmgmtportlet_WAR_apseprojectmgmtportlet"
windowState="maximized" >  
        <portlet:param name="struts_action"
value="/apse-projectmgmt-portlet/projectCostingSheetAction2.do" />  
        <portlet:param name="procode" value="8055T215" />  
        <portlet:param name="csid" value="101" />  
    </liferay-portlet:actionURL>">   
    <a href=&quot;&lt;%= linkURL%>">link to document library   
  

In Portlet 2,I am using struts 
My code is 
In struts-config.xml file 

<action path="/portlet_action/apse-projectmgmt-portlet/viewAction"
type="com.bmtap.apse.projectmgmt.action.ProjectMgmtAction">  
            <forward name="continue" path="/jsp/project_list.jsp"></forward>              
        </action>  

<action attribute="projectCostingSheetForm2" name="DynaFormBean"
path="/apse-projectmgmt-portlet/projectCostingSheetAction2" 
type="com.bmtap.apse.projectmgmt.action.ProjectMgmtAction">  
            <forward name="continue"
path="/jsp/project_costingsheet2.jsp"></forward>  
       </action>  

My portlet.xml file

    
<portlet-class>com.bmtap.apse.projectmgmt.portlet.ProjectMgmtPortlet</portlet-class>  
        <init-param>  
            <name>ServletContextProvider</name>  
           
<value>com.liferay.util.bridges.struts.LiferayServletContextProviderWrapper</value>  
        </init-param>  
        <init-param>  
            <name>ViewPage</name>  
           
<value>/apse-projectmgmt-portlet/portlet_action/apse-projectmgmt-portlet/viewAction</value>  
        </init-param>  

Once I click link to document library in portlet 1 My page is redirected to
project_list.jsp . But I want to redirect to project_costingsheet2.jsp with
form variables procode, csid. 

One more question how can assign form variable? 

receiving variable through 

public void processAction(ActionRequest req, ActionResponse
res,ActionMapping mapping) throws PortletException, IOException  
    {  
        String procode=req.getParameter("procode");  
       String csid=req.getParameter("csid"); 

I can receive variable procode and csid and how make them to my form
parameters .. 

My Action class 
public class ProjectMgmtAction extends Action{  
@Override  
    public ActionForward execute(ActionMapping mapping, ActionForm
form,HttpServletRequest request, HttpServletResponse response) throws
Exception{  
    ...  
        DynaActionForm actionform=(DynaActionForm)form;  
    String procode = (String)actionform.get("procode");  
    request.setAttribute("procode", procode);     

I am new to struts and Lifray . Please help me sort out this 

Thanks in advance
Priya




--
View this message in context: http://struts.1045723.n5.nabble.com/How-to-redirect-tp5712300.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: How to redirect ?

Posted by priyapratheep <dp...@gmail.com>.
Hi friends,

I am using IPC call for inter portlet communication.

In portlet A

    <liferay-portlet:actionURL var="linkURL" name="prepareObjects" 
portletName="apseprojectmgmtportlet_WAR_apseprojectmgmtportlet"
windowState="maximized" >
            <portlet:param name="struts_action"
value="/apse-projectmgmt-portlet/projectCostingSheetAction2" />
            <portlet:param name="procode" value="8055T215" />
            <portlet:param name="csid" value="101" />
    </liferay-portlet:actionURL>"> 
    <a href=&quot;&lt;%= linkURL%>">MGM Portlet  
    


In portlet B where struts is used...

in portlet.xml
<init-param>
          <name>ViewPage</name>
     
<value>/apse-projectmgmt-portlet/portlet_action/apse-projectmgmt-portlet/viewAction</value>
</init-param>


In struts.xml
    <action path="/portlet_action/apse-projectmgmt-portlet/viewAction"
type="com.bmtap.apse.projectmgmt.action.ProjectMgmtAction">
            <forward name="continue" path="/jsp/project_list.jsp"></forward>            
        </action>

where is /project_list.jsp is the default page when i enter directly to the
portletB

I want to go to /jsp/project_costingsheet2.jsp page when I click the link of
Portlet A

so I tried with 
<action path="/portlet_action/apse-projectmgmt-portlet/viewAction1"
type="com.bmtap.apse.projectmgmt.action.ProjectMgmtAction">
            <forward name="continue"
path="/jsp/project_costingsheet2.jsp"></forward>            
</action>


</init-param> 
                 <name>ViewPage</name>
        
<value>/apse-projectmgmt-portlet/portlet_action/apse-projectmgmt-portlet/viewAction1</value>
</init-param>     


Page is going to project_costingsheet2.jsp where i want to go .But I
directly access Portlet B It is going to project_costingsheet2.jsp instead
of project_list.jsp

So my question is Is it possible to give two
<name>ViewPage</name> ?

How can I resolve this. 

I want to to go project_costingsheet2.jsp when i click the link in portlet A
and project_list.jsp when i directly access portlet B



--
View this message in context: http://struts.1045723.n5.nabble.com/How-to-redirect-tp5712300p5712301.html
Sent from the Struts - Dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org