[ http://issues.apache.org/struts/browse/SHALE-217?page=all ]
Gary VanMatre reassigned SHALE-217:
-----------------------------------
Assignee: Gary VanMatre
> 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
>
> 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: [email protected]
> 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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Craig
> McClanahan
> Sent: Wednesday, July 12, 2006 7:45 PM
> To: [email protected]
> Subject: Re: Is this possible to pass dynamically information from a beans as
> a shale method parameter?
> On 7/12/06, Iakouchev Alexander-EAL027C <[EMAIL PROTECTED]> 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