Can a custom tag be utilized to clean up this form input element?
<input name="action_for" type="text" value="<c:if test="${empty commitmentItem.action_for}">
<c:out value="${param.action_for}" escapeXml='false' /></c:if>
<c:if test="${not empty commitmentItem.action_for}">
<c:out value="${commitmentItem.action_for}" /></c:if>"
size="16" maxlength="16" />
I'd like to just type:
<myTag:input field="action_for" obj="commitmentItem" />
or something similar.
I just don't know how to access the request and also the bean data from within the tag handler class for the value attribute
I could figure out how to do a simple tag for generating a link to the javascript POP-Up widget.
<myTag:calPOP field="ecd_date" />
which generates this link:
<A HREF="javascript:cal1xx.select(document.forms[0].ecd_date,'ecd_date_anchor','MM/dd/yyyy');"
TITLE="Click to Select a Date" NAME="ecd_date_anchor" ID="ecd_date_anchor"> CALENDAR</A>
... here is a bit of the tag handler for that...
public int doStartTag() throws JspException {
try {
JspWriter out = pc.getOut();
out.println(" <a href=\"javascript:cal1xx.select(document.forms[0]."
+ field
+ ",'"
+ field
+ "_anchor','MM/dd/yyyy');\" TITLE=\"Click to Select a Date\" NAME=\""
+ field
+ "_anchor\" ID=\""
+ field
+ "_anchor\">CALENDAR</a>");
}
catch (IOException e) {
throw new JspTagException("An IOException occurred.");
}
return EVAL_BODY_AGAIN;
}
I am not using STRUTS and can not utilize EL