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 Struts and the fly likes Disabling html tags in text input fields in Validator 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 » Frameworks » Struts
Bookmark "Disabling html tags in text input fields in Validator" Watch "Disabling html tags in text input fields in Validator" New topic
Author

Disabling html tags in text input fields in Validator

Mallika R Kumar
Ranch Hand

Joined: Jan 21, 2004
Posts: 38
Hi,
Is there a rule in Validator framework that disallows users from entering html tags ? Or do we have to use mask and regular expressions to prevent users from entring valid html tags ? I was wondering what the easiest method is - to implement filtering of html code in text fields.

Thanks in advance for your response.

Mallika.
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
best way is to use mask. if you restrict data entry to only alphanumeric, use the alphanumeric regex mask. otherwise, you need a regex that will accept everthing except the '<'.


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Disabling html tags in text input fields in Validator
 
Similar Threads
Advantage of struts-html tag library ?
text/html & text/plain
text/plain & text/html
Substitute HTML tags?
select lists disappear - DynaValidatorForm