Skip to main content

inputHidden with readonly behavior explanation

No replies
someusername54
Offline
Joined: 2013-07-13
Points: 0

When I use the attribute readonly with inputHidden and I do not specify a setter for my bean property the form submission works. But from what I'm reading inputHidden does not support HTML standard tags so why does this work ? Does it even work ? This behavior is observed in JSF 2.2

Sample code

import javax.faces.bean.*; 
@ManagedBean
@SessionScoped
public class Bean {
    private int x;

    public int getX() {
        return x;
    }
}

And the xhtml
<h:head>
</h:head>
<h:body>
    <h:form>
        <h:inputHidden value="#{bean.x}" readonly="true"/>
        <h:commandButton value="Yo" />
    </h:form>
</h:body>

Thank you.