struts-config.xml <action-mappings type="mapping.HackMapping"> [action definitions snipped] </action-mappings>
HackMapping.java public class HackMapping extends ActionMapping { public boolean passwordDisabled = false; public boolean getPasswordDisabled() { return passwordDisabled; } public void setPasswordDisabled(boolean aValue) { passwordDisabled = aValue; } }
LoginAction.java execute method System.out.println("pd: "+((HackMapping)mapping).getPasswordDisabled());
Wendy Smoak wrote:
From: Frank Maritato [mailto:[EMAIL PROTECTED] I think the real problem is that it is trying to call setPasswordDisabled on
org.apache.struts.action.ActionMapping instead of my LoginAction class.
I remember being confused about this, too. When struts-config.xml gets run through the Digester, an <action> tag causes the creation of an ActionMapping object. So any properties you specify in <action> are part of an ActionMapping object.
An ActionMapping has a 'type' property that is the class name of the Action that will be created. (Type actually comes from ActionConfig.) Later, some other part of Struts will call getType() on the ActionMapping object and will instantiate your Action class.
How do you create your own ActionMappings? I know I read it somewhere... It's covered in chapter 7 of "Struts in Action" but I can't find more than this in the Struts docs: http://jakarta.apache.org/struts/userGuide/building_controller.html
I generally just use <context-param> (in web.xml) and context.getInitParameter().
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]