This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 Murach's Java Servlets and JSP this week in the Servlets 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: special characters
 
Similar Threads
non-printable special characters
Displaying special characters or HTML using Struts
how toremove files or directory in unix with name of special characters
special characters
How do I secure my response header from CRLF