| Author |
dequoting jstl/el results
|
Barry Gold
Greenhorn
Joined: Dec 15, 2005
Posts: 22
|
|
I have text stored in my database using HTML character entities, e.g., ™ for the trademark symbol, á for a with an accent. When I hand this to the jstl <c ut> tag, it gets requoted, so the webpage shows the entity instead of the desired character. That is, the user sees "á" instead of the accented "a". I want a way to de-quote the data, or bypass the quoting mechanism. I can think of several ways this might be done, but none of the things I've tried so far have worked. I went to the Jasper output and copied the code that extracts values, e.g., String s = (String) proprietaryEvaluate("${param.navmodel}", java.lang.String.class, (PageContext)_jspx_page_context, null, false); [I have already done a <%@ page import = "org.apache.jasper.runtime.*"%>] Then I looked through the Jsp class documentation in the J2EE API, and coded <%@ page import = "javax.servlet.jsp.el.*"%> ... ExpressionEvaluator exval = null; exval = pageContext.getExpressionEvaluator(); Object o; o = exval.evaluate( "${feature.shortName.english}", o.getClass(), pageContext, null, false); And that failed as well. My problem is made more frustrating because the webapp is set up with "errorPage" param declarations, so I never get to see the compilation errors, it just goes to the error page. I tried commenting out the errorPage params, but I still don't get the compile errors. Any suggestions on this problem? If I could solve any piece of it, I would probably be OK: 1. Getting jstl to not quote my already quoted entities, 2. Extracting the jstl/el forms into java so I can manipulate them directly and de-quote them as needed. 3. At least getting the compile errors so I can see what I'm doing wrong. P.S. I also looked in "catalina.out" for the error messages, but there are none there. There are limits on what I can do because I don't have "root" privilege on the server where my webapp is running.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
bypass the quoting mechanism.
There is an escapeXml attribute to the <c ut> tag that controls whether the value is HTML-encoded prior to emitting it to the page. The default is true. I highly recommend having a copy of the JSTL Specification open on your desk if you are using the JSTL in your pages.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Barry Gold
Greenhorn
Joined: Dec 15, 2005
Posts: 22
|
|
Yes, thank you. That solved the immediate problem. I feel particularly stupid because I did have a summary of the relevant JSTL tags open in another window, and it shows the escapeXML option, I just didn't look far enough. I'll start a new thread for my next problem, which is protecting the page from missing attributes - what happens if the desired attribute is empty.
|
 |
Barry Gold
Greenhorn
Joined: Dec 15, 2005
Posts: 22
|
|
Oh, I forgot to ask, if I _do_ want to put some actual java code into this JSP, is there any place I can look to see the compilation error messages? I don't get them on the webpage because there's an errorPage parameter, and I couldn't find them in catalina.out. Anywhere else to look for compilation errors?
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Originally posted by Barry Gold: Oh, I forgot to ask, if I _do_ want to put some actual java code into this JSP, is there any place I can look to see the compilation error messages? I don't get them on the webpage because there's an errorPage parameter, and I couldn't find them in catalina.out. Anywhere else to look for compilation errors?
- You can see the log file under TOMCAT_HOME/logs - You can see the console, if you are running the console - You can remove the errorPage parameter in development mode
|
 |
 |
|
|
subject: dequoting jstl/el results
|
|
|