You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Uri Kalish <uk...@mercury.com> on 2006/04/27 14:40:32 UTC

f:param and commandButton

When I send a parameter from a commandButton I get a string containing
the word "null" from the parameters map.

If I use a commandLink instead - it works.

Any ideas?

 

 

<h:commandButton

id="addNewLoadTestReservationButton"

 
action="#{userReservationsTableViewBean.createNewLoadTestReservation}"

      value="#{msgs.addNewLoadTestReservationButton}"

      styleClass="button_action" >

            <f:param name="reservation" value="0"/>

</h:commandButton>

<h:commandLink

id="addNewLoadTestReservationLink"

 
action="#{userReservationsTableViewBean.createNewLoadTestReservation}"> 

            <h:outputText
value="#{msgs.addNewLoadTestReservationButton}"/>

            <f:param name="reservation" value="0"/>

</h:commandLink>

 

 

 

 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Re: f:param and commandButton

Posted by Mert Çalışkan <mc...@gmail.com>.
IBM RSA doesn't support it yet..lol :)))
1.5 has lots of nifty features and I agree about using it too.

Regards,

Mert

On 5/9/06, Andrew Robinson <an...@gmail.com> wrote:
>
> Yep, sorry, I work exclusively on Tiger/Java5/JDK 1.5 (whatever you
> want to call it). I use generics, enum's and the new for loop a lot.
> Good for me, maybe not so good for people who can't upgrade to it yet.
> Makes me wonder what percentage of people are still on 1.4...
>
> On 5/9/06, Mike Kienenberger <mk...@gmail.com> wrote:
> > On 5/9/06, Andrew Robinson <an...@gmail.com> wrote:
> > > I have released that tomahawk tag handler in component form at:
> > >
> > > http://sourceforge.net/projects/jsf-comp/
> > >
> > > Download the tagHandlers release:
> > >
> http://sourceforge.net/project/showfiles.php?group_id=137466&package_id=168411&release_id=368243
> >
> > Hey Andrew.
> >
> > I started using your handler about a week ago.   One thing I noticed
> > was that it seemed to have some unnecessary Java 1.5? code in it.
> >
> > I changed
> >
> > ================
> >                 for (ActionListener listener : source.getActionListeners
> ())
> >                 {
> > ================
> >
> > to
> >
> > ================
> >             ActionListener actionListeners[] = source.getActionListeners
> ();
> >                 for (int index = 0; index < actionListeners.length;
> ++index)
> >                 {
> >                     ActionListener listener = actionListeners[index];
> > ================
> >
> > and it has been running great for me under Java 1.4.2.
> >
>

Re: f:param and commandButton

Posted by Andrew Robinson <an...@gmail.com>.
Yep, sorry, I work exclusively on Tiger/Java5/JDK 1.5 (whatever you
want to call it). I use generics, enum's and the new for loop a lot.
Good for me, maybe not so good for people who can't upgrade to it yet.
Makes me wonder what percentage of people are still on 1.4...

On 5/9/06, Mike Kienenberger <mk...@gmail.com> wrote:
> On 5/9/06, Andrew Robinson <an...@gmail.com> wrote:
> > I have released that tomahawk tag handler in component form at:
> >
> > http://sourceforge.net/projects/jsf-comp/
> >
> > Download the tagHandlers release:
> > http://sourceforge.net/project/showfiles.php?group_id=137466&package_id=168411&release_id=368243
>
> Hey Andrew.
>
> I started using your handler about a week ago.   One thing I noticed
> was that it seemed to have some unnecessary Java 1.5? code in it.
>
> I changed
>
> ================
>                 for (ActionListener listener : source.getActionListeners())
>                 {
> ================
>
> to
>
> ================
>             ActionListener actionListeners[] = source.getActionListeners();
>                 for (int index = 0; index < actionListeners.length; ++index)
>                 {
>                     ActionListener listener = actionListeners[index];
> ================
>
> and it has been running great for me under Java 1.4.2.
>

Re: f:param and commandButton

Posted by Mike Kienenberger <mk...@gmail.com>.
On 5/9/06, Andrew Robinson <an...@gmail.com> wrote:
> I have released that tomahawk tag handler in component form at:
>
> http://sourceforge.net/projects/jsf-comp/
>
> Download the tagHandlers release:
> http://sourceforge.net/project/showfiles.php?group_id=137466&package_id=168411&release_id=368243

Hey Andrew.

I started using your handler about a week ago.   One thing I noticed
was that it seemed to have some unnecessary Java 1.5? code in it.

I changed

================
		for (ActionListener listener : source.getActionListeners())
		{
================

to

================
	    ActionListener actionListeners[] = source.getActionListeners();
		for (int index = 0; index < actionListeners.length; ++index)
		{
		    ActionListener listener = actionListeners[index];
================

and it has been running great for me under Java 1.4.2.

Re: f:param and commandButton

Posted by Andrew Robinson <an...@gmail.com>.
I have released that tomahawk tag handler in component form at:

http://sourceforge.net/projects/jsf-comp/

Download the tagHandlers release:
http://sourceforge.net/project/showfiles.php?group_id=137466&package_id=168411&release_id=368243

It will be more up to date than the one I made for my Church and
posted (bethanyefree).

-Andrew

On 5/9/06, damonsmith <da...@larrymite.com.au> wrote:
>
> I found the issue, and just in case anyone is googling for it, it's because
> I'm using Facelets as my ViewHandler, not JSP files.  Apparently Facelets
> handles assigning values like this differently, and the only solution I
> could find was to use a different component implementation of
> updateActionListener.
>
> I found one called
> org.bethanyefree.taghandlers.TomahawkUpdateActionListenerHandler.java
> which I've added to my custom tag namespace as an updateActionListener tag,
> and it does the job.  It does throw an error message which I haven't
> properly investigated, but it appears to work properly.
>
> There is some info about the differences here:
> https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create-component
>
> Any extra info on this issue would still be greatly appreciated.
>
> cheers,
>
> Damon Smith
> --
> View this message in context: http://www.nabble.com/f%3Aparam-and-commandButton-t1517965.html#a4302679
> Sent from the MyFaces - Users forum at Nabble.com.
>
>

RE: f:param and commandButton

Posted by damonsmith <da...@larrymite.com.au>.
I found the issue, and just in case anyone is googling for it, it's because
I'm using Facelets as my ViewHandler, not JSP files.  Apparently Facelets
handles assigning values like this differently, and the only solution I
could find was to use a different component implementation of
updateActionListener.

I found one called
org.bethanyefree.taghandlers.TomahawkUpdateActionListenerHandler.java
which I've added to my custom tag namespace as an updateActionListener tag,
and it does the job.  It does throw an error message which I haven't
properly investigated, but it appears to work properly.

There is some info about the differences here:
https://facelets.dev.java.net/nonav/docs/dev/docbook.html#taglib-create-component

Any extra info on this issue would still be greatly appreciated.

cheers,

Damon Smith
--
View this message in context: http://www.nabble.com/f%3Aparam-and-commandButton-t1517965.html#a4302679
Sent from the MyFaces - Users forum at Nabble.com.


RE: f:param and commandButton

Posted by damonsmith <da...@larrymite.com.au>.
I've just tried using an updateActionListener tag inside a commandLink tag,
as it sounds like a brilliant solution, but I get an error saying that the
parent tag (the HtmlCommandLink object) is not an instance of
EditableValueHolder.

I'm using the current release versions of myfaces-1.1.2 and tomahawk 1.1.1. 
Is anyone else getting this problem?  Could this be a version issue?

any help appreciated,

Damon Smith
--
View this message in context: http://www.nabble.com/f%3Aparam-and-commandButton-t1517965.html#a4282395
Sent from the MyFaces - Users forum at Nabble.com.


Re: f:param and commandButton

Posted by Matthias Wessendorf <ma...@apache.org>.
+1 on t:updateActionListener since params is an *ugly* way...

On 4/27/06, Murat Hazer <mu...@gmail.com> wrote:
>
> You can use t:updateActionListener with command button, also you can read http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters  for additional info.
>
>
> regards
>
>
>
> On 4/27/06, Uri Kalish <uk...@mercury.com> wrote:
>
> >
> >
> >
> >
> > When I send a parameter from a commandButton I get a string containing the word "null" from the parameters map.
> >
> > If I use a commandLink instead - it works.
> >
> > Any ideas?
> >
> >
> >
> >
> >
> >  <h:commandButton
> >
> >  id="addNewLoadTestReservationButton"
> >
> >        action="#{userReservationsTableViewBean.createNewLoadTestReservation}"
> >
> >        value="#{msgs.addNewLoadTestReservationButton}"
> >
> >        styleClass="button_action" >
> >
> >              <f:param name="reservation" value="0"/>
> >
> >  </h:commandButton>
> >
> >  <h:commandLink
> >
> >  id="addNewLoadTestReservationLink"
> >
> >        action="#{userReservationsTableViewBean.createNewLoadTestReservation}">
> >
> >              <h:outputText value="#{msgs.addNewLoadTestReservationButton}"/>
> >
> >              <f:param name="reservation" value="0"/>
> >
> >  </h:commandLink>
> >
> >
> >
> >
> >
> >
> >
> >
> >  ______________________________________________________________________
> >  This email has been scanned by the MessageLabs Email Security System.
> >  For more information please visit http://www.messagelabs.com/email
> >  ______________________________________________________________________
> >
>
>
>
>
>
> --
> Murat HAZER
> Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer
> Tel - Phone: +90 222 335 05 80 - 1395
> Cep Tel - Mobile Phone: +90 532 472 00 63
> Blog URL: http://www.projedunyasi.org
> Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/



--
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
http://jroller.com/page/mwessendorf
mwessendorf-at-gmail-dot-com

Re: f:param and commandButton

Posted by Murat Hazer <mu...@gmail.com>.
You can use *t:updateActionListener* with command button, also you can read
http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters for
additional info.


regards

On 4/27/06, Uri Kalish <uk...@mercury.com> wrote:
>
>  When I send a parameter from a commandButton I get a string containing
> the word "null" from the parameters map.
>
> If I use a commandLink instead - it works.
>
> Any ideas?
>
>
>
>
>
> <h:commandButton
>
> id="addNewLoadTestReservationButton"
>
>       action="#{userReservationsTableViewBean.createNewLoadTestReservation
> }"
>
>       value="#{msgs.addNewLoadTestReservationButton}"
>
>       styleClass="button_action" >
>
>             <f:param name="reservation" value="0"/>
>
> </h:commandButton>
>
> <h:commandLink
>
> id="addNewLoadTestReservationLink"
>
>       action="#{userReservationsTableViewBean.createNewLoadTestReservation}">
>
>
>             <h:outputText value="#{msgs.addNewLoadTestReservationButton
> }"/>
>
>             <f:param name="reservation" value="0"/>
>
> </h:commandLink>
>
>
>
>
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>



--
Murat HAZER
Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer
Tel - Phone: +90 222 335 05 80 - 1395
Cep Tel - Mobile Phone: +90 532 472 00 63
Blog URL: http://www.projedunyasi.org
Yahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/

Re: f:param and commandButton

Posted by Lisaa <li...@yahoo.com>.
Hi.,
 As martin said u can't use Parameters within command buttons.

But u could try like this:

<h:commandButton value="SUBMIT"   action="#{bean.actionMethod}">
<h:inputHidden  value="paramValue" binding="#{bean.property}" />
</h:commandButton>

and ur binding property in backing bean should be of type HTMLInputHidden.

Perhap this helps you.

Greetz.
--
View this message in context: http://www.nabble.com/f%3Aparam-and-commandButton-t1517965.html#a4284131
Sent from the MyFaces - Users forum at Nabble.com.


Re: f:param and commandButton

Posted by Martin Marinschek <ma...@gmail.com>.
Hi Uri,

commandButtons can't send parameters.

regards,

Martin

On 4/27/06, Uri Kalish <uk...@mercury.com> wrote:
>
>  When I send a parameter from a commandButton I get a string containing
> the word "null" from the parameters map.
>
> If I use a commandLink instead - it works.
>
> Any ideas?
>
>
>
>
>
> <h:commandButton
>
> id="addNewLoadTestReservationButton"
>
>       action="#{userReservationsTableViewBean.createNewLoadTestReservation
> }"
>
>       value="#{msgs.addNewLoadTestReservationButton}"
>
>       styleClass="button_action" >
>
>             <f:param name="reservation" value="0"/>
>
> </h:commandButton>
>
> <h:commandLink
>
> id="addNewLoadTestReservationLink"
>
>       action="#{userReservationsTableViewBean.createNewLoadTestReservation}">
>
>
>             <h:outputText value="#{msgs.addNewLoadTestReservationButton
> }"/>
>
>             <f:param name="reservation" value="0"/>
>
> </h:commandLink>
>
>
>
>
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>



--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces