Note that there are some explanatory texts on larger screens.

plurals
  1. POCommandButton action: use value of inputText as parameter in dynamic URL
    primarykey
    data
    text
    <p>I need to make a small form where user types a number into the inputField, and clicks on a button, then is sent to a page, using that number as a parameter to the page.</p> <p>So far I got into this:</p> <pre><code>&lt;p:inputText id="myText" style="width:75px;" /&gt; &lt;p:commandButton id="myButton" value="Ir" action="/site/page.xhtml?id=${param['form:myButton']}" title="Ir" ajax="false" proces="@this,myText" /&gt; </code></pre> <p>tried with <code>${param['form:myButton']}</code> and <code>#{param['form:myButton']}</code>, error is the same.</p> <p>Problem is, JSF thinks its a method expression...</p> <pre><code>GRAVE: Servlet.service() for servlet [Faces Servlet] in context with path [/intranet] threw exception [/myPage action="/site/page.xhtml?id=${param['form:myButton']}".xhtml @95,41 action="/site/page.xhtml?id=${param['form:myButton']}" Not a Valid Method Expression: action="/site/page.xhtml?id=${param['form:myButton']}" with root cause javax.el.ELException: Not a Valid Method Expression: action="/site/page.xhtml?id=${param['form:myButton']}" at org.apache.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBuilder.java:236) at org.apache.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFactoryImpl.java:55) at org.jboss.weld.util.el.ForwardingExpressionFactory.createMethodExpression(ForwardingExpressionFactory.java:43) at org.jboss.weld.el.WeldExpressionFactory.createMethodExpression(WeldExpressionFactory.java:64) at com.sun.faces.facelets.tag.TagAttributeImpl.getMethodExpression(TagAttributeImpl.java:222) at com.sun.faces.facelets.tag.jsf.ActionSourceRule$ActionMapper2.applyMetadata(ActionSourceRule.java:104) at com.sun.faces.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:81) at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:129) at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:102) at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.doNewComponentActions(ComponentTagHandlerDelegateImpl.java:402) </code></pre> <p>and this is the bottom-most exception trace.</p> <p>Question: how can I pass the value typed into of the input-field into the action of the Button when the button is clicked, so the browser navigates to the desired page passing the value in the input as a parameter, without resorting to a backing bean.</p> <p>I don't need to communicate with the server, just forward the page.</p> <p>any solution using jQuery or plain javascript in tandem with JSF is acceptable too.</p> <p>using mojarra, primefaces 3.3.1</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.
 

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