1 Reply Latest reply on Mar 16, 2005 12:13 PM by karanmg

    Strurts portlets on jBoss Portal?

      Has anyone transferred their Struts application to run as a JSR168 portet in jBoss Portal??
      I am using jBossAS 4.0.1sp1 and jBoss Portal v2.0.

      Whats confusing me is this: In struts, every action defines the html/jsp/freemarker etc page that should be displayed. on the user's screen.
      However, to display something in a portlet, it should be called inside the doView() function of the portlet,

      This statement is in the doView() function of my portlet's class:
      ......
      PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/main.do");
      ......

      My struts-config:
      ....




      .....

      The above scenario displays the content of main.ftl in the portlet's window, just like it should, i.e. the portlet called main.do, and whatever main.do returns (main.ftl) is sent to the portlet to be displayed. But, when I put a link in main.ftl which points to another action, (say, trial.do), the result of those actions is not displayed in the portal.
      My main.ftl:
      <#assign html=JspTaglibs["/WEB-INF/struts-html.tld"]>
      <#assign bean=JspTaglibs["/WEB-INF/struts-bean.tld"]>
      This is main.ftl in stack2.war.
      If you see this, it means basic Struts action-mapping is working.
      <@html.link action="trial.do">Show Trial</@html.link>

      When I click on the "Show Trial" link on main.ftl, the application leaves the portal and shows the content of trial.ftl on the browser (no portal/portlets, just trial.ftl).
      How do I make sure that whatever I do in struts stays inside the portlet window?

      Regards,
      Karan

        • 1. Re: Strurts portlets on jBoss Portal?

          The code:

          struts-config.xml:

          <action path="/main"
           type="portlet.mote.beans.MainAction">
           <forward name="success" path="/FTLs/main.ftl"/>
          </action>
          <action path="/trial" forward="/FTLs/trial.ftl"/>
          


          main.ftl
          <#assign html=JspTaglibs["/WEB-INF/struts-html.tld"]>
          <#assign bean=JspTaglibs["/WEB-INF/struts-bean.tld"]>
          This is main.ftl in stack2.war.
          If you see this, it means basic Struts action-mapping is working.
          <p><@html.link action="trial.do">Show Trial</@html.link></p>