Announcement Announcement Module
Collapse
No announcement yet.
JSTL and Portlet Session Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JSTL and Portlet Session

    Here's a mysterious problem.

    I am trying to use portlet with JSP together. Inside the portlet, I populate some data, put the data into portlet session and dispatch (include) to a jsp. On the jsp, if I use JSTL to access the Portlet session data, i cannot hget anything of my parameters rendered.

    Controller:

    PortletSession session = request.getPortletSession();
    session.setAttribute("lastName", account.getName().getLastName());
    session.setAttribute("firstName", account.getName().getFirstName());

    Jsp:



    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <%@ include file="/WEB-INF/common/taglibs.jsp"%>
    <h1>${lastName} == null ? 'Is null' : 'Not Null'}</h1>
    <table width="584" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="434" valign="top"><div align="right">
    <div align="left">
    <div align="right">
    <div align="right">
    <div align="right">
    <div align="right">
    <div align="right">
    <div align="right">
    <div align="right">
    <div align="right">
    <div align="right"> </div>
    <div align="right">
    <div align="right"></div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    <div align="right">
    <div align="right">
    <div align="right">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="6"></td>
    <td align="right" height="16"><img src="<c:url value="/images/gif/points.gif"/>" width="79" height="11" hspace="5" align="absbottom"><strong><span class="noirgras">Ma
    Tunisiana </span></strong><span class="text_actif">
    ›Confirmation d’inscription</span></td>
    </tr>
    <tr>
    <td width="6"><img src="<c:url value="/images/gif/coin_fondgris.gif"/>" width="6" height="13"></td>
    <td align="right" bgcolor="CBCBCB" class="titre_mini" valign="middle"><img src="<c:url value="/images/gif/carre_fleche_rouge.gif"/>" width="14" height="13" align="absmiddle"></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td align="right" class="titre_mini" valign="middle"><div align="right" class="noirgras"><strong><font color="#666666">Confirmation
    d'i</font><font color="#666666">nscription </font></strong></div></td>
    </tr>
    </table>
    </div>
    <table width="434" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td height="35" colspan="2"><img src="<c:url value="/images/gif/pix.gif"/>" width="24" height="20"><img src="<c:url value="/images/gif/titre_inscrip2.gif"/>" width="315" height="25"></td>
    </tr>
    <tr>
    <td width="24" rowspan="2" valign="middle"><div align="center"></div></td>
    <td width="392" valign="top" class="noirgras"><div align="left"><strong>Bienvenue
    dans la rubrique interactive de <span class="text_actif">Tunisiana</span>
    ! </strong></div></td>
    </tr>
    <tr>
    <td valign="top" class="noirgras"><br> <img src="<c:url value="/images/gif/slogon_succes.gif"/>" width="394" height="44"></td>
    </tr>
    <tr>
    <td width="24" valign="middle"><div align="center"></div></td>
    <td valign="top" class="noirgras"> <table width="410" border="0" cellspacing="3" cellpadding="0">
    <tr>
    <td height="5" colspan="2"><div align="right"></div></td>
    </tr>
    <tr>
    <td colspan="2" class="noirgras"><strong>Votre Profil
    :</strong></td>
    </tr>
    <tr>
    <td colspan="2" class="noirgras">&nbsp;</td>
    </tr>
    <tr>
    <td class="noirgras"><div align="right">Identifiant
    : </div></td>
    <td class="noirgras"><strong>${login} </strong></td>
    </tr>
    <tr valign="middle" class="noirgras">
    <td width="114"><div align="right">*Nom :</div></td>
    <td width="269"><strong>${lastName}</strong></td>
    </tr>
    <tr valign="middle" class="noirgras">
    <td><div align="right">*Pr&eacute;nom :</div></td>
    <td><strong>${firstName}</strong></td>
    </tr>
    <tr valign="middle" class="noirgras">
    <td><div align="right">*Date de naissance :</div></td>
    <td> <span class="noirgras"><strong>${birthDate}
    </strong></span></td>
    </tr>
    <c:if test="${!empty email}">
    <tr class="noirgras">
    <td class="noirgras"><div align="right">E-mail :</div></td>
    <td><strong>${email}</strong></td>
    </tr>
    </c:if>
    <tr class="noirgras">
    <td colspan="2" class="noirgras">&nbsp;</td>
    </tr>
    <tr class="noirgras">
    <td colspan="2" bgcolor="#D71A21" class="noirgras"><div align="left"><img src="<c:url value="/images/gif/gris.gif"/>" width="7" height="1"></div></td>
    </tr>
    <tr class="noirgras">
    <td colspan="2" class="noirgras">Vous pouvez personnaliser
    votre profil et votre Code Web dans la rubrique<strong>
    <a href="<c:url value="/profile/profile.form"/>" class="txtnoirgras">Mon
    Profil</a></strong></td>
    </tr>
    <tr class="noirgras">
    <td colspan="2" class="noirgras">&nbsp;</td>
    </tr>
    </table>
    <div align="right"></div></td>
    </tr>
    </table>
    <br>
    <div align="right">
    <p>&nbsp;</p>
    </div>
    </div>
    <div align="right"></div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </td>
    <td width="5" valign="bottom" background="<c:url value="/images/gif/separe_vert.gif"/>"><img src="<c:url value="/images/gif/fleche_fin.gif"/>" width="5" height="5"></td>
    <td width="145" valign="top"><div align="right"><img src="<c:url value="/images/jpg/totem_can.gif"/>" width="140" height="350"></div></td>
    </tr>
    </table>
    <p class="blancgras">&nbsp;</p>
    <p class="noirgras">&nbsp;</p>
    <c:remove var="login" scope="session"/>
    <c:remove var="lastName" scope="session"/>
    <c:remove var="firstName" scope="session"/>
    <c:remove var="email" scope="session"/>
    <c:remove var="birthDate" scope="session"/>
    <c:remove var="j_username" scope="session"/>
    <c:remove var="j_password" scope="session"/>


    => nothing is rendered
    Any Help, it's rather urgent

    Thks

  • #2
    have you tried setting the items on the session at APPLICATION_SCOPE? That is the only way to share session data with another servlet (which a jsp is in this case).

    Comment


    • #3
      Great!
      I've tried your solution and it works:-)
      Thanks a lot.

      Comment

      Working...
      X