Alfred’s Computing Weblog

Alfred Java-cored Computing Weblog

Posts Tagged ‘jstl

Plain text shows Encoded Chars

leave a comment »

Just started to have a chance to try out Spring 3.0, a lot of new features introduced, yet not enough time to read up all features.

I started a simple web apps project to try out Spring 3.0. The web apps is pretty simple, a REST server alike. Client init HTTP calls to the web apps with specific Servlet name and parameter, the web apps will returns the result JSON with Plain text mode. Since I am using Spring MVC, the result is printed with JSTL.

Sample call from client:

Expected result from server:

I get what I expected when I test my web apps with browser.

But the ‘interesting’ comes when I test it with little Java Post program (use HttpClient, init HTTP call and inspect the result).
I did not get the expected result, I get below:

All double-quat / quotation being replaced with ", its clearly the contain is being HTML encoded.

Below are my trouble-shooting steps:
Step 1. Check tomcat configuration
– Ensure the tomcat UTF-8 by default. More info
Step 2. Check web apps JSPs
– Ensure all JSP are UTF-8 as default encoding.

But both Step 1 & 2 does not fix my problem yet.
Step 3. Google “jstl without html encoded”
– Finally, I get the answer 🙂
– add in escapeXML properties when printing the result in JSTL
Before: <c:out value="${result}" />
After: <c:out value="${result}" escapeXml=”false”/>
Tutorial – Output with / without Encode

Lesson Learn:
When you want to print a PLAIN TEXT with JSTL, do remember to include escapeXML="false" to ensure that end user will get the actual expected result without HTML/XML encoded.


Written by Alfred

June 28, 2011 at 15:54

Posted in HTML, Java, Spring

Tagged with ,

The absolute uri: cannot be resolved

with 3 comments

Hit this error while deploying webapps in Tomcat. “The absolute uri: cannot be resolved …”

I’m trying to include JSTL in JSP pages. I get the above error while starting up the webapp in Tomcat.

The jstl.jar is missing from the web deployment package (.war) file. Add in jstl.jar in /WEB-INF/lib/ is the most directive way to solve this problem. If maven is used in the project, we can include the xml code below and let maven do the JAR file searching and packing for us.


Thanks for godbiest’s update 🙂

Written by Alfred

December 22, 2008 at 17:04

Posted in Java, maven

Tagged with ,