dev@javaserverfaces.java.net

Re: ButtonRenderer encodeBegin

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Wed, 19 Sep 2007 10:54:47 -0700

Gurkan Erdogdu wrote:
> Hi,
> When I want to add <h:commandButton type='button'>, renderer renders
> it as submit button. Because of the following code in ButtonRenderer
> encodeBegin method
>
> // Which button type (SUBMIT, RESET, or BUTTON) should we generate?
> String type = (String) component.getAttributes().get("type");
> String styleClass;
> if (type == null || (!"reset".equals(type) &&
> !"submit".equals(type))) {
> type = "submit";
> // This is needed in the decode method
> component.getAttributes().put("type", type);
> }
>
> Because type not reset and not submit always put submit type.
>
> Is it intentionally written like this?
Yes. The renderkit docs [1] clearly state the valid values for the type
attribute.

[1]
http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/renderkitdocs/HTML_BASIC/javax.faces.Commandjavax.faces.Button.html
>
> Thanks
> Gurkan
>
>
>
>
>
> ------------------------------------------------------------------------
> Shape Yahoo! in your own image. Join our Network Research Panel today!
> <http://us.rd.yahoo.com/evt=48517/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7>