Jahia in English > How to access the...

1 (1 Good)
0 (0 Bad)

How to access the username of a subcribed user to a Newsletter within the newsletter JSP

by  kamran »  2015/03/10 16:24

Hello everybody,

We are trying to use the Newsletter JahiaApp to send a daily e-newsletter to all our Jahia users.

In the JSP that we have created within our template project we need to access the name, lastname and username of the user to whom we are sending the newsletter.

Unfortunalty, when we are using the "renderContext.user" within the jsp, then the same user is used for all the newsletter we are sending (and not the user corresponding to the subscriber).

How can we access the subscriber information within a JSP ?

We are using Jahia 6.6.2.8 and Jahia Newsletter 1.5

Many thanks for your help !

Marc

Here is an extract of the JSP :

<%@ page language="java" contentType="text/html;charset=UTF-8"%>

<%@ taglib prefix="template" uri="http://www.jahia.org/tags/templateLib"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<%@ taglib prefix="jcr" uri="http://www.jahia.org/tags/jcr"%>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%@ taglib uri="http://www.jahia.org/tags/utilityLib" prefix="utility"%>

<%@ taglib prefix="user" uri="http://www.jahia.org/tags/user" %>

<%--@elvariable id="currentPage" type="org.jahia.data.beans.PageBean"  --%>

<%--@elvariable id="currentNode" type="org.jahia.services.content.JCRNodeWrapper"--%>

<%--@elvariable id="out" type="java.io.PrintWriter"--%>

<%--@elvariable id="script" type="org.jahia.services.render.scripting.Script"--%>

<%--@elvariable id="scriptInfo" type="java.lang.String"--%>

<%--@elvariable id="workspace" type="java.lang.String"--%>

<%--@elvariable id="renderContext" type="org.jahia.services.render.RenderContext"--%>

<%--@elvariable id="currentResource" type="org.jahia.services.render.Resource"--%>

<%--@elvariable id="url" type="org.jahia.services.render.URLGenerator"--%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>

<body>

[...]

               <span class="username">Hello ${renderContext.user.properties['j:firstName']}</span>

[...]

</body>

</html>

  (kamran)

Number of messages  31
Registration date
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page