0

I am trying to use the value of a text area as a parameter to a button action. I figured out the way to pass parameters to the backing bean but I cannot figure out how to use a value of another field as a parameter. The code I have so far is the following:

<h:form>
    <p:inputTextarea id="idHere" label="label"/>

    <p:commandButton value="Register" action="#{contl.register}">
        <f:param name="key" value="????" />
    </p:commandButton>
</h:form>

So I am able to get the "????" at the backing bean but I am wondering how to use the value of the inputTextarea instead. can I somehow use the ID of the field as a reference?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Rakim
  • 1,087
  • 9
  • 21
  • 40
  • 2
    Which of those duplicates does answer your actual needs? http://stackoverflow.com/q/3681123 or http://stackoverflow.com/q/11941943? Do note that there's quite a difference in the approach and that the first link shows the "natural" approach (as documented in sane references/books/tutorials) and the second link shows the "unnatural" approach (as implied by your question). – BalusC Apr 17 '16 at 12:20
  • I have already tried the first one without luck but I will give both another go – Rakim Apr 17 '16 at 12:25
  • If the first one didn't work, you'd need to take a step back and provide the problem in MCVE flavor as instructed in http://stackoverflow.com/tags/jsf/info. My educated guess would be that you used the wrong bean management annotations and/or that webapp's runtime classpath is messed up with duplicate different versioned libraries conflicting each other. – BalusC Apr 17 '16 at 12:26
  • No worries. It worked this time. Maybe I was not quite doing what I should have. Thanks for the links anyway – Rakim Apr 17 '16 at 12:30

0 Answers0