Re: Access JahiaData object in web_css.jsp

Philippe Vollenweider <[email protected]>
Newsgroups gmane.comp.cms.jahia.template
Message-ID <[email protected]>
Hello,

If you want to use the jData in your dynamic css, you should send the 
siteId and the currentPageId to your jsp, then you can construct a jData 
like this:

try {
     siteId = Integer.parseInt(request.getParameter("siteId"));
} catch (NumberFormatException nfe) {
     logger.debug("Could not get siteId: " + nfe);
}
int currentPageId = -1;
try {
     currentPageId = Integer.parseInt(request.getParameter("currentPageId"));
} catch (NumberFormatException nfe) {
     logger.debug("Could not get currentPageId: " + nfe);
}
if ((siteId != -1) && (currentPageId != -1)){
     JahiaUser user = (JahiaUser) 
request.getSession().getAttribute(ParamBean.SESSION_USER);
     JahiaSite site = JahiaSitesBaseService.getInstance().getSite(siteId);
     AdminParamBean jParams = new AdminParamBean(request,response,
         getServletConfig().getServletContext(),Jahia.getSettings(),
         System.currentTimeMillis(),ParamBean.GET_METHOD,site,user,
         ContentPage.getPage(currentPageId));
     jParams.setUser(user);
     jParams.setOperationMode(ParamBean.EDIT);
     JahiaData jData = new JahiaData(jParams);
}

Cheers,

Philippe.

At 21.02.2005 10:20, you wrote:
>Hi !
>
>I need to access the JahiaData object in the web_css.jsp. But,
>when I try to get it with this code
>
>JahiaData jData =
>(JahiaData)request.getAttribute("org.jahia.data.JahiaData");
>
>the jData is null !
>
>Can you explain me ? If i use <jsp:include
>page="web_css.jsp"/> the object is not null ... WHY ?
>
>Thanks
>
>Ghislain CUSSONNEAU
>CRIL Technology
>Technoparc de l'Aubinière
>44000 Nantes
>02 51 89 64 50 Accédez au courrier électronique de La Poste : 
>www.laposte.net ; 3615 LAPOSTENET (0,34€/mn) ; tél : 08 92 68 13 50 (0,34€/mn)

-------=[ pvollenweider at jahia dot com ]=---------
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.