You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/07/04 20:50:25 UTC

DO NOT REPLY [Bug 21347] New: - Failure to use non-standard HTML properties with Struts custom tags

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21347>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21347

Failure to use non-standard HTML properties with Struts custom tags

           Summary: Failure to use non-standard HTML properties with Struts
                    custom tags
           Product: Struts
           Version: 1.1 Final
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: gregdorfman@yahoo.ca


Some web-applications are using non-standard HTML properties with form input 
elements, which is quite common (and convenient) practice. For example:

<input type="text" name="firstName" value="Bob" required="true">

Here 'required' is non-standard attribute, never the less 'required' 
automatically becomes part of the DOM definition and can be examined (accessed) 
by JavaScript, for example for validation purposes.

Changing above example to use of Struts tags would cause JSP compilation error:

<html:text property="firstName" required="true"/> 

which makes it totally impossible to use not-standard HTML attributes.  

I suggest the following way to fix it:  

<html:text property="firstName">required="true"</html:text> 

In other words anything that is non-standard should be written into the tag 
body. Unfortunately, due the way Struts html field tags are implemented this 
suggestion would not work right now, because the tag body is getting ignored 
entirely.

In order to fix it following class should be modified: 

org.apache.struts.taglib.html.BaseFieldTag 

1) Writing of the HTML tag closing symbol should be moved from doStartTag() 
method to doEndTag()
2) In the doEndTag() method Body Content String should be written into page 
output (just before writing tag closing sysmbol)

To fix this problem is crucial for our application, because we used to use not-
standard HTML attributes quite widely (not only  'required', but also many 
others) and now we are having problem converting it to Struts.

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