Another way would be :
<option value="H" <%= (status.equals("C")? "selected" : "")%> >HOLD
Hans Bergsten <[EMAIL PROTECTED]>@GEFIONSOFTWARE.COM> on 10/28/99
02:26:31 PM
To: [EMAIL PROTECTED]
cc:
Subject: Re: jsp imbedded in string
Tami Tutton wrote:
>
> How do I imbed jsp code into a string? This the code I am trying to
> implement:
>
> statusoptions = "<option value=\"H\" <% if (status.equals(\"C\"))
> {out.println(\"SELECTED\"); } %>>HOLD ";
The nice thing with JSP is that you don't have to mess with out.println(),
escaped quotes, etc. to generate the HTML output like you do in servlets;
you just put the HTML in the page as template text.
Assuming you want to send an <option> tag to the client, with
the selected attribute set only if a condition is true, I would
suggest something like this instead:
<option value="H" <% if (status.equals("C") { %> selected <% } %> >HOLD
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html