HttpServletRequest - Quick way to encode url and hidden field paramaters
问题 In my java app I'm preventing XSS attacks. I want to encode URL and hidden field paramaters in the HttpServletRequest objects I have a handle on. How would I go about doing this? 回答1: Don't do that. You're making it unnecessarily more complicated. Just escape it during display only. See my answer in your other topic: Java 5 HTML escaping To Prevent XSS 回答2: To properly display user-entered data on an HTML page, you simply need to ensure that any special HTML characters are properly encoded as