How to set hidden field value in form?
843842Sep 20 2003 — edited Sep 22 2003I've encountered a problem while developing a forum using JSF. See this code:
<h:form id="commmentForm" formName="commentForm" >
<h:input_hidden id="pageId" valueRef="CommentBean.pageId" value="${article.id}"/>
<h:input_text id="userName" valueRef="CommentBean.userName"/>
<h:input_text id="userEmail" valueRef="CommentBean.userEmail"/>
<h:input_text id="userURL" valueRef="CommentBean.userURL"/>
<h:input_textarea id="content" valueRef="CommentBean.content"/>
<h:command_button id="submit" label="Leave A Comment" commandName="submit" actionRef="CommentBean.createAction" />
</h:form>
I was trying to specify a hidden field that represents the unique ID number of the current article using <h:input_hidden> tag above. But RI complains that runtime expression is not permitted in 'value' attribute. So I set the attribute 'value' to arbitrary number such as '2', but it seems that CommentBean.pageId is still null.
So the question is:
1. Why can't I use EL in JSF tags attributes?
2. How can I resolve my problem mentioned above?
Thanks very much in advance!