This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes special characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "special characters" Watch "special characters" New topic
Author

special characters

sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Hi,
In my web application I have to remove the special characters user may enter. If the user enters any special character I want to remove it. One way I can imagine is through javascript . But this will require changing all the jsp pages which is going to be a mess. That is why I am planning to write a filter. Can anybody suggest me what is the better approach and if the filter approach is right then how can I remove the special characters in filter. . Your help is highly appreciated.

Thanks.

Regards,
Sawan


Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
Sarath Mohan
Ranch Hand

Joined: Mar 17, 2001
Posts: 213
Filter is a good option. You can pre process request. If user enters space and space or + or & it may be sent as different characters to the server. So how do you catch the value of attribute name=first name. It will be sent as first+name. Now if user enter first na+me how do we interpret first+na+me which is coming to server?

I feel you have to user Url encoding at client and decoding at the filter in each text field user enters if java script is not viable.


Sarath Mohan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: special characters