aspose file tools
The moose likes JSP and the fly likes Avoid Cross site scripting in Jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Avoid Cross site scripting in Jsp" Watch "Avoid Cross site scripting in Jsp" New topic
Author

Avoid Cross site scripting in Jsp

jami siva
Ranch Hand

Joined: Oct 16, 2009
Posts: 55
How to avoid Cross site scripting in Jsp.
Currently I am using scriptlet code to display any error messages.
Below is the code :
<%
out.println (error.getMessage() );
%>

How do make this statement to avoid Cross Site Scripting.

Thank you guys
Siva
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35232
    
    7
In which way do you think this code is vulnerable to XSS attacks? Is the string returned by getMessage generated from user input?


Android appsImageJ pluginsJava web charts
jami siva
Ranch Hand

Joined: Oct 16, 2009
Posts: 55
No, this getMessage is generated from server.
Even i don't know that is the only code to attack Cross site scripting, If so, How to write code in jsp to avoid things means Cross site scripting.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35232
    
    7
Start reading here: http://www.coderanch.com/how-to/java/SecurityFaq#web-apps
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

If you use cut instead of a scriptlet, it will escape the special characters for you.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Avoid Cross site scripting in Jsp
 
Similar Threads
Cross-site scripting attacks
How to prevent cross site cripting parameter manipulation attacks in jsp?
Doubt in EL part of JSP 2.0 specification
cross site script
how to avoid cross-site scripting