[opencms-dev] Getting the tempalte name in JSP

shishank.mathur at wipro.com shishank.mathur at wipro.com
Wed Mar 8 13:25:56 CET 2006


Hi,

Here is what you can do:

Get the template name in your template by reading the "Template"
property and then pass it as a parameter to nav.jsp which then decides
based on the template value what needs to be shown.

<%
CmsJspActionElement action=new
CmsJspActionElement(pageContext,request,response);
String templateName = action.property("Template");
%>

Then while calling nav.jsp

<cms:include file="../elements/nav.jsp">
    <cms:param name="templateName"><%= template%></cms:param>
</cms:include>

Hope this helps.

Thanks

Cheers,
Shishank

http://www.pcmspace.com


-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Nick Panienski
Sent: Wednesday, March 08, 2006 5:38 PM
To: 'The OpenCms mailing list'
Subject: [opencms-dev] Getting the tempalte name in JSP

Hi,

I'd like to know if I can get the template's name in a jsp.

Following scenario:

index.html
 based on: templateXY.jsp
 wich includes navi.jsp

index2.html
 based on: templateZZ.jps
 wich also includes navi.jsp

Now navi jsp has to render slightly different stuff depending on the
template I use.

I tried to c:set the template name in the tamplate.jsps and c:choose in
the navi.jsp, but stuff I c:set in template.jsp is no longer available
in navi.jsp.

I was thinking about writing my own tag which gives me the template
name, <mytag:getTemplateName /> but how am I getting this information?
>From the CmsJspActionElement?

Bye
Nick


_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change
your list options, or to unsubscribe from the list, please visit
http://lists.opencms.org/mailman/listinfo/opencms-dev


The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com



More information about the opencms-dev mailing list