FAQ
Within a h:dataTable's h:column I have a h:commandLink that I want to show a
specific URL parameter. Within the commandLink I therefore add an f:param,
but it doesn't seem to do anything in the generated URL.

Even if I have a static value like below, nothing happens (shouldn't every
generated URL have an ?paramName=1 appended to it?):

Code:
<h:commandLink action="${bean.method}" value="Do Method">
<f:param name="paramName" value="1" />
</h:commandLink>


Why might this be happening?

Also, when the param value is set to an EL expression, nothing appears.

But if I place the expression as just text within the h:column but outside
the commandLink it appears as it should (based on each row's value...)
--
View this message in context: http://www.nabble.com/param-not-appearing-in-commandLink-tf3201274.html#a8888661
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Search Discussions

  • Mikael Andersson at Feb 9, 2007 at 5:49 pm
    Probably not the reply you want, but you would inject the param into your
    backing bean like this:

    <managed-bean>
    <managed-bean-name>bean</managed-bean-name>
    <managed-bean-class> com.SomeBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>paramToSet</property-name>
    <value>#{ param.paramName}</value>
    </managed-property>
    </managed-bean>

    Or simply grab it from the Request parameters in your code.

    If you really need to generate a proper url, you can use the outputLink
    component.

    Cheers,
    Mike

    On 09/02/07, lightbulb432 wrote:


    Within a h:dataTable's h:column I have a h:commandLink that I want to show
    a
    specific URL parameter. Within the commandLink I therefore add an f:param,
    but it doesn't seem to do anything in the generated URL.

    Even if I have a static value like below, nothing happens (shouldn't every
    generated URL have an ?paramName=1 appended to it?):

    Code:
    <h:commandLink action="${bean.method}" value="Do Method">
    <f:param name="paramName" value="1" />
    </h:commandLink>


    Why might this be happening?

    Also, when the param value is set to an EL expression, nothing appears.

    But if I place the expression as just text within the h:column but outside
    the commandLink it appears as it should (based on each row's value...)
    --
    View this message in context:
    http://www.nabble.com/param-not-appearing-in-commandLink-tf3201274.html#a8888661
    Sent from the MyFaces - Users mailing list archive at Nabble.com.
  • Jeff Bischoff at Feb 9, 2007 at 5:57 pm
    lightbulb,

    JSF does not use URL-rewriting to pass data. Do you really need the URL
    to contain these parameters, or are you just trying to pass the
    information within JSF?

    If you are making an URL for accessing some non-JSF page then you might
    try h:outputLink instead of h:commandLink.

    Otherwise, I recommend using t:updateActionListener in this scenario.
    You can update some arbitrary managed bean property to set the row you
    want selected/operated on. f:param should work fine too, but don't
    expect to see the h:commandLink URL change.

    Regards,

    Jeff Bischoff
    Kenneth L Kurz & Associates, Inc.

    lightbulb432 wrote:
    Within a h:dataTable's h:column I have a h:commandLink that I want to show a
    specific URL parameter. Within the commandLink I therefore add an f:param,
    but it doesn't seem to do anything in the generated URL.

    Even if I have a static value like below, nothing happens (shouldn't every
    generated URL have an ?paramName=1 appended to it?):

    Code:
    <h:commandLink action="${bean.method}" value="Do Method">
    <f:param name="paramName" value="1" />
    </h:commandLink>


    Why might this be happening?

    Also, when the param value is set to an EL expression, nothing appears.

    But if I place the expression as just text within the h:column but outside
    the commandLink it appears as it should (based on each row's value...)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmyfaces
postedFeb 9, '07 at 4:56p
activeFeb 9, '07 at 5:57p
posts3
users3
websitemyfaces.apache.org

People

Translate

site design / logo © 2018 Grokbase