/** * Render the button attributes * @param results The StringBuffer that output will be appended to. */ protected void prepareButtonAttributes(StringBuffer results) throws JspException { prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "tabindex", getTabindex()); prepareValue(results); }
/** * Create an appropriate select start element based on our parameters. * @throws JspException * @since Struts 1.1 */ protected String renderSelectStartElement() throws JspException { StringBuffer results = new StringBuffer("<select"); prepareAttribute(results, "name", prepareName()); prepareAttribute(results, "accesskey", getAccesskey()); if (multiple != null) { results.append(" multiple=\"multiple\""); } prepareAttribute(results, "size", getSize()); prepareAttribute(results, "tabindex", getTabindex()); results.append(prepareEventHandlers()); results.append(prepareStyles()); prepareOtherAttributes(results); results.append(">"); return results.toString(); }
/** * Generate an HTML <textarea> tag. * @throws JspException * @since Struts 1.1 */ protected String renderTextareaElement() throws JspException { StringBuffer results = new StringBuffer("<textarea"); prepareAttribute(results, "name", prepareName()); prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "tabindex", getTabindex()); prepareAttribute(results, "cols", getCols()); prepareAttribute(results, "rows", getRows()); results.append(prepareEventHandlers()); results.append(prepareStyles()); prepareOtherAttributes(results); results.append(">"); results.append(this.renderData()); results.append("</textarea>"); return results.toString(); }
/** * Renders an HTML <input type="radio"> element. * @param serverValue The data to be used in the tag's <code>value</code> * attribute and sent to the server when the form is submitted. * @param checkedValue If the serverValue equals this value the radio button * will be checked. * @return A radio input element. * @throws JspException * @since Struts 1.1 */ protected String renderRadioElement(String serverValue, String checkedValue) throws JspException { StringBuffer results = new StringBuffer("<input type=\"radio\""); prepareAttribute(results, "name", prepareName()); prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "tabindex", getTabindex()); prepareAttribute(results, "value", TagUtils.getInstance().filter(serverValue)); if (serverValue.equals(checkedValue)) { results.append(" checked=\"checked\""); } results.append(prepareEventHandlers()); results.append(prepareStyles()); prepareOtherAttributes(results); results.append(getElementClose()); return results.toString(); }
/** * Render an input element for this tag. * * @exception JspException if a JSP exception has occurred */ public int doEndTag() throws JspException { // Create an appropriate "input" element based on our parameters StringBuffer results = new StringBuffer("<input type=\"checkbox\""); prepareAttribute(results, "name", prepareName()); prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "tabindex", getTabindex()); String value = prepareValue(results); prepareChecked(results, value); results.append(prepareEventHandlers()); results.append(prepareStyles()); prepareOtherAttributes(results); results.append(getElementClose()); TagUtils.getInstance().write(pageContext, results.toString()); return EVAL_PAGE; }
/** * Generate the required input tag. * <p> * Support for indexed property since Struts 1.1 * * @exception JspException if a JSP exception has occurred */ public int doStartTag() throws JspException { // Create an appropriate "input" element based on our parameters StringBuffer results = new StringBuffer("<input type=\"checkbox\""); prepareAttribute(results, "name", prepareName()); prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "tabindex", getTabindex()); prepareAttribute(results, "value", getValue()); if (isChecked()) { results.append(" checked=\"checked\""); } results.append(prepareEventHandlers()); results.append(prepareStyles()); prepareOtherAttributes(results); results.append(getElementClose()); // Print this field to our output writer TagUtils.getInstance().write(pageContext, results.toString()); // Continue processing this page this.text = null; return (EVAL_BODY_TAG); }
/** * Renders a fully formed <input> element. * @throws JspException * @since Struts 1.2 */ protected String renderInputElement() throws JspException { StringBuffer results = new StringBuffer("<input"); prepareAttribute(results, "type", this.type); prepareAttribute(results, "name", prepareName()); prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "accept", getAccept()); prepareAttribute(results, "maxlength", getMaxlength()); prepareAttribute(results, "size", getCols()); prepareAttribute(results, "tabindex", getTabindex()); prepareValue(results); results.append(this.prepareEventHandlers()); results.append(this.prepareStyles()); prepareOtherAttributes(results); results.append(this.getElementClose()); return results.toString(); }
/** * Render the beginning of the hyperlink. * <p> * Support for indexed property since Struts 1.1 * * @exception JspException if a JSP exception has occurred */ public int doStartTag() throws JspException { // Generate the opening anchor element StringBuffer results = new StringBuffer("<a"); // Special case for name anchors prepareAttribute(results, "name", getLinkName()); // * @since Struts 1.1 if (getLinkName() == null || getForward() != null || getHref() != null || getPage() != null || getAction() != null) { prepareAttribute(results, "href", calculateURL()); } prepareAttribute(results, "target", getTarget()); prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "tabindex", getTabindex()); results.append(prepareStyles()); results.append(prepareEventHandlers()); prepareOtherAttributes(results); results.append(">"); TagUtils.getInstance().write(pageContext, results.toString()); // Evaluate the body of this tag this.text = null; return (EVAL_BODY_TAG); }
/** * Render the button attributes * @param results The StringBuffer that output will be appended to. */ protected void prepareButtonAttributes(StringBuffer results) throws JspException { String tmp = src(); if (tmp != null) { HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); prepareAttribute(results, "src", response.encodeURL(tmp)); } prepareAttribute(results, "align", getAlign()); prepareAttribute(results, "border", getBorder()); prepareAttribute(results, "value", getValue()); prepareAttribute(results, "accesskey", getAccesskey()); prepareAttribute(results, "tabindex", getTabindex()); }