Note that there are some explanatory texts on larger screens.

plurals
  1. POGlassfish complaining about JSF component IDs
    primarykey
    data
    text
    <p>I am very new to JSF (v2.0) and I am attempting to learn it at places like netbeans.org and coreservlets.com. I am working on a very simple "add/subtract/multiply/divide" Java webapp and I have run into a problem. When I first started out, the application was enter two numbers and hit a '+' key and they would be automatically added together. Now that I have added more complexity I am having trouble getting the operation to the managed bean. This is what I had when it was just "add":</p> <pre><code>&lt;h:inputText styleClass="display" id="number01" size="4" maxlength="3" value="#{Calculator.number01}" /&gt; &lt;h:inputText styleClass="display" id="number02" size="4" maxlength="3" value="#{Calculator.number02}" /&gt; &lt;h:commandButton id="add" action="answer" value="+" /&gt; </code></pre> <p>For the "answer" page, I display the answer like this: </p> <pre><code>&lt;h:outputText value="#{Calculator.answer}" /&gt; </code></pre> <p>I had the proper getters and setters in the Calculator.java managed bean and the operation worked perfectly. </p> <p>Now I have added the other three operations and I am having trouble visualizing how to get the operation parameter to the bean so that I can switch around it. I tried this: </p> <pre><code>&lt;h:commandButton id="operation" action="answer" value="+" /&gt; &lt;h:commandButton id="operation" action="answer" value="-" /&gt; &lt;h:commandButton id="operation" action="answer" value="*" /&gt; &lt;h:commandButton id="operation" action="answer" value="/" /&gt; </code></pre> <p>However, Glassfish complained that I have already used "operation" once and I am trying to use it four times here. </p> <p>Any adivce/tips on how to get multiple operations to the managed bean so that it can preform the desired operation? </p> <p>Thank you for taking the time to read. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload