shale-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary VanMatre (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (SHALE-217) Not possible to pass dynamically information from a beans as a shale method parameter.
Date Sat, 29 Jul 2006 01:29:21 GMT
     [ http://issues.apache.org/struts/browse/SHALE-217?page=all ]

Gary VanMatre resolved SHALE-217.
---------------------------------

    Fix Version/s: 1.0.3
       Resolution: Fixed

I'm going to close this one out.  It's been a couple of weeks.  

> Not possible to pass dynamically information from a beans as a shale method parameter.
> --------------------------------------------------------------------------------------
>
>                 Key: SHALE-217
>                 URL: http://issues.apache.org/struts/browse/SHALE-217
>             Project: Shale
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.3
>         Environment: Software platform.
>            Reporter: Alex Yakushev
>         Assigned To: Gary VanMatre
>             Fix For: 1.0.3
>
>
> Some notes. I forget to tell.
> It is perfectly working with constans ...
> <s:validatorVar name="operationID" value="Testing"/>
> ,not with beans ...
> <s:validatorVar name="operationID"
> value="#{mtJobOperation.operationID}"/>
> Second line pass to a custom validator method just a null.
> Alex.
>  
> -----Original Message-----
> From: Iakouchev Alexander-EAL027C
> Sent: Thursday, July 13, 2006 10:29 AM
> To: user@shale.apache.org
> Subject: RE: Is this possible to pass dynamically information from a beans as a shale
method parameter?
> Hello Craig!
> Thank you for feedback.
> I want to be more specific. I need validate all rows in "dataTable"
> component. JSP page show list of "Foo" objects. For example, the inputText component
with id="---" has shale custom validate. I need analyze dependency component id="---" row
i from component id="---" row 0...n.
> In other words I need pass some current row id to get by id real object.
> <s:commonsValidator
>   type="validateQuoteHoursValue"
>   arg="quoteHours"
>   server="true"
>   client="false"
> >
>   <s:validatorVar name="operationID"
> value="#{mtJobOperation.operationID}"/>
> </s:commonsValidator>
> This valuator does not works. It receive operationID equal null. But outputText shown
some not null information.
> <t:outputText value="#{mtJobOperation.operationID}"/>
> The Shale validator example show some solution with dynamic shale method parameter, but
it is with standard validator example not a custom validator.
> Alex.
>  
> -----Original Message-----
> From: craigmcc@gmail.com [mailto:craigmcc@gmail.com] On Behalf Of Craig McClanahan
> Sent: Wednesday, July 12, 2006 7:45 PM
> To: user@shale.apache.org
> Subject: Re: Is this possible to pass dynamically information from a beans as a shale
method parameter?
> On 7/12/06, Iakouchev Alexander-EAL027C <EAL027C@motorola.com> wrote:
> >
> > Is this possible to pass dynamically information from a beans as a 
> > shale method parameter?
> > Alex.
> >
> >
> In JSF 1.1, you cannot do this (it's not a Shale issue, it's the basic functionality
of JSF method binding expression).  In JSF 1.2, you can ...
> but only for calls to static methods.
> A better general strategy is to invoke a method that takes no parameters, but ensure
that the called method can extract whatever it needs.  For example, consider the standard
JSF call to your action method (which takes no parameters).  There are at least two ways for
the called method to access request parameters on the incoming request:
> * Via JSF programmatic APIs:
>     // Retrieve the value of the "foo" parameter
>     FacesContext context = FacesContext.getCurrentInstance();
>     String foo = (String)
>  
> context.getExternalContext().getRequestParameterMap().get("foo"0;
> * By managed beans expression evaluation.  This example requires
>   a bit more setup to configure, but is much easier to use because
>   the values are injected for you.  Consider again that you want to
>   extract the value of the "foo" parameter and use it in your myAction()
>   action method.  Define your managed bean entry like this:
>     <managed-bean>
>       <managed-bean-name>mybean</managed-bean-name>
>       <managed-bean-class>com.mypackage.MyBean</managed-bean-class>
>       <managed-bean-scope>request</managed-bean-scope>
>       <managed-property>
>         <property-name>foo</property-name>
>         <value>#{param.foo}</value>
>       </managed-property>
>     </managed-bean>
>   and set up your bean class like this:
>     package com.mypackage;
>     public class MyBean {
>       ...
>       private String foo = null;
>       public String getFoo() { return this.foo; }
>       public void setFoo(String foo) { this.foo = foo; }
>       ...
>       public String myAction() {
>         // Get the value of the "foo" request parameter
>         String foo = getFoo();
>         ...
>       }
>       ...
>     }
> The formula #{param.foo} is evaluated when the managed bean is created, and extracts
the value of the request parameter named "foo" and calls
> setFoo() on your bean.  By the time the action method is called, the value will be there
already.
> Craig

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message