FAQ
If I have a commandLink or commandButton on one page to which I attach a value (e.g. an integer or even a bean) – how can I pass that on to the next page so that the bean of the next page knows this value?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

<o:p> </o:p>

Thanks<o:p></o:p>



Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

Search Discussions

  • Martin Marinschek at Sep 16, 2005 at 12:25 pm
    with a commandLink, you could use the f:param tag.

    A cool MyFaces specific feature is the t:updateActionListener tag - you can
    set a value onto a backing bean if a command has been executed.

    Another possibility is to write an actionListener instead of an action
    method and use the supplied ActionEvent to get to the component and e.g. to
    the dataModel of a wrapping dataTable.

    regards,

    Martin
    On 9/16/05, Esther Leimbeck wrote:

    If I have a commandLink or commandButton on one page to which I attach a
    value (e.g. an integer or even a bean) – how can I pass that on to the
    next page so that the bean of the next page knows this value?

    Thanks


    Verschicken Sie romantische, coole und witzige Bilder per SMS!
    Jetzt bei WEB.DE <http://WEB.DE> FreeMail: *http://f.web.de/?mc=021193*<http://f.web.de/?mc=021193>



    --

    http://www.irian.at
    Your JSF powerhouse -
    JSF Trainings in English and German
  • Rick Reumann at Sep 16, 2005 at 1:43 pm

    Martin Marinschek wrote the following on 9/16/2005 8:25 AM:

    A cool MyFaces specific feature is the t:updateActionListener tag - you
    can set a value onto a backing bean if a command has been executed.
    I'm very interested in seeing this tag used or some docs on it. I looked
    under the UpdateActionListenerTag docs
    http://myfaces.apache.org/javadoc/tomahawk/ and
    http://myfaces.apache.org/tlddoc/tomahawk/ but didn't find anything.

    Does one of the MyFaces examples show how it's used?

    --
    Rick
  • Thomas Spiegl at Sep 16, 2005 at 2:14 pm
    If your bean is Serializable use

    <t:saveState value="#{yourBean}" />

    to make yourBean available on next page.

    regards, Thomas


    On 9/16/05, Rick Reumann wrote:

    Martin Marinschek wrote the following on 9/16/2005 8:25 AM:
    A cool MyFaces specific feature is the t:updateActionListener tag - you
    can set a value onto a backing bean if a command has been executed.
    I'm very interested in seeing this tag used or some docs on it. I looked
    under the UpdateActionListenerTag docs
    http://myfaces.apache.org/javadoc/tomahawk/ and
    http://myfaces.apache.org/tlddoc/tomahawk/ but didn't find anything.

    Does one of the MyFaces examples show how it's used?

    --
    Rick
  • Rick Reumann at Sep 16, 2005 at 2:28 pm

    Thomas Spiegl wrote the following on 9/16/2005 10:14 AM:
    If your bean is Serializable use

    <t:saveState value="#{yourBean}" />
    That's not what I'm asking though. I'm asking about how to use the
    t:updateActionListener tag. I'm thinking the tag would be used inside of
    a commandLink or commandButton tag and when the action is fired that the
    link or button represents, it will automatically set and bean properties
    of the backing bean backing that action? If so, this would be a SUPERBLY
    nice feature.

    Currently, for example if you pass in parameters with a commandLink you
    need to do the following in the resulting action (assuming foo is the
    f:param):

    FacesContext context = FacesContext.getCurrentInstance();
    Map map = context.getExternalContext().getRequestParameterMap();
    String foo = (String) map.get("foo");

    I'm assuming that possibly t:updateActionListener would avoid this
    construct and that if you had a property in the Action called "foo" it
    would be automagically populated using the tag. This would be very nice
    - so nice, that I think it should be part of standard JSF.
    to make yourBean available on next page.

    regards, Thomas



    On 9/16/05, *Rick Reumann* wrote:

    Martin Marinschek wrote the following on 9/16/2005 8:25 AM:
    A cool MyFaces specific feature is the t:updateActionListener tag - you
    can set a value onto a backing bean if a command has been executed.
    I'm very interested in seeing this tag used or some docs on it. I looked
    under the UpdateActionListenerTag docs
    http://myfaces.apache.org/javadoc/tomahawk/ and
    http://myfaces.apache.org/tlddoc/tomahawk/ but didn't find anything.

    Does one of the MyFaces examples show how it's used?

    --
    Rick

    --
    Rick
  • Thomas Spiegl at Sep 16, 2005 at 3:08 pm
    Rick,

    My answer was related to Esther Leimbeck's question.

    When using the updateActionListener nested inside a commandLink, the backing
    bean will automatically be updated.

    Have a look at the Master-Detail example:
    http://irian.at/myfaces/masterDetail.jsf
    http://irian.at/myfaces/masterDetail.jsp.source

    regards,Thomas

    http://www.irian.at
    Your JSF powerhouse -
    JSF Trainings in English and German
    On 9/16/05, Rick Reumann wrote:

    Thomas Spiegl wrote the following on 9/16/2005 10:14 AM:
    If your bean is Serializable use

    <t:saveState value="#{yourBean}" />
    That's not what I'm asking though. I'm asking about how to use the
    t:updateActionListener tag. I'm thinking the tag would be used inside of
    a commandLink or commandButton tag and when the action is fired that the
    link or button represents, it will automatically set and bean properties
    of the backing bean backing that action? If so, this would be a SUPERBLY
    nice feature.

    Currently, for example if you pass in parameters with a commandLink you
    need to do the following in the resulting action (assuming foo is the
    f:param):

    FacesContext context = FacesContext.getCurrentInstance();
    Map map = context.getExternalContext().getRequestParameterMap();
    String foo = (String) map.get("foo");

    I'm assuming that possibly t:updateActionListener would avoid this
    construct and that if you had a property in the Action called "foo" it
    would be automagically populated using the tag. This would be very nice
    - so nice, that I think it should be part of standard JSF.
    to make yourBean available on next page.

    regards, Thomas



    On 9/16/05, *Rick Reumann* wrote:

    Martin Marinschek wrote the following on 9/16/2005 8:25 AM:
    A cool MyFaces specific feature is the t:updateActionListener tag - you
    can set a value onto a backing bean if a command has been executed.
    I'm very interested in seeing this tag used or some docs on it. I looked
    under the UpdateActionListenerTag docs
    http://myfaces.apache.org/javadoc/tomahawk/ and
    http://myfaces.apache.org/tlddoc/tomahawk/ but didn't find anything.

    Does one of the MyFaces examples show how it's used?

    --
    Rick

    --
    Rick
  • Rick Reumann at Sep 16, 2005 at 4:41 pm

    Thomas Spiegl wrote the following on 9/16/2005 11:08 AM:
    Rick,

    My answer was related to Esther Leimbeck's question.

    When using the updateActionListener nested inside a commandLink, the
    backing bean will automatically be updated.

    Have a look at the Master-Detail example:
    http://irian.at/myfaces/masterDetail.jsf
    http://irian.at/myfaces/masterDetail.jsp.source
    Awesome! Thanks Thomas! That tag is so cool.

    This really is the answer I think to all the questions on this list that
    come up when people are concerned about using request params in command
    links and then having to pull them out of the faces Context.

    Instead, this tag should be used imo. Saves lot of time is much cleaner.

    --
    Rick
  • Martin Marinschek at Sep 16, 2005 at 10:01 pm
    If you like it,

    you might want to document it ;)

    regards,

    Martin
    On 9/16/05, Rick Reumann wrote:
    Thomas Spiegl wrote the following on 9/16/2005 11:08 AM:
    Rick,

    My answer was related to Esther Leimbeck's question.

    When using the updateActionListener nested inside a commandLink, the
    backing bean will automatically be updated.

    Have a look at the Master-Detail example:
    http://irian.at/myfaces/masterDetail.jsf
    http://irian.at/myfaces/masterDetail.jsp.source
    Awesome! Thanks Thomas! That tag is so cool.

    This really is the answer I think to all the questions on this list that
    come up when people are concerned about using request params in command
    links and then having to pull them out of the faces Context.

    Instead, this tag should be used imo. Saves lot of time is much cleaner.

    --
    Rick

    --

    http://www.irian.at
    Your JSF powerhouse -
    JSF Trainings in English and German
  • Rafael Nami at Sep 16, 2005 at 10:41 pm
    Man, what a awesome example this master detail.

    Best Regards

    Rafael Mauricio Nami

    2005/9/16, Martin Marinschek <martin.marinschek@gmail.com>:
    If you like it,

    you might want to document it ;)

    regards,

    Martin
    On 9/16/05, Rick Reumann wrote:
    Thomas Spiegl wrote the following on 9/16/2005 11:08 AM:
    Rick,

    My answer was related to Esther Leimbeck's question.

    When using the updateActionListener nested inside a commandLink, the
    backing bean will automatically be updated.

    Have a look at the Master-Detail example:
    http://irian.at/myfaces/masterDetail.jsf
    http://irian.at/myfaces/masterDetail.jsp.source
    Awesome! Thanks Thomas! That tag is so cool.

    This really is the answer I think to all the questions on this list that
    come up when people are concerned about using request params in command
    links and then having to pull them out of the faces Context.

    Instead, this tag should be used imo. Saves lot of time is much cleaner.

    --
    Rick

    --

    http://www.irian.at
    Your JSF powerhouse -
    JSF Trainings in English and German

    --
    Java - Assim no Server como no Palm
    <i>Java - thus in the Server as it is in Palm
  • Rick Reumann at Sep 17, 2005 at 5:33 am

    On 9/16/05, Martin Marinschek wrote:

    If you like it,

    you might want to document it ;)


    Created a wiki entry here on it, plus some other techniques. I'm sure I made
    some mistakes so any corrections welcome.
    http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters


    --
    Rick
  • Thomas Spiegl at Sep 17, 2005 at 9:32 am
    Great! Thanks for writing this entry!
    On 9/17/05, Rick Reumann wrote:
    On 9/16/05, Martin Marinschek wrote:

    If you like it,

    you might want to document it ;)


    Created a wiki entry here on it, plus some other techniques. I'm sure I
    made some mistakes so any corrections welcome.
    http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters


    --
    Rick
  • Martin Marinschek at Sep 17, 2005 at 4:12 pm
    Very good entry,

    the one thing missing IMHO in the end is mentioning setting
    preserveDataModel to true on your t:dataTable element. With that, you
    can even omit using the t:saveState tag.

    regards,

    Martin
    On 9/17/05, Thomas Spiegl wrote:
    Great! Thanks for writing this entry!

    On 9/17/05, Rick Reumann wrote:
    On 9/16/05, Martin Marinschek wrote:

    If you like it,

    you might want to document it ;)


    Created a wiki entry here on it, plus some other techniques. I'm sure I
    made some mistakes so any corrections welcome.
    http://wiki.apache.org/myfaces/ExecutingMethodsFromLinkButtonParameters

    --
    Rick

    --

    http://www.irian.at
    Your JSF powerhouse -
    JSF Trainings in English and German
  • Rick Reumann at Sep 17, 2005 at 4:15 pm

    Martin Marinschek wrote the following on 9/17/2005 12:12 PM:
    Very good entry,

    the one thing missing IMHO in the end is mentioning setting
    preserveDataModel to true on your t:dataTable element. With that, you
    can even omit using the t:saveState tag.
    Does that only preserve it for the next request? I don't want it
    preserved in Session. If it acts just like saveState, that would be great.

    --
    Rick
  • Martin Marinschek at Sep 17, 2005 at 4:19 pm
    Yes!

    not even for the whole next request, until right before the render
    response phase...

    regards,

    Martin
    On 9/17/05, Rick Reumann wrote:
    Martin Marinschek wrote the following on 9/17/2005 12:12 PM:
    Very good entry,

    the one thing missing IMHO in the end is mentioning setting
    preserveDataModel to true on your t:dataTable element. With that, you
    can even omit using the t:saveState tag.
    Does that only preserve it for the next request? I don't want it
    preserved in Session. If it acts just like saveState, that would be great.

    --
    Rick

    --

    http://www.irian.at
    Your JSF powerhouse -
    JSF Trainings in English and German

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmyfaces
postedSep 16, '05 at 11:25a
activeSep 17, '05 at 4:19p
posts14
users6
websitemyfaces.apache.org

People

Translate

site design / logo © 2018 Grokbase