Frank,
I think you are on to something here. Why don't you subclass ActionMapping
and in your subclass put your member variable and getter and setter. You can
then access the value from your action class's excecute method's mapping
parameter after you cast it to your ActionMapping subclass?

-Richard


-----Original Message-----
From: Frank Maritato [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 18, 2003 2:47 PM
To: Struts Users Mailing List
Subject: Re: initializing properties for Actions


Carl,

That didn't work, but thanks anyway. I also tried changing the data type for

passwordDisabled to a String and have the normal get/set methods but that
didn't 
seem to change the outcome either.

I think the real problem is that it is trying to call setPasswordDisabled on
org.apache.struts.action.ActionMapping instead of my LoginAction class. Not
sure 
if this is a known "you can't do that" or a known bug or whatever (I'm using

struts 1.1.0). I was unable to find any info on this topic either in the 
archives or on jakarta.apache.org.


Carl wrote:
> I'm not sure that this will solve your pb, but I think you should use
> 
> public boolean isPasswordDisabled() {
>      return passwordDisabled;
> }
> 
> instead of getPasswordDisabled.
> 
> Carl
> 
> 
> 
> Frank Maritato wrote:
> 
>> Hi,
>>
>> I'm trying to pass some initialization parameters to an Action and 
>> I'm
>> having some trouble. What I want is to be able to tell my LoginAction 
>> not to validate passwords for development systems. Here is what I have 
>> right now followed by the error I get on startup:
>>
>> struts-config.xml:
>> <action
>>   path="/login"
>>   type="action.LoginAction"
>>   scope="request"
>>   name="loginForm"
>>   validate="false"
>>   input="/login/login.jsp"
>>   >
>>   <set-property property="passwordDisabled" value="true" /> </action>
>>
>> LoginAction.java:
>>   public boolean passwordDisabled = false;
>>   public boolean getPasswordDisabled() {
>>     return passwordDisabled;
>>   }
>>   public void setPasswordDisabled(boolean aValue) {
>>     passwordDisabled = aValue;
>>   }
>>
>> error log:
>> Nov 18, 2003 2:06:14 PM org.apache.commons.digester.SetPropertyRule 
>> begin
>> FINE: 
>> [SetPropertyRule]{struts-config/action-mappings/action/set-property} 
>> Set org.apache.struts.action.ActionMapping property passwordDisabled 
>> to true
>> Nov 18, 2003 2:06:14 PM org.apache.commons.digester.Digester startElement
>> SEVERE: Begin event threw exception
>> java.lang.NoSuchMethodException: Bean has no property named 
>> passwordDisabled
>>         at 
>>
org.apache.commons.digester.SetPropertyRule.begin(SetPropertyRule.java:192) 
>>
>>         at org.apache.commons.digester.Rule.begin(Rule.java:200)
>>         at
>> org.apache.commons.digester.Digester.startElement(Digester.java:1273)
>>         at 
>>
weblogic.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXPar
ser.java:459) 
>>
>>         at
>>
weblogic.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Abstra
ctXMLDocumentParser.jav 
>>
>> a:221)
>>
>>
>> It looks like it is trying to set the passwordDisabled property in 
>> the
>> ActionMapping class instead of the LoginAction class. wtf? I can't 
>> find any examples anywhere that set parameters on actions, but 
>> according to the dtd, it is valid. Any help is appreciated.
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
Frank Maritato

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to