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