aspose file tools*
The moose likes JSP and the fly likes JSTL - c:out escapeXml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL - c:out escapeXml" Watch "JSTL - c:out escapeXml" New topic
Author

JSTL - c:out escapeXml

Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
How can I get a string to print without html characters?

Here's my code:



it displays a "<b>Video upload complete</b><br>" on the screen.

could you tell me the reason.
i am using tomcat;
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Not for me. You're setup is likely incorrect.

What does viewing the HTML reveal?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Originally posted by Nina Anderson:
i am using tomcat;

Tomcat 4, I take it?
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
I don't have my laptop with me to look up the tomcat level, but I installed the tomcat back in Dec. 2007, so I'm guessing it's probably Tomcat 6.

Do it make a difference?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

The JSTL URI you are using is for JSTL 1.0. You should be using JSTL 1.1.

See the JSP FAQ for correct setup. Pay special attention to declaring the web.xml and the JSTL URIs.

This may not be your problem, but until your configuration is compatible, it makes no sense to diagnose further.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Nina Anderson:
...
Do it make a difference?


Yes.
JSTL and EL are much newer than servlets, JSPs, and thus containers like Tomcat. In addition there are a couple versions of JSTL and they need to be matched up with containers that support the versions of the servlet and JSP specs that coincide with them.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
I've verified that I'm using Tomcat 6.

So, I did the following:

1) changed my web.xml to version 2.5:




2) Replaced jstl-1.0.jar and standard.jar with jstl-2.0.jar


3) Used the new jstl source in my jsp


After making all these changes, nothing gets printed to the screen anymore.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Nina Anderson:
...
After making all these changes, nothing gets printed to the screen anymore.


The first thing I do when faced with a blank screen is use the browser's "view source" feature to see if the problem is on the server side or if it's a problem with the resulting HTML source.
Nina Anderson
Ranch Hand

Joined: Jul 18, 2006
Posts: 148
When I do view source, I see:



It does NOT look like the browser recognizes the jstl tags. This is too bizarre!!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Originally posted by Nina Anderson:
It does NOT look like the browser recognizes the jstl tags. This is too bizarre!!!
Browsers know nothing about JSTL or other JSP tags. They are interpreted on the server. All that is ever sent to the browser is plain old HTML.

This means that your setup is somehow incorrect and the JSTL tags are not being processing on the server as they should be. Check all your setup steps again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL - c:out escapeXml