2

So, I have this jsf code

<h:inputText id="serviceId"/>
<h:commandButton value="Enter" action="agreementDetail.xhtml"/>

I need to send the customer's input in the serviceId field as a f:param to the next page (agreementDetail.xhtml). So, the customer inputs the value, clicks on the "Enter" button, and the next page receives the inputted value as a parameter.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Nacho321
  • 1,911
  • 7
  • 33
  • 55
  • All parameters should be parsed by framework and populated the bean upon request. – Roman C Aug 19 '13 at 16:08
  • I'm not using beans to pass these parameters. If possible, I'd like to know if I can use the f:param to pass the input value between pages. – Nacho321 Aug 19 '13 at 16:08

1 Answers1

3

Just use a regular GET form with a regular HTML button instead. JSF as being a POST form oriented framework offers no advantages for you here, so there's not really a point of using a JSF component here.

<form action="agreementDetail.xhtml">
    <input name="serviceId" />
    <input type="submit" value="Enter" />
</form>

For the case you didn't already know that, you can in the target view agreementDetail.xhtml use <f:viewParam> to process the GET request parameter and set it as a bean property like as if it's a <h:inputText>. See also What can <f:metadata>, <f:viewParam> and <f:viewAction> be used for?

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555