You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Neil Sherman/Trapsoft Inc <Ne...@trapezegroup.co.uk> on 2006/11/22 18:07:27 UTC

Struts Validator - Generating Illegal HTML

Hi All,
I am currently using the struts validator (Struts 1.2.9) to create some 
client side validation code for one of my JSP pages.  The problem I have 
is that some of the JavaScript it creates includes some JavaDoc comments 
such as:

    /*$RCSfile: validateMaxLength.js,v $ $Rev: 376673 $ $Date: 2006-02-10 
13:42:31 +0000 (Fri, 10 Feb 2006) $ */
    /**
    * A field is considered valid if less than the specified maximum.
    * Fields are not checked if they are disabled.
    * <p>
    * <strong>Caution:</strong> Using <code>validateMaxLength</code> on a 
password field in a 
    *  login page gives unnecessary information away to hackers. While it 
only slightly
    *  weakens security, we suggest using it only when modifying a 
password.</p>
    * @param form The form validation is taking place on.
    */
    function validateMaxLength(form) { 


Therefore when I run my generated HTML through the W3C tidy application it 
complains with :

"<" + "/" + letter not allowed here
Cause:

The 2 characters "</" have been detected in a wrong place.
Solution:

In most case, this is due to wrong javascript:

BAD   <document.write("</h1>");
GOOD  <document.write("<\/h1>");

References:

W3C faq: http://validator.w3.org/docs/help.html#faq-javascript
HtmlHelp: http://www.htmlhelp.com/tools/validator/problems.html#script

So, my questions are, is there someway to supress the comments being 
included ?  or how am I supposed to use the Struts validator to generate 
W3C compliant HTML ?

Many thanks for your time

Neil

Re: Struts Validator - Generating Illegal HTML

Posted by Niall Pemberton <ni...@gmail.com>.
The javascript is part of Commons Validator - not Struts. If you
create an issue ticket against Commons Validator I'll take the the
html markup out of the javascript comments.

http://jakarta.apache.org/commons/validator/issue-tracking.html

Niall

On 11/22/06, Neil Sherman/Trapsoft Inc <Ne...@trapezegroup.co.uk> wrote:
> Hi All,
> I am currently using the struts validator (Struts 1.2.9) to create some
> client side validation code for one of my JSP pages.  The problem I have
> is that some of the JavaScript it creates includes some JavaDoc comments
> such as:
>
>     /*$RCSfile: validateMaxLength.js,v $ $Rev: 376673 $ $Date: 2006-02-10
> 13:42:31 +0000 (Fri, 10 Feb 2006) $ */
>     /**
>     * A field is considered valid if less than the specified maximum.
>     * Fields are not checked if they are disabled.
>     * <p>
>     * <strong>Caution:</strong> Using <code>validateMaxLength</code> on a
> password field in a
>     *  login page gives unnecessary information away to hackers. While it
> only slightly
>     *  weakens security, we suggest using it only when modifying a
> password.</p>
>     * @param form The form validation is taking place on.
>     */
>     function validateMaxLength(form) {
>
>
> Therefore when I run my generated HTML through the W3C tidy application it
> complains with :
>
> "<" + "/" + letter not allowed here
> Cause:
>
> The 2 characters "</" have been detected in a wrong place.
> Solution:
>
> In most case, this is due to wrong javascript:
>
> BAD   <document.write("</h1>");
> GOOD  <document.write("<\/h1>");
>
> References:
>
> W3C faq: http://validator.w3.org/docs/help.html#faq-javascript
> HtmlHelp: http://www.htmlhelp.com/tools/validator/problems.html#script
>
> So, my questions are, is there someway to supress the comments being
> included ?  or how am I supposed to use the Struts validator to generate
> W3C compliant HTML ?
>
> Many thanks for your time
>
> Neil
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org