4
我想將用戶輸入作爲參數傳遞給另一頁。這裏是我的代碼:將輸入文本值作爲參數傳入
<h:form>
<h:inputText value="#{indexBean.word}"/>
<h:commandLink value="Ara" action="word.xhtml">
<f:param value="#{indexBean.word}" name="word"/>
</h:commandLink>
</h:form>
嗯,這是行不通的。我可以讀取我的支持bean中的輸入文本值,但我無法將其發送到word.xhtml。
這裏是另一種方法我試過:
<h:form>
<h:inputText binding="#{indexBean.textInput}"/>
<h:commandLink value="Ara" action="word.xhtml">
<f:param value="#{indexBean.textInput.value}" name="word"/>
</h:commandLink>
</h:form>
這也不能正常工作。
那麼,我做錯了什麼?
是啊,這對我的作品!我也嘗試使用flashScope,它也在工作。謝謝你的幫助! – ozubaba