aspose file tools*
The moose likes Tomcat and the fly likes Servlet Exception:Attribute value is quoted with Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Servlet Exception:Attribute value is quoted with " which must be escaped when used within the value " Watch "Servlet Exception:Attribute value is quoted with " which must be escaped when used within the value " New topic
Author

Servlet Exception:Attribute value is quoted with " which must be escaped when used within the value

kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
Hi,
I am trying to Migrate my application from Tomcat 5.0 to Tomcat5.5.28. I have used Struts, JSP and JSTLs in my application.
for Tomcat 5.5.28 i am getting servlet exception when rendering the jsp page.
The Exception is:
[ServletException in:/home/home1l/proposal_list.jsp] /home/home1l/proposal_list.jsp(497,59) Attribute value
MyPermissions.PERMISSION1
is quoted with " which must be escaped when used within the value .

The code in JSP page is:
<permissions:hasAnyNetworkSettings networkSettings="<%=MyPermissions.PERMISSION1%>">


The same code is working fine with Tomcat5.0.

Can somebody please help.
Venkata Kumar
Ranch Hand

Joined: Apr 16, 2008
Posts: 110

Tomcat versions prior to 5.5.27 doesn't follow the quote requirements of Jsp Spec. Tomcat version 5.5.27 onwards quotes are checked strictly. Nested quotes has to be escaped.
what does MyPermissions.PERMISSION1 return?
<permissions:hasAnyNetworkSettings networkSettings="<%=MyPermissions.PERMISSION1%>">

You may use single quotes as shown below


SCJP 5.0, SCWCD 5, preparing for SCDJWS
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
tld file for this Tag is like this:
<tag>
<name>hasAnyNetworkSettings</name>
<tagclass>HasAnyNetworkSettingsTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>networkSettings</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>


this class returns SKIP_BODY or EVAL_BODY_INCLUDE depending on the value passed to the tag.
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
Can you please give me the link to page confirming the fact that Tomcat5.5.27 onwards quotes are checked strictly..
i'll be very helpful.
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
i solved this issue.. ......!!!

-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false


after this setting this problem got resolved.
by default strict quote checking was enabled..disabling that solved this issue
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why not fix the underlying issue rather than allowing Tomcat to break the JSP specification?
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
my application has arround 2500 JSP pages.. so it is almost impossible to correct all the JSPs.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Hope you never deploy on something that doesn't allow broken JSP pages, then.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

kamlendra kumar wrote:my application has arround 2500 JSP pages.. so it is almost impossible to correct all the JSPs.

Wow. Just wow.

So the bigger a web app gets, the less quality matters?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Bear Bibeault wrote:
Wow. Just wow.

So the bigger a web app gets, the less quality matters?


Thats absolutely right. For a mere 150+ pages i felt completely drowned by modifying a simple thing....

I didnt even think about getting into 2500 pages...


Never try to be a hard-worker. Be a smart-worker.
My Blog
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
Due to security vulnerability we are migrating to Tomcat5.5. Quality always matters friend.
But due to this issue not a single jsp page was getting rendered.And checking and correcting 2500 jsp pages gonna take tremendous efforts..
so i guess the way i found works best for my application.
kadavul seelan
Greenhorn

Joined: Dec 20, 2010
Posts: 5
Hello,
i have got same problem with you.
I use TOMCAT 6, ECLIPSE

And i did not know how and where i need add the line "-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false "

Please Help me.
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
Hey!
Set the parameter in catalina.bat .
kadavul seelan
Greenhorn

Joined: Dec 20, 2010
Posts: 5
Hello thanks for answer,
i try this
i add this line in catalina.bat


But it doesn't work

Thanks for help
kamlendra kumar
Greenhorn

Joined: Nov 09, 2009
Posts: 23
check this out http://tomcat.apache.org/tomcat-6.0-doc/config/systemprops.html
kadavul seelan
Greenhorn

Joined: Dec 20, 2010
Posts: 5
Yes i already go this page :s
The line i added is correct???

Sorry for my english i'm from france.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

kadavul seelan wrote:Hello thanks for answer,
i try this
i add this line in catalina.bat


But it doesn't work

Thanks for help


Actually, if you create a file named "setenv.bat" (or setenv.sh) and put the line in there, catalina.bat will pick up the configuration option from there and you won't have to modify the Tomcat startup script. setenv goes in the TOMCAT_HOME/bin directory just like the catalina.bat file.


Customer surveys are for companies who didn't pay proper attention to begin with.
kadavul seelan
Greenhorn

Joined: Dec 20, 2010
Posts: 5
i resolved my problem, eclipse HELIOS create in workspace a folder server, on this folder it saved catalina.properties files
on this file i add "org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false" in this file and my project work.


Thanks
Pene charl
Greenhorn

Joined: Jun 14, 2011
Posts: 21

You just add the below line in a path of tomcat\conf\catalina.properties
org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false to the end of ${catalina.home}\conf\catalina.properties
That should be work.


Regards:Prince Charles
http://www.princecharl.blogspot.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Exception:Attribute value is quoted with " which must be escaped when used within the value