Yeah, I know, my spelling is terrible in code. All I can say in my
defense is that I go back and fix it with Eclipse's refactoring tools at
the end, before anyone else at the company has to see it. That doesn't
save you poor souls on the user list who are subjected to my interim
incompetence, though.

The reason I had the action created by Spring was that it has one field
that's populated by Spring: 
<beans>
        <bean id="loginChecker"
class="com.kbcfp.midas.security.TokenDemoLoginChecker"
singleton="true"/>

            <bean id="loginAction"
class="com.kbcfp.midas.action.LoginAction" singleton="false">
                <property name="loginChecker"><ref local="loginChecker"
/></property>
            </bean>
</beans> 

I guess I could manually call Spring from Java code to fill in the
log-in checker class, but this way I can keep Spring entirely out of my
code's [direct] dependencies, which helps keep the Maven POM down to a
manageable size. If there's a simpler way to tell Struts to use Spring
on certain of an action's properties, feel free to enlighten me. I've
been doing Struts with Spring for a week, so I'm not set in my ways just
yet.

--[BACK ON TOPIC]--
The wildcard worked like a charm. I changed the struts.xml to the
following:

        <action name="login_*" class="loginAction" method="{1}">
                <result name="input">/jsp/login.jsp</result>
                <result name="success">/jsp/redirect.jsp</result>
        </action>

and changed the form action in the JSP to go to "login_execute", and it
didn't even require any more Java code. 

Thanks!
~Dan




--- "Allen, Daniel" <[EMAIL PROTECTED]> wrote:
> Is there a way to prevent the validation from firing unless the user
is
> coming back to it after attempting to log in? 

By default the validation interceptor won't check a set of action
methods,
including the "input" method. The easiest thing, IMO, is to create an
action
mapping for the action that specifies the method. One way to avoid
creating
an additional XML mapping is to use wildcarding.

> struts.xml excerpt: 
>            <action name="login" class="loginAction"> <!-- class is
> instantiated by Spring, hence no qualified classname -->

Declaring the action as a spring bean is optional, depending on how
you're
wiring things, but I'm guessing you already knew that one.

>                       <result name="input">/jsp/login.jsp</result>
>                       <result
> name="success">/jsp/redirect.jsp</result>

If everything is behind S2 then this is an un-necessary complication,
but I
don't know how your app is set up. Just FYI.

> @SuppressWarnings("unchecked")
> public class LoginAction extends ActionSupport implements
> ValidationAware, Validateable, SessionAware {

FYI, ActionSupport already implements ValidationAware and Validateable.

>       private String userName = null;

"null" is the default, uninitialized value for member variables.

>               if(redirectDesintation == null ||

Spelling :p

Dave

-- 
This message may contain confidential, proprietary, or legally privileged 
information. No confidentiality or privilege is waived by any transmission to 
an unintended recipient. If you are not an intended recipient, please notify 
the sender and delete this message immediately. Any views expressed in this 
message are those of the sender, not those of any entity within the KBC 
Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the 
part of KBC FP. It is not an offer (or solicitation of an offer) of, or a 
recommendation to buy or sell, any financial product. Any prices or other 
values included in this message are indicative only, and do not necessarily 
represent current market prices, prices at which KBC FP would enter into a 
transaction, or prices at which similar transactions may be carried on KBC FP's 
own books. The information contained in this message is provided "as is", 
without representations or warranties, express or implied, of any kind. Past 
performance is not indicative of future returns.


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

Reply via email to