Just a question to start with... what exactly are you passing into the isInstance method? c.isInstance(org.apache.struts.actions.DispatchAction) doesn't work in my compiler. =)
Why not just instantiate it and use instanceof? if( Class.newInstance() instanceof org.apache.struts.actions.DispatchAction ) { /* ... */ } David Hibbs Staff Programmer / Analyst American National Insurance Company > -----Original Message----- > From: Jerry Jalenak [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 14, 2003 3:10 PM > To: 'Struts Users Mailing List' > Subject: RE: [OT] Determining Class Type of Action > > > No, it's not. Poor typing on my part 8-) > > I've worked around my problem by getting the name > (.getName()) and doing a > String comparison. Not real pretty, but it works. I'd > rather check to see > if it is an instance of DispatchAction rather than checking > to see if it is > 'org.apache.struts.actions.DispatchAction'..... > > Jerry Jalenak > Team Lead, Web Publishing > LabOne, Inc. > 10101 Renner Blvd. > Lenexa, KS 66219 > (913) 577-1496 > > [EMAIL PROTECTED] > > > > -----Original Message----- > > From: Michael Ruppin [mailto:[EMAIL PROTECTED] > > Sent: Thursday, August 14, 2003 3:01 PM > > To: Struts Users Mailing List > > Subject: Re: [OT] Determining Class Type of Action > > > > > > Is this a cut & paste of the code? You're missing a > > closing paren in your if statement. > > > > m > > > > --- Jerry Jalenak <[EMAIL PROTECTED]> wrote: > > > I am extracting the class type from an Action: > > > > > > Class c = Class.forName(mapping.getType()); > > > > > > I can then 'chase' the class chain backwards: > > > > > > boolean isDispatchAction = false; > > > while(!isDispatchAction) > > > { > > > c = c.getSuperClass(); > > > if > > > > > (c.isInstance(org.apache.struts.actions.DispatchAction) > > > { > > > isDispatchAction = true; > > > } > > > } > > > > > > The 'if' statement comparison is never true. I've > > > printed out the value of > > > 'c' on each iteration through the loop, and can see > > > when it is > > > 'org.apache.struts.actions.DispatchAction', but my > > > isDispatchAction boolean > > > never gets set to true. > > > > > > What's the right way to do this? > > > > > > Thanks! > > > > > > > > > Jerry Jalenak > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]