You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by lightbulb432 <ve...@hotmail.com> on 2007/02/09 17:56:25 UTC

param not appearing in commandLink

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.


Re: param not appearing in commandLink

Posted by Jeff Bischoff <jb...@klkurz.com>.
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...)



Re: param not appearing in commandLink

Posted by Mikael Andersson <ma...@gmail.com>.
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 <ve...@hotmail.com> 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.
>
>