MyFaces Core
  1. MyFaces Core
  2. MYFACES-3012

Allow f:param for <h:inputText> <f:ajax>

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.4-SNAPSHOT
    • Fix Version/s: None
    • Component/s: JSR-314
    • Labels:
      None
    • Environment:
      myfaces trunk, shared svn. rev 1051469

      Description

      I don't know what spec says but following should work:

      <h:inputText>
      <f:param name="paramName" value="paramValue" />
      <f:ajax />
      </h:inputText>

      expected result is paramName = paramValue pair in request.

      For h:command it works already.

        Activity

        Hide
        Martin Marinschek added a comment -

        I would like this feature, but it is not foreseen by the spec so far.

        best regards,

        Martin

        Show
        Martin Marinschek added a comment - I would like this feature, but it is not foreseen by the spec so far. best regards, Martin
        Hide
        Martin Kočí added a comment -

        Yes,
        <f:ajax>
        <f:param name="param1" value="value1" />
        </f:ajax>

        is nicer and it is that what I wanted originally but spec says: "<f:param>
        Add a child UIParameter component to the UIComponent associated with the closest parent UIComponent custom
        action." so parametrized is not ajax behaviour but component - my intent was not to wait for JSF 2.2 API and make it working now.

        Which other options we have if we want pass a parameter to request? jsf.ajax.request accept params array but I didn't see any elegant java/facelets API for it.

        Other (or complementary) solution can be permit attributes wiring for f:ajax like:
        <f:ajax param1="value1" />
        It will popuplate behaviour instance in simililar way as UIComponent's getAttributes() and ValueExpressions.

        Similar problem with missing "parameter API" I pointed out for converter/validator: http://www.mail-archive.com/dev@myfaces.apache.org/msg47138.html

        Show
        Martin Kočí added a comment - Yes, <f:ajax> <f:param name="param1" value="value1" /> </f:ajax> is nicer and it is that what I wanted originally but spec says: "<f:param> Add a child UIParameter component to the UIComponent associated with the closest parent UIComponent custom action." so parametrized is not ajax behaviour but component - my intent was not to wait for JSF 2.2 API and make it working now. Which other options we have if we want pass a parameter to request? jsf.ajax.request accept params array but I didn't see any elegant java/facelets API for it. Other (or complementary) solution can be permit attributes wiring for f:ajax like: <f:ajax param1="value1" /> It will popuplate behaviour instance in simililar way as UIComponent's getAttributes() and ValueExpressions. Similar problem with missing "parameter API" I pointed out for converter/validator: http://www.mail-archive.com/dev@myfaces.apache.org/msg47138.html
        Show
        Jakob Korherr added a comment - Thread on jsr-314-open: http://lists.jboss.org/pipermail/jsr-314-open-mirror/2011-January/000704.html
        Hide
        Jakob Korherr added a comment -

        I am not sure if this really »should« work. At least I could not find any documentation about it in the spec.

        IMO it is clear that this should work for UICommand components, because f:param is associated with the command that this component triggers. But I don't know if this should be true for input components also, because on a non-ajax JSF request this is also not supported by input components.

        However, looking at the javascript spec of jsf.ajax.request(source, event, options) I found the following:

        options
        The set of available options that can be sent as request parameters to control client and/or server side request processing. Acceptable name/value pair options are:
        name value
        execute space seperated list of client identifiers
        render space seperated list of client identifiers
        onevent function to callback for event
        onerror function to callback for error
        params object containing parameters to include in the request
        The options argument is optional.

        --> you are able to specify custom params here, so why shouldn't it work via the JSF tags f:param + f:ajax?

        Thus IMO we should ask the expert group about the expected behavior before committing the patch. However, I think the behavior you're describing is NOT expected in JSF 2.0 and 2.1, but it might be a cool feature for JSF 2.2.

        Furthermore it could support something like this:

        <f:ajax>
        <f:param name="param1" value="value1" />
        </f:ajax>

        I'll write a mail to jsr-314-open about this!

        Show
        Jakob Korherr added a comment - I am not sure if this really »should« work. At least I could not find any documentation about it in the spec. IMO it is clear that this should work for UICommand components, because f:param is associated with the command that this component triggers. But I don't know if this should be true for input components also, because on a non-ajax JSF request this is also not supported by input components. However, looking at the javascript spec of jsf.ajax.request(source, event, options) I found the following: options The set of available options that can be sent as request parameters to control client and/or server side request processing. Acceptable name/value pair options are: name value execute space seperated list of client identifiers render space seperated list of client identifiers onevent function to callback for event onerror function to callback for error params object containing parameters to include in the request The options argument is optional. --> you are able to specify custom params here, so why shouldn't it work via the JSF tags f:param + f:ajax? Thus IMO we should ask the expert group about the expected behavior before committing the patch. However, I think the behavior you're describing is NOT expected in JSF 2.0 and 2.1, but it might be a cool feature for JSF 2.2. Furthermore it could support something like this: <f:ajax> <f:param name="param1" value="value1" /> </f:ajax> I'll write a mail to jsr-314-open about this!
        Hide
        Jakob Korherr added a comment -

        changed summary to f:param (was: ui:param)

        Show
        Jakob Korherr added a comment - changed summary to f:param (was: ui:param)

          People

          • Assignee:
            Unassigned
            Reporter:
            Martin Kočí
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development