Hello
Thank you for response.

player.jsp is very simple

<%@ taglib uri="http://portals.apache.org/bridges/struts/tags-portlet-html"; 
prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean"; prefix="bean" %>

<%= request.getAttribute("displayHTML") %>




displayHTML is generated in Action class and looks like this:




public class PlayerWelcomeAction extends Action{
    
    public ActionForward execute(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws Exception {
        // TODO Auto-generated method stub
        
        LDConnection myEngine = (LDConnection) 
request.getSession().getAttribute(LDConnection.KEY);
        Render myRender = (Render) 
request.getSession().getAttribute(Render.KEY);
        Properties props = (Properties) 
request.getSession().getServletContext().getAttribute("props");
        
        String data = "";
        String switchRolesHTML = "";
        String activityTreeHTML = "";
        String selectCourseHTML = "";
        String contentHTML = "";
        
        // get the switch roles form
        data = myRender.getXMLDeclaration();
        data = data + "<?active-role id=\"" + myEngine.getActiveRole() + "\" 
?>";
        data = data + myEngine.getUserRoles();
        switchRolesHTML = 
myRender.doTransform(data,props.getProperty("render.xsl.switchroleform"));
        
        // get the activity tree
        data = myEngine.getActivityTree();
        activityTreeHTML = 
myRender.doTransform(data,props.getProperty("render.xsl.activitytree"));
         
        // get the form to switch course
        data = myEngine.listUolsForUser((String) 
request.getSession().getAttribute("userid"));    
        selectCourseHTML = 
myRender.doTransform(data,props.getProperty("render.xsl.selectcourse"));
        
        // get the title of this UoL
        RunDto runDto = myEngine.getRun();
        UolDto uolDto = myEngine.getUol(runDto.getUolId());
        String myTitle = uolDto.getTitle();
        
        //
        contentHTML = "<h1>" + myTitle + "</h1>Welcome to the course, please 
use the links in the menu to navigate though this course.";
        
//        now create the HTML skeleton for the page
          data = myRender.getXMLDeclaration();
          data = data + "<layout>";
          data = data + "<title>" + myTitle + "</title>";
          data = data + "<roles/>";
          data = data + "<activitytree/>";
          data = data + "<metadatacontent/>";
          data = data + "<environmenttree/>";
          data = data + "<pagecontent/>";
          data = data + "<supportuser/>";
          data = data + "<selectcourse/>";
          data = data + "</layout>";

          String pageHTML = 
myRender.doTransform(data,props.getProperty("render.xsl.layout"));

//         replace the parameters in the skeleton with the 'real' html 
generated above

          pageHTML = 
pageHTML.replaceAll("<pagecontent></pagecontent>",contentHTML);
          pageHTML = 
pageHTML.replaceAll("<activitytree></activitytree>",activityTreeHTML);


          if(selectCourseHTML.trim().length() == 0 ){
              pageHTML = 
pageHTML.replaceAll("<selectcourse></selectcourse>","");
           } else {
              pageHTML = 
pageHTML.replaceAll("<selectcourse></selectcourse>",selectCourseHTML);
           }
          
          if(switchRolesHTML.trim().length() == 0){
            pageHTML = pageHTML.replaceAll("<roles></roles>","");
          } else {
            pageHTML = pageHTML.replaceAll("<roles></roles>",switchRolesHTML);
          }
          request.setAttribute("displayHTML",pageHTML);
        
        return mapping.findForward("success");        
    }
}

I think the problem lies in one of XSL used here - "render.xsl.activitytree". 
There is one attribute which defines the url of links


<xsl:attribute 
name="href">



  <xsl:text>Player.do?actid=</xsl:text> 



  <xsl:value-of select="@identifier" /> 



  <xsl:text 
disable-output-escaping="yes">&type=</xsl:text> 




  <xsl:value-of select="local-name()" /> 



  <xsl:text>&environments=</xsl:text> 



  <xsl:value-of select="@environment" /> 


  </xsl:attribute>

Player.do is the next action that should take place and than there are some 
extra properties of every link so if I move cursor over this link I see

http://localhost:8080/liferay/c/portal/Player.do?and properties of chosen 
activity

The problem is that when I use this link within portal i loose the previous 
context. So for example before clicking the link the url in my browser looks 
like this:

http://localhost:8080/liferay/c/portal/layout?
p_l_id=PRI.15.1&p_p_id=sled2_WAR_sled2&p_p_action=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-
2&p_p_col_pos=0&p_p_col_count=1&_sled2_WAR_sled2__spage=%2FLoginCourse.do&_sled2_WAR_sled2__sorig=%
2FGetUOLs.do

and after clicking

http://localhost:8080/liferay/c/portal/layout?p_l_id=PRI.15.1

The jsp doesnt change. It should work(and work as web app) like this that after 
clicking any of links the player.jsp display the same list of links and another 
content on the right side of the screen.

Here ate two screen that shoul give you some idea how doest it work:

http://i23.photobucket.com/albums/b394/polakpl/liferay.jpg
http://i23.photobucket.com/albums/b394/polakpl/liferay2.jpg

Do you have any suggestions or more question? Any help would be deeply 
appreciated.

Best regards
Bartek




----- Original Message ----
From: Ate Douma <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, August 14, 2007 3:19:32 PM
Subject: Re: Struts application within  Liferay portal

Bartek Robert wrote:
> Hello
> I have problems with integration of struts application within Liferay using 
> struts bridge. 
> 
> ...
> 
> It
> works like this - User have to login (/Login). If everything is ok than
> the system checks what materials are available for this user(/GetUOLs)
> and he gets a choice which course he wants to start (/getuols.jsp) Than
> the approperiate data is shown to him (/LoginCourse ->
> /PlayerWelcome ->player.jsp).
> 
> player.jsp looks like this:
> 
> <%@ taglib uri="http://portals.apache.org/bridges/struts/tags-portlet-html";; 
> prefix="html" %>
> <%@ taglib uri="http://struts.apache.org/tags-bean";; prefix="bean" %>
> 
> <%= request.getAttribute("displayHTML") %>
> 
> Eveything
> work fine till this point. After the course is presented to user he has
> a possibility to choose different activties but after clicking at the
> name of one of them nothing changes on the screen and the url in
> browser is cut from:
> http://localhost:8080/liferay/c/portal/layout?p_l_id=PRI.15.1&p_p_id=sled2_WAR_sled2&p_p_action=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-2&p_p_col_pos=0&p_p_col_count=1&_sled2_WAR_sled2__spage=%2FLoginCourse.do&_sled2_WAR_sled2__sorig=%2FGetUOLs.do
> 
> to
> 
> http://localhost:8080/liferay/c/portal/layout?p_l_id=PRI.15.1
> 
> When
> I run it as web application everything works fine. Maybe someone could
> help because Im fighting with it for a quite long time?
> 
Can you show the part from (I think) player.jsp which renders these activity 
links, and what output is generated for them?
Also useful is to configure commons-logging/log4j on DEBUG level for both the 
Struts Bridge (org.apache.portals.bridges.struts.*) and Struts itself to be 
able 
to track down the exact interaction flow.

Ate

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






       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow

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

Reply via email to