• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

special characters in JSTL

 
Greenhorn
Posts: 8
  • 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:

<c:out 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
  • 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="<c:out value='ul_${my_node.klapTagValue}' />"
class="<c:out value='${ulclass}' />">
<c:forEach var="curcat" items="${my_node.children}">
<li id="<c:out value='${curcat.klapTagValue}' />">
<%--
klapbaar: <c:out value="${curcat.klapbaar}" />
uitgeklapt: <c:out 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>
<c:otherwise>
<html-el:img src="/images/global/plus.gif"
styleId="img_${curcat.klapTagValue}" border="0" alt="" />   
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<html-el:img src="/images/global/minplusspacer.gif" border="0"
alt="" />   
</c:otherwise>
</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_<c:out value="${curcat.id}"/>"
value="<c:out value="${curcat.id}"/>" <c:out value="${checked}"/>
<c:if test="${!curcat.allChildrenChecked}"> style="background-color: #ddd"</c:if> />
<c:out 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 ]
 
And inside of my fortune cookie was this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic