开发者

where are f:attribute name/value pairs stored?

I'm using the following (example)

<h:commandButton value="Submit" action="#{indexBean.submit}" 
        actionListener="#{indexBean.btnListener}" >
    <f:attribute name="valueOne" value="v1" />
    <f:attribute name="valueTwo" value="v2" />
    <f:attribute name="valueThree" value="v3" />
</h:commandButton>

When the page is rendered i'm looking at the source code through the browser, but i cant find the values in some sort of hidden fields or anything else.

Are they 开发者_JS百科stored at the back end on server side, in the view state or some where else?

Best Wishes,


They are stored as attribtues of the component in question. They do not end up in the generated HTML output because the component's renderer does not recognize them as standard HTML attributes.

The component is in turn stored in the component tree in the server side memory and if it concerns an UIForm, UIInput or UICommand component, then it's also stored in the view state.

If you want to pass visible parameters, you should rather be using <f:param>. They will then be visible in the generated JavaScript onclick function of the component's HTML representation. Note that <f:param> in <h:commandButton> is only supported since JSF 2.0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜