Thanks Wes for reply. I figured out that we can only forward to jsp not to
action from interceptor.

So Now I am forwarding to jsp from interceptor and it's working fine. Below
is my changed code in struts.xml and LoginInterceptor.java.

<p>[code]

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE struts PUBLIC 
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" 
    "http://struts.apache.org/dtds/struts-2.0.dtd";> 


<struts> 
        <constant name="struts.objectFactory" value="spring" /> 
    
        <constant name="struts.action.extension" value="do"/> 
        <constant name="struts.objectFactory.spring.autoWire"
value="AUTOWIRE_BY_NAME"/> 

    <!-- Add packages here --> 
    <package name="dafault" extends="struts-default"> 
    
                <result-types> 
                        <result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" /> 
                </result-types> 
    
    <interceptors> 
            <interceptor name="loginInterceptor"
class="com.ncr.framework.interceptor.LoginInterceptor"/> 
            
            <interceptor-stack name="capabilityStack"> 
                <interceptor-ref name="defaultStack"/> 
                <interceptor-ref name="loginInterceptor"/> 
                </interceptor-stack> 
                
        </interceptors> 
            
        <default-interceptor-ref name="capabilityStack"/> 
                              
<global-results>
            <result name="loginPage" type="tiles">page.Login</result>
        </global-results>          
                <action name="logon" class="loginAction" method="execute"> 
            <result name="success" type="tiles">page.Login</result> 
                </action> 
</package> 
</struts> 

LoginInterceptor.java 

public class LoginInterceptor extends AbstractInterceptor { 
public String intercept(ActionInvocation invocation) throws Exception { 
                ActionContext context = invocation.getInvocationContext(); 
                Map<String, Object> contextMap = context.getContextMap(); 
                HttpServletRequestWrapper request =
(HttpServletRequestWrapper) contextMap 
                                .get(HTTP_REQUEST); 
                synchronized (request) { 
                        ThreadContext.setRequest(request); 
                        UserInfo userInfo =
UserContext.getCurrentUserInfo(); 

                        if (userInfo == null 
                                        &&
!"authenticate".equals(contextMap.get(ACTION_NAME))) { 
                                return "logonPage"; 
                        } 
                        return invocation.invoke(); 
                } 
        }}
<p>

Regards,
Devendra


Wes Wannemacher wrote:
> 
> On Tue, May 25, 2010 at 8:47 AM, rocks <devendra_tiwari12...@yahoo.com>
> wrote:
>> Martin,
>>
>> I haven't get any response from Wes [:(].
>>
> 
> Sorry I didn't notice that I was being called out directly :)... I was
> out of town, in a magical place that my children really enjoyed, but
> unfortunately charged $9.99 / day for internet access[1]
> 
> I am still trying to catch up on a lot of email (it's amazing how far
> behind you can get on email when you're cut off for only a few days).
> I haven't read your message thoroughly, and I can't promise that I
> will right away. But, I do have an example that might help[2]. If it
> doesn't help, post back here, there are tons of users on this list
> combining struts2, spring and hibernate. If you didn't get many
> responses before, you probably haven't posted enough details or the
> description of your problem was too vague.
> 
> [1]
> http://disneyworld.disney.go.com/resorts/contemporary-resort/services-amenities/
> [2]
> http://code.google.com/p/struts2inpractice/source/browse/#svn/trunk/ch04ex01
> (check the ch04ex01 project)
> 
> -Wes
> -- 
> Wes Wannemacher
> 
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Struts2%2BSpring2%2BInterceptor%2BInvalid-action-class-configuration-that-references-an-unknown-class-named-tp28636590p28680342.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to