Jay Wright wrote:
>
> I have a form with a set of input tags:
>
> <input type="text" name="input_name">
>
> If I write a tag <jay:value attr="input_name"/> that simply outputs a text
> string, how do I allow that to be the value of the <input> tag?
>
> With embedded java I'd have:
>
> <input type="text" name="input_name" <% if (all_conditions_met) {
> out.println("value=\"some_value\"); } %>>
>
> But with taglibs I can't do an embedded tag, so how do I add an attribute to
> the <input> tag, which itself is a tag?The JSP elements and the HTML elements are interpreted by two different entities; the browser vs. the container. It's therefore perfectly okay to use a JSP element to provide the value for an HTML element attribute: <input type="text" name="input_name" value="<jay:value attr="input_name"/>"> To the JSP container, the HTML is just "template text"; the above is no different than: Some text <jay:value attr="input_name"/> some more text. The response generated by the JSP page is syntactically correct HTML, so the browser is happy as well: <input type="text" name="input_name" value="some value"> What you can *not* do is use a JSP element to assign an attribute value of another JSP element. The container rejects that since it's invalid JSP syntax. Hans -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
