CommandButton的操作URL取决于表单内容

时间:2012-05-08 17:56:37

标签: forms jsf redirect primefaces managed-bean

我正在为我的网络应用做一个简单的搜索引擎,我遇到了问题。

我的search.xhtml通过获取参数来工作,因此search.xhtml?key=lol将返回“lol”的结果。

我需要做的是我的搜索命令按钮会重定向到search.xhtml?key=INPUT TEXT CONTENT

这是我的简单代码:

<div id="searchBox">
        <pou:panel id="searchPanel">                
            <h:form>
                <h:inputText id="searchInput" value="#{dispensaRicercaBean.query}" size="99" maxlength="99"/> <pou:commandButton icon="ui-icon-search" action="ricerca?faces-redirect=true"/>
                <pou:watermark value="Search" for="searchInput"/>
            </h:form>                
        </pou:panel>            
    </div> 

其中dispensaRicercaBean@RequestScoped,我的结果页面加载了调用executeQuery(#{request.getParameter('key'))的数据(粗略的例子,实际上存在一些差异)

我该怎么做?

1 个答案:

答案 0 :(得分:0)

使用纯HTML <form>

<form action="ricera.xhtml">
    <h:inputText id="key" size="99" maxlength="99" />
    <pou:watermark value="Search" for="key" />
    <pou:button icon="ui-icon-search" onclick="submit(); return;" />
</form>                
相关问题