my dog learned polymorphism*
The moose likes JSP and the fly likes special characters in  JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "special characters in  JSTL" Watch "special characters in  JSTL" New topic
Author

special characters in JSTL

Haiko van der Schaaf
Greenhorn

Joined: Jan 19, 2005
Posts: 8
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

Joined: Jan 19, 2005
Posts: 8
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 ]
 
Consider Paul's rocket mass heater.
 
subject: special characters in JSTL
 
Similar Threads
jsp:setProperty is ignored !
Special characters not appearing on JSP page
How to test for a character in a JSTL "test"
Help Needed -- how do I store and retrieve a session variable?
Special Characters in JSP Page