This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

special characters in JSTL

 
Haiko van der Schaaf
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hoi,

I got a problem with displaying the character �. The code of the jsp is:

<cut value="${someproperty}" escapeXml="false"/>

The static content in the JSP displays the � correctly, but in the out-tag the character is misformed. I have set the page encoding and contentType of the page in utf-8 and the string someproperty correctly shows an � with debugging, but somewhere in the translation from the controller to the view the character is misformed. Has anyone an idea what happens ??

Thanks Haiko
 
Haiko van der Schaaf
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem was in the <c:import> tag. When I add the attribute charEncoding with the value utf-8 the problem was solved. I did a recursive import in this jsp file(mijnxtranet/notifylevel.jsp). The complete code is:
What a bit strange is that the directive is overruled by the import attribute.

<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el"%>
<%@ taglib uri="/WEB-INF/struts-logic-el.tld" prefix="logic-el"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>

<html-el:xhtml />

<c:set var="my_node" value="${requestScope.recurse_node}" />


<c:set var="ulclass" value="open" />
<c:if test="${!my_node.uitgeklapt}">
<c:set var="ulclass" value="closed" />
</c:if>

<ul id="<cut value='ul_${my_node.klapTagValue}' />"
class="<cut value='${ulclass}' />">
<c:forEach var="curcat" items="${my_node.children}">
<li id="<cut value='${curcat.klapTagValue}' />">
<%--
klapbaar: <cut value="${curcat.klapbaar}" />
uitgeklapt: <cut value="${curcat.uitgeklapt}" />
--%>
<c:choose>
<c:when test="${curcat.klapbaar}">
<c:choose>
<c:when test="${curcat.uitgeklapt}">
<html-el:img src="/images/global/min.gif"
styleId="img_${curcat.klapTagValue}" border="0" alt="" />   
</c:when>
<ctherwise>
<html-el:img src="/images/global/plus.gif"
styleId="img_${curcat.klapTagValue}" border="0" alt="" />   
</ctherwise>
</c:choose>
</c:when>
<ctherwise>
<html-el:img src="/images/global/minplusspacer.gif" border="0"
alt="" />   
</ctherwise>
</c:choose>
<c:set var="checked" value="" />
<c:if test="${curcat.checked == true}">
<c:set var="checked" value="checked" />
</c:if>

<input type="checkbox" name="cat_<cut value="${curcat.id}"/>"
value="<cut value="${curcat.id}"/>" <cut value="${checked}"/>
<c:if test="${!curcat.allChildrenChecked}"> style="background-color: #ddd"</c:if> />
<cut value="${curcat.naam}" />
<c:if test="${not empty curcat.children}">
<c:set var="recurse_node" value="${curcat}" scope="request" />
<c:import url="../mijnxtranet/notifylevel.jsp" charEncoding="UTF-8"/>
</c:if>
</li>
</c:forEach>
</ul>
<c:set var="recurse_node" value="${my_node}" scope="request" />
[ August 07, 2006: Message edited by: Haiko van der Schaaf ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic