I am taking on the project of converting (with backwards compatibility) all
the struts-html tags to be XHTML-compliant.

I'd like to use this e-mail to tell you my approach, ask you for advice, and
get your feedback.

1.  Approach:

        In HtmlTag.java, add
                if (xhtml)
                        pageContext.setAttribute("xhtml", "true");

        In all other html-producing tags (i.e. img, input), do a check when closing
the tag:

                        // check if this is an XHTML document
                        String xhtml = (String) pageContext.getAttribute("xhtml");

                        if (xhtml != null && xhtml.equals("true")) {
                            results.append("\" />"); // extra space before close
will allow XHTML to work in older browsers
                        } else {
                            results.append("\">");
                        }

2.  Advice:

Should I be setting the "xhtml" variable in the pageContext, request, or
session.  Page seems to make the most sense since that is what this variable
relates to.  However, to do this (to my understanding), I have to create
HtmlTei.java and add the <teiclass> declaration to the struts-html.tld:

        public class HtmlTei extends TagExtraInfo {

            /**
             * Return information about the scripting variables to be created.
             */
                    public VariableInfo[] getVariableInfo(TagData data) {

                        return new VariableInfo[] {
                          new VariableInfo(data.getAttributeString("xhtml"),
                                           "java.lang.String",
                                           true,
                                           VariableInfo.NESTED)
                        };

                    }

        }

However, this does not work as I'd expect it to.  What I'm expecting is that
I am exposing the "xhtml" variable simply by adding the HtmlTei class - but
it's not working at all.

3.  Feedback:

Please let me know what you think of this approach.  By doing this, and
adding a check if the user wants the doc to be XHTML, we should achieve full
backwards compatibility, and be able to convert the struts-html tags to be
XHTML-compliant.

Thanks,

Matt





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to