1

Learning about JSF , I try to understand in which case that we need to pass request parameter

       <h:commandButton id="submitButton" value="Submit" action="#{user.outcome}">
            <f:param name="state" value="boston" />
        </h:commandButton>

The pieces of code will pass request parameter to backing bean, what I don't understand is that why need such a task.

*Is it means that to tell the bean that the button is pressed then do something??

Thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • I don't know either. Ask any of your coworkers about this design. Or are you asking about how JSF supports this? – Luiggi Mendoza Jul 01 '15 at 21:15
  • @LuiggiMendoza, no, I meant what is the use of the request parameter , is it something like to remember that the button had been pressed , something like that?? – Plain_Dude_Sleeping_Alone Jul 01 '15 at 21:17
  • @hansf. you should have a look to how HTTP request-responses work. Then go with JSF. If you start learning a framework without knowing what's going on under the covers, you'll end up in a big mess. – Aritz Jul 01 '15 at 21:19
  • 1
    There's no JSF-specific requirement in this approach. It's fully optional. The developer apparently needed that param in this construct. Most likely it just needs to retain/simulate some view scoped state at some moment. Just ask your colleagues if it appears undocumented and you have no idea why it is there (i.e. you can't figure out why it is there by just looking at e.g. backing bean code logic). In any case, this question can't be reasonably answered without seeing the code in MCVE flavor. I think just asking your colleagues is faster than preparing a MCVE. – BalusC Jul 01 '15 at 21:37

0 Answers0