• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dequoting jstl/el results

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

bypass the quoting mechanism.



There is an escapeXml attribute to the <c:out> 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.
 
Barry Gold
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic