0

I have a p:inputTextcomponent and a h:linkthat navigate to a different view:

<p:inputText id="searchValue" value="#{bean.searchValue}">
   <p:ajax event="keyup" update="search" />
</p:inputText>

<h:link id="search" value="search" outcome="resSearch">
   <f:param name="searchValue" value="#{bean.searchValue}" />
</h:link>

The resSearchpage use the searchValueparameter and executes a search based on it, after which it presents the result:

<f:metadata>
   <f:viewParam name="searchValue" value="#{searchBean.searchValue}" />
   <f:event type="preRenderView" listener="#{searchBean.init}" />
</f:metadata>

I'd rather not use ajax to get the value of the inputText component. Is it possible to get the value from the inputText directly (without using bean properties) and set it as the value of the param?

nivis
  • 913
  • 3
  • 17
  • 34

1 Answers1

3

Just use a plain HTML GET form.

<form action="resSearch.xhtml">
    <input name="searchValue" class="ui-widget ui-inputfield ui-inputtext ui-state-default ui-corner-all" />
    <input type="submit" value="search" />
</form>

Use if necessary CSS to make the button to look like a link, or use JS to submit the form by <a>.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thanks. Not what I'd hoped for, though it is a solution. I'll go for having the result shown on the same page instead and hide the previous content. As the pages are in viewScope, that way I can use the same bean. – nivis May 10 '13 at 08:36