You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Juan Pablo Pizarro <ju...@gmail.com> on 2008/05/28 22:11:47 UTC

Are sessions confused?

The problem:
	I'm using two browsers into separate machines, so, I loged as "1" in
a browser and when a login with user "2" in other browser (and
separate machine), I see logged es "1", then I press ctrl+f5 and
change to user "2", but if I don't press that, the session is wrong.

The following are my logs.

...
INFO http-8182-1 org.gblx.action.common.CommonAction -
SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
INFO http-8182-1 org.gblx.action.common.CommonAction - SET_SESSION:
{page=index.jsp, user=org.gblx.entities.User@1270107}
...
INFO http-8182-1 org.gblx.action.common.CommonAction -
SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
INFO http-8182-1 org.gblx.action.common.CommonAction - SET_SESSION:
{LOGIN_ATTEMPT=yes, user=org.gblx.entities.User@63a1ae,
page=login.jsp}
...
INFO http-8182-2 org.gblx.action.common.CommonAction -
SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
INFO http-8182-2 org.gblx.action.common.CommonAction - SET_SESSION:
{page=index.jsp, user=org.gblx.entities.User@17644c8}
...
INFO http-8182-2 org.gblx.action.common.CommonAction -
SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
INFO http-8182-2 org.gblx.action.common.CommonAction - SET_SESSION:
{user=org.gblx.entities.User@148b272, LOGIN_ATTEMPT=yes,
page=login.jsp}
...
INFO http-8182-2 org.gblx.action.common.CommonAction -
SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
INFO http-8182-2 org.gblx.action.common.CommonAction - SET_SESSION:
{user=org.gblx.entities.User@1a84b38,
req=org.gblx.entities.Request@19422d2, page=welcome.jsp}
...
INFO http-8182-2 org.gblx.action.common.CommonAction -
SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
INFO http-8182-2 org.gblx.action.common.CommonAction - SET_SESSION:
{page=menu.jsp, user=org.gblx.entities.User@145d424}

Steps:
	1.- The first 2 are the login with the user "1".
	2.- The next 2 are the login with user "2".
	3.- The next log is a operation with user "1" but it keeps the
session of user "2"!!!.
	4.- The last is the CTRL+F5 in the browser (in a separate PC) of user
"1" and then, the http session is right.

My hard:
	- The project is running in a hp proliant 1100.
	- 2 PC's 1 laptop. From thats, I open web browsers (IE6, FIREFOX).

Soft:
	- tomcat 6.0.16 running on w2003 server.
	- strts2 2.0.11.
	- I use spring and hibernate to get domain objects, but not
integrated with struts in a conf.

Conf:
        <interceptors>
	    <interceptor name="login"
class="org.gblx.interceptor.common.LoginInterceptor" />

            <interceptor-stack name="defaultLoginStack">
                <interceptor-ref name="servlet-config" />
                <interceptor-ref name="params" />
                <interceptor-ref name="login" />
                <interceptor-ref name="prepare" />
                <interceptor-ref name="chain" />
                <interceptor-ref name="model-driven" />
                <interceptor-ref name="fileUpload" />
                <interceptor-ref name="static-params" />
                <interceptor-ref name="params" />
                <interceptor-ref name="conversionError" />
                <interceptor-ref name="validation" />
                <interceptor-ref name="workflow" />
            </interceptor-stack>

            <interceptor-stack name="defaultInsecureStack">
                <interceptor-ref name="servlet-config" />
                <interceptor-ref name="params" />
                <interceptor-ref name="prepare" />
                <interceptor-ref name="chain" />
                <interceptor-ref name="model-driven" />
                <interceptor-ref name="fileUpload" />
                <interceptor-ref name="static-params" />
                <interceptor-ref name="params" />
                <interceptor-ref name="conversionError" />
                <interceptor-ref name="validation" />
                <interceptor-ref name="workflow" />
            </interceptor-stack>
        </interceptors>

        <default-interceptor-ref name="defaultLoginStack" />



Code:
	I've a class called CommonAction. All Actions extends from it.

public class CommonAction extends ActionSupport implements SessionAware,
		ParameterAware {

private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(CommonAction.class);
private Map session;
private Map parameters;

public void setSession(Map session) {
	HttpServletRequest request = (HttpServletRequest)
ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);

	logger.info("SET_HTTP_SESSION: " + request.getSession().getId());
	logger.info("SET_SESSION: " + session);
	this.session = session;
}

public Map getSession() {
	HttpServletRequest request = (HttpServletRequest)
ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
	logger.info("GET_HTTP_SESSION: " + request.getSession().getId());
	logger.info("GET_SESSION: " + session);
	return session;
}
public void setParameters(Map parameters) {
	this.parameters = parameters;
}
public Map getParameters() {
	return parameters;
}
}
	
	
I use two forms to modify the session. Through this.getSession() and using

	ServletActionContext.getRequest().getSession().setAttribute("message",
getText("message_user_exists"));


I'm traied several things, but nothing. Any idea?

Regards,

JP

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


Re: Are sessions confused?

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
You are welcome. Martin told me that.

Regards,

JP

2008/6/6, Julien ROTT <ju...@gmail.com>:
> this seems to work, the sessions aren't overlaping anymore.
> I'll test deeper on monday ;-)
> Thanks !
>
> 2008/6/6 Juan Pablo Pizarro <ju...@gmail.com>:
>
> > Hi Julien,
> >
> >  I had two problems, the first was my app, where the problem was
> > hibernate. The other, on my pc at home, the struts-blank, I don't know
> > (I abandoned that when I solved the problem of my app).
> >
> >  In my application, I put
> >
> >                response.setHeader("Cache-Control", "no-cache");
> >        response.setHeader("Pragma", "no-cache");
> >        response.setDateHeader("Expires", 0);
> >
> > http://www.jguru.com/faq/view.jsp?EID=377
> >
> > Regards,
> >
> > JP
> >
> >
> >
>

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


Re: Are sessions confused?

Posted by Julien ROTT <ju...@gmail.com>.
this seems to work, the sessions aren't overlaping anymore.
I'll test deeper on monday ;-)
Thanks !

2008/6/6 Juan Pablo Pizarro <ju...@gmail.com>:

> Hi Julien,
>
>  I had two problems, the first was my app, where the problem was
> hibernate. The other, on my pc at home, the struts-blank, I don't know
> (I abandoned that when I solved the problem of my app).
>
>  In my application, I put
>
>                response.setHeader("Cache-Control", "no-cache");
>        response.setHeader("Pragma", "no-cache");
>        response.setDateHeader("Expires", 0);
>
> http://www.jguru.com/faq/view.jsp?EID=377
>
> Regards,
>
> JP
>
>
>

Re: Are sessions confused?

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
Hi Julien,

  I had two problems, the first was my app, where the problem was
hibernate. The other, on my pc at home, the struts-blank, I don't know
(I abandoned that when I solved the problem of my app).

  In my application, I put

                response.setHeader("Cache-Control", "no-cache");
	response.setHeader("Pragma", "no-cache");
	response.setDateHeader("Expires", 0);

http://www.jguru.com/faq/view.jsp?EID=377

Regards,

JP


2008/6/6, Julien ROTT <ju...@gmail.com>:
> Hi Juan Pablo,
>
> did you find a solution to your problem ?
>
> I have the same: my application is on the internet, and the clients access
> to the application from behind a proxy. When client "A" logs in, and then a
> client "B" logs in, Client "B" sees the data which is stored in client "A"
> session.
>
> Is it possible to avoid this problem by forcing the urlRewriting with the
> jsessionid for each request ?
>
> jr.
>
>
> 2008/6/2 Juan Pablo Pizarro <ju...@gmail.com>:
>
> > No, I haven't. Now my application is working, then, i suspect that the
> > problem was external and maybe the networking personel had a proxy or
> > something like that. I'm asking them. In my pc, I haven't.
> >
> > I'll download tomcat again to test in my house.
> >
> >
> >
>

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


Re: Are sessions confused?

Posted by Julien ROTT <ju...@gmail.com>.
Hi Juan Pablo,

did you find a solution to your problem ?

I have the same: my application is on the internet, and the clients access
to the application from behind a proxy. When client "A" logs in, and then a
client "B" logs in, Client "B" sees the data which is stored in client "A"
session.

Is it possible to avoid this problem by forcing the urlRewriting with the
jsessionid for each request ?

jr.


2008/6/2 Juan Pablo Pizarro <ju...@gmail.com>:

> No, I haven't. Now my application is working, then, i suspect that the
> problem was external and maybe the networking personel had a proxy or
> something like that. I'm asking them. In my pc, I haven't.
>
> I'll download tomcat again to test in my house.
>
>
>

Re: Are sessions confused?

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
No, I haven't. Now my application is working, then, i suspect that the
problem was external and maybe the networking personel had a proxy or
something like that. I'm asking them. In my pc, I haven't.

I'll download tomcat again to test in my house.



2008/6/2 Al Sutton <al...@alsutton.com>:
> Do you have a caching proxy between you and the server? If so try going
> directly to the server.
>
> Juan Pablo Pizarro wrote:
>>
>> Yes, the effect is the same.. :( everything is ok, but when I pressed
>> ctrl+f5, the sessions are the last again.
>>
>> How you put thing in the session from a action?
>>
>> 2008/6/1, Martin <mg...@hotmail.com>:
>>
>>>
>>> can you display the session_id from your test scenarios?
>>>
>>> Thanks
>>> ----- Original Message ----- From: "Juan Pablo Pizarro"
>>> <ju...@gmail.com>
>>> To: "Struts Users Mailing List" <us...@struts.apache.org>
>>> Sent: Sunday, June 01, 2008 11:30 AM
>>> Subject: Re: Are sessions confused?
>>>
>>>
>>>
>>>
>>>>
>>>> Yes I know, but my application was struts2-blank-2.0.11.1.war (from
>>>> struts-2.0.11.1-all.zip). Then I coded a bit and I posted that.
>>>>
>>>> JP
>>>>
>>>> 2008/6/1 Dave Newton <ne...@yahoo.com>:
>>>>
>>>>
>>>>>
>>>>> --- On Fri, 5/30/08, Juan Pablo Pizarro wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> With
>>>>>>
>>>
>>> ServletActionContext.getRequest().getSession().setAttribute("user",
>>>
>>>>>>
>>>>>> (int) (Math.random() * 100)); the problem is only in
>>>>>> firefox!!.
>>>>>>
>>>>>>
>>>>>
>>>>> If you're on different machines and seeing the wrong session data on
>>>>>
>>>
>>> them then something is broken with your application. I've never seen this
>>> in
>>> S2 and as said before most of us here are using S2 sessions without any
>>> issues.
>>>
>>>>>
>>>>> Dave
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>>
>>>>>
>>>>> To unsubscribe, e-mail:
>>>>>
>>>
>>> user-unsubscribe@struts.apache.org
>>>
>>>>>
>>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>>
>>>>
>>>> To unsubscribe, e-mail:
>>>>
>>>
>>> user-unsubscribe@struts.apache.org
>>>
>>>>
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Are sessions confused?

Posted by Al Sutton <al...@alsutton.com>.
Do you have a caching proxy between you and the server? If so try going 
directly to the server.

Juan Pablo Pizarro wrote:
> Yes, the effect is the same.. :( everything is ok, but when I pressed
> ctrl+f5, the sessions are the last again.
>
> How you put thing in the session from a action?
>
> 2008/6/1, Martin <mg...@hotmail.com>:
>   
>> can you display the session_id from your test scenarios?
>>
>> Thanks
>> ----- Original Message ----- From: "Juan Pablo Pizarro"
>> <ju...@gmail.com>
>> To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Sent: Sunday, June 01, 2008 11:30 AM
>> Subject: Re: Are sessions confused?
>>
>>
>>
>>     
>>> Yes I know, but my application was struts2-blank-2.0.11.1.war (from
>>> struts-2.0.11.1-all.zip). Then I coded a bit and I posted that.
>>>
>>> JP
>>>
>>> 2008/6/1 Dave Newton <ne...@yahoo.com>:
>>>
>>>       
>>>> --- On Fri, 5/30/08, Juan Pablo Pizarro wrote:
>>>>
>>>>         
>>>>> With
>>>>>           
>> ServletActionContext.getRequest().getSession().setAttribute("user",
>>     
>>>>> (int) (Math.random() * 100)); the problem is only in
>>>>> firefox!!.
>>>>>
>>>>>           
>>>> If you're on different machines and seeing the wrong session data on
>>>>         
>> them then something is broken with your application. I've never seen this in
>> S2 and as said before most of us here are using S2 sessions without any
>> issues.
>>     
>>>> Dave
>>>>
>>>>
>>>>
>>>>         
>> ---------------------------------------------------------------------
>>     
>>>> To unsubscribe, e-mail:
>>>>         
>> user-unsubscribe@struts.apache.org
>>     
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>         
>>>       
>> ---------------------------------------------------------------------
>>     
>>> To unsubscribe, e-mail:
>>>       
>> user-unsubscribe@struts.apache.org
>>     
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   


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


Re: Are sessions confused?

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
Yes, the effect is the same.. :( everything is ok, but when I pressed
ctrl+f5, the sessions are the last again.

How you put thing in the session from a action?

2008/6/1, Martin <mg...@hotmail.com>:
> can you display the session_id from your test scenarios?
>
> Thanks
> ----- Original Message ----- From: "Juan Pablo Pizarro"
> <ju...@gmail.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Sunday, June 01, 2008 11:30 AM
> Subject: Re: Are sessions confused?
>
>
>
> > Yes I know, but my application was struts2-blank-2.0.11.1.war (from
> > struts-2.0.11.1-all.zip). Then I coded a bit and I posted that.
> >
> > JP
> >
> > 2008/6/1 Dave Newton <ne...@yahoo.com>:
> >
> > > --- On Fri, 5/30/08, Juan Pablo Pizarro wrote:
> > >
> > > > With
> ServletActionContext.getRequest().getSession().setAttribute("user",
> > > > (int) (Math.random() * 100)); the problem is only in
> > > > firefox!!.
> > > >
> > >
> > > If you're on different machines and seeing the wrong session data on
> them then something is broken with your application. I've never seen this in
> S2 and as said before most of us here are using S2 sessions without any
> issues.
> > >
> > > Dave
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Are sessions confused?

Posted by Martin <mg...@hotmail.com>.
can you display the session_id from your test scenarios?

Thanks
----- Original Message ----- 
From: "Juan Pablo Pizarro" <ju...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Sunday, June 01, 2008 11:30 AM
Subject: Re: Are sessions confused?


> Yes I know, but my application was struts2-blank-2.0.11.1.war (from
> struts-2.0.11.1-all.zip). Then I coded a bit and I posted that.
>
> JP
>
> 2008/6/1 Dave Newton <ne...@yahoo.com>:
>> --- On Fri, 5/30/08, Juan Pablo Pizarro wrote:
>>> With ServletActionContext.getRequest().getSession().setAttribute("user",
>>> (int) (Math.random() * 100)); the problem is only in
>>> firefox!!.
>>
>> If you're on different machines and seeing the wrong session data on them 
>> then something is broken with your application. I've never seen this in 
>> S2 and as said before most of us here are using S2 sessions without any 
>> issues.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 


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


Re: Are sessions confused?

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
Yes I know, but my application was struts2-blank-2.0.11.1.war (from
struts-2.0.11.1-all.zip). Then I coded a bit and I posted that.

JP

2008/6/1 Dave Newton <ne...@yahoo.com>:
> --- On Fri, 5/30/08, Juan Pablo Pizarro wrote:
>> With ServletActionContext.getRequest().getSession().setAttribute("user",
>> (int) (Math.random() * 100)); the problem is only in
>> firefox!!.
>
> If you're on different machines and seeing the wrong session data on them then something is broken with your application. I've never seen this in S2 and as said before most of us here are using S2 sessions without any issues.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Are sessions confused?

Posted by Dave Newton <ne...@yahoo.com>.
--- On Fri, 5/30/08, Juan Pablo Pizarro wrote:
> With ServletActionContext.getRequest().getSession().setAttribute("user",
> (int) (Math.random() * 100)); the problem is only in
> firefox!!.

If you're on different machines and seeing the wrong session data on them then something is broken with your application. I've never seen this in S2 and as said before most of us here are using S2 sessions without any issues.

Dave


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


Re: Are sessions confused?

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
With ServletActionContext.getRequest().getSession().setAttribute("user",
(int) (Math.random() * 100)); the problem is only in firefox!!.

So.. now I'm lost, I don't understand, I suppose that the problem is
from my project, but, I can't see it. This is a bit disappointing :(

Any idea?


2008/5/30 Juan Pablo Pizarro <ju...@gmail.com>:
> I've problems with sessions, but, is it an issue?.
> The erratic behavior is this:
>
> I opened a firefox and logged with user "1" (the login only put in
> session a random number, the action no get a user from somewhere). The
> page showed 28.
> I opened a IE7 and logged with user "2". Showed 84.
> I pressed CTRL+F5 (update the page and cache) in the firefox and it
> updated the number to 84.
>
> I repeat the experince in dev1 env. and in my workstation, and today,
> in my computer (home).
>
> To by sure, I used the struts2-blank-2.0.11.1.war expanded, obviusly,
> with the minimal modifications to show the number, and
> apache-tomcat-5.5.26 (and 6.X too).
> I based my app on http://struts.apache.org/2.x/docs/bootstrap.html
>
> Please, I need to know if the problem is an issue, is a bag strategy
> to access to session, is a bag conf  or other.
>
> Any idea?
>
> Best Regards,
>
> Juan Pablo
>
> ===============================
> ===============================
>
> The LoginAction
> ===============================
> public String execute() throws Exception {
>        // This access way is from:
>        // http://struts.apache.org/2.x/docs/accessing-application-session-request-objects.html
>        Map session = (Map) ActionContext.getContext().get("session");
>        session.put("user", (int) (Math.random() * 100));
>        return SUCCESS;
> }// excecute
>
> Login Page
> ===============================
> <%@ page contentType="text/html; charset=UTF-8" %>
> <%@ taglib prefix="s" uri="/struts-tags" %>
> ...
> <s:form action="Login">
>    <s:textfield key="username"/>
>    <s:password key="password" />
>    <s:submit/>
> </s:form>
> ...
>
> Struts.xml
> ===============================
> <?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.enable.DynamicMethodInvocation" value="false" />
>    <constant name="struts.devMode" value="false" />
>    <include file="common.xml"/>
> </struts>
>
> Common.xml
> ===============================
> <?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>
>    <package name="common" namespace="/common" extends="struts-default">
>        <action name="Login_*" method="{1}"
> class="org.gblx.action.common.LoginAction">
>            <result name="input">/common/Login.jsp</result>
>            <result type="redirect-action">Menu</result>
>        </action>
>        <action name="Welcome">
>            <result>/common/Welcome.jsp</result>
>        </action>
>        <action name="*" class="org.gblx.action.common.CommonSupport">
>            <result>/common/{1}.jsp</result>
>        </action>
>    </package>
> </struts>
>
> Web.xml
> ===============================
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app id="WebApp_9" version="2.4"
>        xmlns="http://java.sun.com/xml/ns/j2ee"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
>        <display-name>...</display-name>
>        <filter>
>                <filter-name>struts2</filter-name>
>                <filter-class>
>                        org.apache.struts2.dispatcher.FilterDispatcher
>                </filter-class>
>        </filter>
>        <filter-mapping>
>                <filter-name>struts2</filter-name>
>                <url-pattern>/*</url-pattern>
>        </filter-mapping>
>        <welcome-file-list>
>                <welcome-file>index.html</welcome-file>
>        </welcome-file-list>
> </web-app>
>
>
>
>
>
>
>
> 2008/5/30 Juan Pablo Pizarro <ju...@gmail.com>:
>> Gracias Martin!
>>
>> These are my logs.
>>
>> I put a message in the session, and.. the session is copied or is the
>> same!!. I don't know how avoid that.
>>
>> I use the same web browser, and other to make the tests.
>>
>> I'm looking for a similar thread.. but nothing yet.
>>
>> Juan Pablo.
>>
>> ------------------------------------------------
>>
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {page=menu.jsp, user=org.gblx.entities.User@145582}
>>  INFO [http-8080-Processor23] (CommonAction.java:48) -
>> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:49) - GET_SESSION:
>> {page=menu.jsp, user=org.gblx.entities.User@145582}
>>  INFO [http-8080-Processor23] (WelcomeAction.java:27) - USER: 1
>>  INFO [http-8080-Processor24] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
>> {req=org.gblx.entities.Request@1e514a9, page=index.jsp}
>>  INFO [http-8080-Processor24] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
>> {req=org.gblx.entities.Request@1e514a9, LOGIN_ATTEMPT=yes,
>> page=login.jsp}
>>  INFO [http-8080-Processor24] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
>> {req=org.gblx.entities.Request@1e514a9, LOGIN_ATTEMPT=yes,
>> message=Error!, the user isn't active., page=login.jsp}
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {req=org.gblx.entities.Request@1e514a9, page=menu.jsp,
>> user=org.gblx.entities.User@1886a34, message=Error!, the user isn't
>> active.}
>>  INFO [http-8080-Processor23] (CommonAction.java:48) -
>> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:49) - GET_SESSION:
>> {req=org.gblx.entities.Request@1e514a9, page=menu.jsp,
>> user=org.gblx.entities.User@1886a34, message=Error!, the user isn't
>> active.}
>>  INFO [http-8080-Processor23] (WelcomeAction.java:27) - USER: jpp
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {page=index.jsp, req=org.gblx.entities.Request@1bb6a69,
>> message=Error!, the user isn't active.}
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {req=org.gblx.entities.Request@1bb6a69, LOGIN_ATTEMPT=yes,
>> message=Error!, the user isn't active., page=login.jsp}
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {page=menu.jsp, req=org.gblx.entities.Request@1bb6a69, message=Error!,
>> the user isn't active., user=org.gblx.entities.User@145582}
>>  INFO [http-8080-Processor23] (CommonAction.java:48) -
>> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:49) - GET_SESSION:
>> {page=menu.jsp, req=org.gblx.entities.Request@1bb6a69, message=Error!,
>> the user isn't active., user=org.gblx.entities.User@145582}
>>  INFO [http-8080-Processor23] (WelcomeAction.java:27) - USER: 1
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {page=index.jsp, req=org.gblx.entities.Request@1fe4d40,
>> message=Error!, the user isn't active.}
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {LOGIN_ATTEMPT=yes, req=org.gblx.entities.Request@1fe4d40,
>> message=Error!, the user isn't active., page=login.jsp}
>>  INFO [http-8080-Processor24] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
>> {page=menu.jsp, user=org.gblx.entities.User@1886a34,
>> req=org.gblx.entities.Request@1fe4d40, message=Error!, the user isn't
>> active.}
>>  INFO [http-8080-Processor24] (CommonAction.java:48) -
>> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor24] (CommonAction.java:49) - GET_SESSION:
>> {page=menu.jsp, user=org.gblx.entities.User@1886a34,
>> req=org.gblx.entities.Request@1fe4d40, message=Error!, the user isn't
>> active.}
>>  INFO [http-8080-Processor24] (WelcomeAction.java:27) - USER: jpp
>>  INFO [http-8080-Processor23] (CommonAction.java:39) -
>> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
>> {req=org.gblx.entities.Request@ca1ada,
>> user=org.gblx.entities.User@1886a34, page=welcome.jsp, message=Error!,
>> the user isn't active.}
>>
>>
>>
>>
>> 2008/5/29, Martin <mg...@hotmail.com>:
>>> Hola!
>>>
>>> so if you execute the sessions separately
>>> 1st run
>>> index.jsp SET_HTTP_SESSION=
>>> login.jsp  SET_HTTP_SESSION=
>>> menu.jsp SET_HTTP_SESSION=
>>> logout.jspSET_HTTP_SESSION=
>>>
>>> 2nd run
>>> index.jsp SET_HTTP_SESSION=
>>> login.jsp  SET_HTTP_SESSION=
>>> menu.jsp SET_HTTP_SESSION=
>>> logout.jsp SET_HTTP_SESSION=
>>>
>>> once you are able to verify the SessionIDs for session1
>>> and different for session2
>>> then run them together and compare the results..
>>>
>>> let me know if you have any questions
>>>
>>> Saludos Cordiales!
>>> Martin
>>> ----- Original Message ----- From: "Juan Pablo Pizarro"
>>> <ju...@gmail.com>
>>> To: "Martin" <mg...@hotmail.com>
>>> Sent: Thursday, May 29, 2008 7:03 PM
>>> Subject: Re: Are sessions confused?
>>>
>>>
>>>
>>> > I traied a lot of things.. now I'm reading things. Any idea?
>>> >
>>> > 2008/5/29, Juan Pablo Pizarro <ju...@gmail.com>:
>>> >
>>> > > The form that I use the user through the app is with a session object.
>>> > > I put it in my login interceptor and ask for it in others.
>>> > >
>>> > > I'm searching attributes in the actions that are not used as fields in
>>> > > the html, but until now, I didn't find.
>>> > >
>>> > > public String intercept(ActionInvocation invocation) throws Exception {
>>> > >
>>> > > final ActionContext context =
>>> invocation.getInvocationContext();
>>> > > HttpServletRequest request = (HttpServletRequest)
>>> > >
>>> context.get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
>>> > >
>>> > > session = request.getSession(true);
>>> > >
>>> > > User user = (User) session.getAttribute("user");
>>> > > if (user == null || user.getLogin() == null) {
>>> > >       String registerAttempt = (String)
>>> > > request.getSession().getAttribute(REGISTER_ATTEMPT);
>>> > >       String activateAttempt = (String) request.getSession()
>>> > >
>>> .getAttribute(ACTIVATE_ATTEMPT);
>>> > >       String loginAttempt = (String)
>>> request.getSession().getAttribute(
>>> > >                                       LOGIN_ATTEMPT);
>>> > >                       String page = (String)
>>> request.getSession().getAttribute(PAGE);
>>> > >
>>> > >       if (registerAttempt == "yes" || activateAttempt == "yes"
>>> > > || page == "index.jsp")
>>> > >                return invocation.invoke();
>>> > >
>>> > >       if (loginAttempt == "yes") {
>>> > >               if (processLoginAttempt(request, session)) {
>>> > >
>>> session.removeAttribute(LOGIN_ATTEMPT);
>>> > >                       return "login-success";
>>> > >               } else {
>>> > >                       Object action = invocation.getAction();
>>> > >                       if (action instanceof ValidationAware) {
>>> > >                               ((ValidationAware) action)
>>> > > .addActionError("Username or password incorrect.");
>>> > >                       }// if
>>> > >
>>> > >               }// if-else
>>> > >
>>> > >       }// if
>>> > >
>>> > >       return "login-attempt";
>>> > >       } else {
>>> > >               return invocation.invoke();
>>> > >       }
>>> > > }
>>> > >
>>> > >
>>> > > 2008/5/29, Juan Pablo Pizarro <ju...@gmail.com>:
>>> > > > Ok, but the problem is that here
>>> > > >
>>> > > > lands on login.jsp..
>>> > > > INFO http-8182-2 org.gblx.action.common.CommonAction
>>> -
>>> > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>>> > > > INFO http-8182-2 org.gblx.action.common.CommonAction
>>> - SET_SESSION:
>>> > > > {user=org.gblx.entities.User@148b272,
>>> LOGIN_ATTEMPT=yes,
>>> > > > page=login.jsp}
>>> > > >
>>> > > >
>>> > > > is User 2 with the session of user 1. But I've a idea to test.
>>> > > >
>>> > > > Regards,
>>> > > >
>>> > > > JP
>>> > > >
>>> > > > 2008/5/28, Martin <mg...@hotmail.com>:
>>> > > > > Juan Pablo-
>>> > > > >
>>> > > > > 1st session
>>> > > > > .lands on index.jsp
>>> > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
>>> > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > {page=index.jsp,
>>> user=org.gblx.entities.User@1270107}
>>> > > > >
>>> > > > > .lands on login.jsp
>>> > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
>>> > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > {LOGIN_ATTEMPT=yes,
>>> user=org.gblx.entities.User@63a1ae,
>>> > > > > page=login.jsp}
>>> > > > >
>>> > > > > .lands on menu.jsp..
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > {page=menu.jsp,
>>> user=org.gblx.entities.User@145d424}
>>> > > > >
>>> > > > > 2nd session:
>>> > > > > lands on index.jsp..
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > {page=index.jsp,
>>> user=org.gblx.entities.User@17644c8}
>>> > > > >
>>> > > > > lands on login.jsp..
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > {user=org.gblx.entities.User@148b272,
>>> LOGIN_ATTEMPT=yes,
>>> > > > > page=login.jsp}
>>> > > > >
>>> > > > > .lands on welcome.jsp..
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>>> > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > {user=org.gblx.entities.User@1a84b38,
>>> > > > > req=org.gblx.entities.Request@19422d2,
>>> page=welcome.jsp}
>>> > > > >
>>> > > > > Saludos Cordiales!
>>> > > > > Martin
>>> > > > > ----- Original Message ----- From: "Juan Pablo Pizarro"
>>> > > > > <ju...@gmail.com>
>>> > > > > To: "Struts Users Mailing List" <us...@struts.apache.org>
>>> > > > > Sent: Wednesday, May 28, 2008 4:11 PM
>>> > > > > Subject: Are sessions confused?
>>> > > > >
>>> > > > >
>>> > > > > >
>>> > > > > > The problem:
>>> > > > > > I'm using two browsers into separate machines, so, I loged as "1"
>>> > > > in
>>> > > > > > a browser and when a login with user "2" in other browser (and
>>> > > > > > separate machine), I see logged es "1", then I press ctrl+f5 and
>>> > > > > > change to user "2", but if I don't press that, the session is > >
>>> > wrong.
>>> > > > > >
>>> > > > > > The following are my logs.
>>> > > > > >
>>> > > > > > ...
>>> > > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > > SET_HTTP_SESSION:
>>> 47DBA3C65D5111633FDEE12200214F2C
>>> > > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > > {page=index.jsp,
>>> user=org.gblx.entities.User@1270107}
>>> > > > > > ...
>>> > > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > > SET_HTTP_SESSION:
>>> 47DBA3C65D5111633FDEE12200214F2C
>>> > > > > > INFO http-8182-1
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > > {LOGIN_ATTEMPT=yes,
>>> user=org.gblx.entities.User@63a1ae,
>>> > > > > > page=login.jsp}
>>> > > > > > ...
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > > SET_HTTP_SESSION:
>>> 1F08BED6D2343E9DD5FF92860D6B5AE2
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > > {page=index.jsp,
>>> user=org.gblx.entities.User@17644c8}
>>> > > > > > ...
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > > SET_HTTP_SESSION:
>>> 1F08BED6D2343E9DD5FF92860D6B5AE2
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > > {user=org.gblx.entities.User@148b272,
>>> LOGIN_ATTEMPT=yes,
>>> > > > > > page=login.jsp}
>>> > > > > > ...
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > > SET_HTTP_SESSION:
>>> 1F08BED6D2343E9DD5FF92860D6B5AE2
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > > {user=org.gblx.entities.User@1a84b38,
>>> > > > > > req=org.gblx.entities.Request@19422d2,
>>> page=welcome.jsp}
>>> > > > > > ...
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > > SET_HTTP_SESSION:
>>> 47DBA3C65D5111633FDEE12200214F2C
>>> > > > > > INFO http-8182-2
>>> org.gblx.action.common.CommonAction -
>>> > > > > SET_SESSION:
>>> > > > > > {page=menu.jsp,
>>> user=org.gblx.entities.User@145d424}
>>> > > > > >
>>> > > > > > Steps:
>>> > > > > > 1.- The first 2 are the login with the user "1".
>>> > > > > > 2.- The next 2 are the login with user "2".
>>> > > > > > 3.- The next log is a operation with user "1" but it keeps the
>>> > > > > > session of user "2"!!!.
>>> > > > > > 4.- The last is the CTRL+F5 in the browser (in a separate PC) of >
>>> > > user
>>> > > > > > "1" and then, the http session is right.
>>> > > > > >
>>> > > > > > My hard:
>>> > > > > > - The project is running in a hp proliant 1100.
>>> > > > > > - 2 PC's 1 laptop. From thats, I open web browsers (IE6, FIREFOX).
>>> > > > > >
>>> > > > > > Soft:
>>> > > > > > - tomcat 6.0.16 running on w2003 server.
>>> > > > > > - strts2 2.0.11.
>>> > > > > > - I use spring and hibernate to get domain objects, but not
>>> > > > > > integrated with struts in a conf.
>>> > > > > >
>>> > > > > > Conf:
>>> > > > > >       <interceptors>
>>> > > > > >    <interceptor name="login"
>>> > > > > >
>>> class="org.gblx.interceptor.common.LoginInterceptor" />
>>> > > > > >
>>> > > > > >           <interceptor-stack name="defaultLoginStack">
>>> > > > > >               <interceptor-ref name="servlet-config" />
>>> > > > > >               <interceptor-ref name="params" />
>>> > > > > >               <interceptor-ref name="login" />
>>> > > > > >               <interceptor-ref name="prepare" />
>>> > > > > >               <interceptor-ref name="chain" />
>>> > > > > >               <interceptor-ref name="model-driven" />
>>> > > > > >               <interceptor-ref name="fileUpload" />
>>> > > > > >               <interceptor-ref name="static-params" />
>>> > > > > >               <interceptor-ref name="params" />
>>> > > > > >               <interceptor-ref name="conversionError" />
>>> > > > > >               <interceptor-ref name="validation" />
>>> > > > > >               <interceptor-ref name="workflow" />
>>> > > > > >           </interceptor-stack>
>>> > > > > >
>>> > > > > >           <interceptor-stack name="defaultInsecureStack">
>>> > > > > >               <interceptor-ref name="servlet-config" />
>>> > > > > >               <interceptor-ref name="params" />
>>> > > > > >               <interceptor-ref name="prepare" />
>>> > > > > >               <interceptor-ref name="chain" />
>>> > > > > >               <interceptor-ref name="model-driven" />
>>> > > > > >               <interceptor-ref name="fileUpload" />
>>> > > > > >               <interceptor-ref name="static-params" />
>>> > > > > >               <interceptor-ref name="params" />
>>> > > > > >               <interceptor-ref name="conversionError" />
>>> > > > > >               <interceptor-ref name="validation" />
>>> > > > > >               <interceptor-ref name="workflow" />
>>> > > > > >           </interceptor-stack>
>>> > > > > >       </interceptors>
>>> > > > > >
>>> > > > > >       <default-interceptor-ref name="defaultLoginStack" />
>>> > > > > >
>>> > > > > >
>>> > > > > >
>>> > > > > > Code:
>>> > > > > > I've a class called CommonAction. All Actions extends from it.
>>> > > > > >
>>> > > > > > public class CommonAction extends ActionSupport implements > > >
>>> SessionAware,
>>> > > > > > ParameterAware {
>>> > > > > >
>>> > > > > > private static final long serialVersionUID = 1L;
>>> > > > > > private static Logger logger =
>>> > > > > Logger.getLogger(CommonAction.class);
>>> > > > > > private Map session;
>>> > > > > > private Map parameters;
>>> > > > > >
>>> > > > > > public void setSession(Map session) {
>>> > > > > > HttpServletRequest request = (HttpServletRequest)
>>> > > > > >
>>> > > > >
>>> ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
>>> > > > > >
>>> > > > > > logger.info("SET_HTTP_SESSION: " + request.getSession().getId());
>>> > > > > > logger.info("SET_SESSION: " + session);
>>> > > > > > this.session = session;
>>> > > > > > }
>>> > > > > >
>>> > > > > > public Map getSession() {
>>> > > > > > HttpServletRequest request = (HttpServletRequest)
>>> > > > > >
>>> > > > >
>>> ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
>>> > > > > > logger.info("GET_HTTP_SESSION: " + request.getSession().getId());
>>> > > > > > logger.info("GET_SESSION: " + session);
>>> > > > > > return session;
>>> > > > > > }
>>> > > > > > public void setParameters(Map parameters) {
>>> > > > > > this.parameters = parameters;
>>> > > > > > }
>>> > > > > > public Map getParameters() {
>>> > > > > > return parameters;
>>> > > > > > }
>>> > > > > > }
>>> > > > > >
>>> > > > > >
>>> > > > > > I use two forms to modify the session. Through this.getSession() >
>>> > > and using
>>> > > > > >
>>> > > > > >
>>> > > > >
>>> ServletActionContext.getRequest().getSession().setAttribute("message",
>>> > > > > > getText("message_user_exists"));
>>> > > > > >
>>> > > > > >
>>> > > > > > I'm traied several things, but nothing. Any idea?
>>> > > > > >
>>> > > > > > Regards,
>>> > > > > >
>>> > > > > > JP
>>> > > > > >
>>> > > > > >
>>> > > > >
>>> ---------------------------------------------------------------------
>>> > > > > > To unsubscribe, e-mail:
>>> > > > > user-unsubscribe@struts.apache.org
>>> > > > > > For additional commands, e-mail: user-help@struts.apache.org
>>> > > > > >
>>> > > > > >
>>> > > > > >
>>> > > > >
>>> > > > >
>>> > > >
>>> > >
>>> > >
>>> >
>>> >
>>>
>>>
>>
>

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


Re: Are sessions confused?

Posted by Juan Pablo Pizarro <ju...@gmail.com>.
I've problems with sessions, but, is it an issue?.
The erratic behavior is this:

I opened a firefox and logged with user "1" (the login only put in
session a random number, the action no get a user from somewhere). The
page showed 28.
I opened a IE7 and logged with user "2". Showed 84.
I pressed CTRL+F5 (update the page and cache) in the firefox and it
updated the number to 84.

I repeat the experince in dev1 env. and in my workstation, and today,
in my computer (home).

To by sure, I used the struts2-blank-2.0.11.1.war expanded, obviusly,
with the minimal modifications to show the number, and
apache-tomcat-5.5.26 (and 6.X too).
I based my app on http://struts.apache.org/2.x/docs/bootstrap.html

Please, I need to know if the problem is an issue, is a bag strategy
to access to session, is a bag conf  or other.

Any idea?

Best Regards,

Juan Pablo

===============================
===============================

The LoginAction
===============================
public String execute() throws Exception {
	// This access way is from:
	// http://struts.apache.org/2.x/docs/accessing-application-session-request-objects.html
	Map session = (Map) ActionContext.getContext().get("session");
	session.put("user", (int) (Math.random() * 100));
	return SUCCESS;
}// excecute

Login Page
===============================
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
...
<s:form action="Login">
    <s:textfield key="username"/>
    <s:password key="password" />
    <s:submit/>
</s:form>
...

Struts.xml
===============================
<?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.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="false" />
    <include file="common.xml"/>
</struts>

Common.xml
===============================
<?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>
    <package name="common" namespace="/common" extends="struts-default">
        <action name="Login_*" method="{1}"
class="org.gblx.action.common.LoginAction">
            <result name="input">/common/Login.jsp</result>
            <result type="redirect-action">Menu</result>
        </action>
        <action name="Welcome">
            <result>/common/Welcome.jsp</result>
        </action>
        <action name="*" class="org.gblx.action.common.CommonSupport">
            <result>/common/{1}.jsp</result>
        </action>
    </package>
</struts>

Web.xml
===============================
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<display-name>...</display-name>
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>
			org.apache.struts2.dispatcher.FilterDispatcher
		</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>
</web-app>







2008/5/30 Juan Pablo Pizarro <ju...@gmail.com>:
> Gracias Martin!
>
> These are my logs.
>
> I put a message in the session, and.. the session is copied or is the
> same!!. I don't know how avoid that.
>
> I use the same web browser, and other to make the tests.
>
> I'm looking for a similar thread.. but nothing yet.
>
> Juan Pablo.
>
> ------------------------------------------------
>
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {page=menu.jsp, user=org.gblx.entities.User@145582}
>  INFO [http-8080-Processor23] (CommonAction.java:48) -
> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:49) - GET_SESSION:
> {page=menu.jsp, user=org.gblx.entities.User@145582}
>  INFO [http-8080-Processor23] (WelcomeAction.java:27) - USER: 1
>  INFO [http-8080-Processor24] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
> {req=org.gblx.entities.Request@1e514a9, page=index.jsp}
>  INFO [http-8080-Processor24] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
> {req=org.gblx.entities.Request@1e514a9, LOGIN_ATTEMPT=yes,
> page=login.jsp}
>  INFO [http-8080-Processor24] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
> {req=org.gblx.entities.Request@1e514a9, LOGIN_ATTEMPT=yes,
> message=Error!, the user isn't active., page=login.jsp}
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {req=org.gblx.entities.Request@1e514a9, page=menu.jsp,
> user=org.gblx.entities.User@1886a34, message=Error!, the user isn't
> active.}
>  INFO [http-8080-Processor23] (CommonAction.java:48) -
> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:49) - GET_SESSION:
> {req=org.gblx.entities.Request@1e514a9, page=menu.jsp,
> user=org.gblx.entities.User@1886a34, message=Error!, the user isn't
> active.}
>  INFO [http-8080-Processor23] (WelcomeAction.java:27) - USER: jpp
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {page=index.jsp, req=org.gblx.entities.Request@1bb6a69,
> message=Error!, the user isn't active.}
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {req=org.gblx.entities.Request@1bb6a69, LOGIN_ATTEMPT=yes,
> message=Error!, the user isn't active., page=login.jsp}
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {page=menu.jsp, req=org.gblx.entities.Request@1bb6a69, message=Error!,
> the user isn't active., user=org.gblx.entities.User@145582}
>  INFO [http-8080-Processor23] (CommonAction.java:48) -
> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:49) - GET_SESSION:
> {page=menu.jsp, req=org.gblx.entities.Request@1bb6a69, message=Error!,
> the user isn't active., user=org.gblx.entities.User@145582}
>  INFO [http-8080-Processor23] (WelcomeAction.java:27) - USER: 1
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {page=index.jsp, req=org.gblx.entities.Request@1fe4d40,
> message=Error!, the user isn't active.}
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {LOGIN_ATTEMPT=yes, req=org.gblx.entities.Request@1fe4d40,
> message=Error!, the user isn't active., page=login.jsp}
>  INFO [http-8080-Processor24] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor24] (CommonAction.java:40) - SET_SESSION:
> {page=menu.jsp, user=org.gblx.entities.User@1886a34,
> req=org.gblx.entities.Request@1fe4d40, message=Error!, the user isn't
> active.}
>  INFO [http-8080-Processor24] (CommonAction.java:48) -
> GET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor24] (CommonAction.java:49) - GET_SESSION:
> {page=menu.jsp, user=org.gblx.entities.User@1886a34,
> req=org.gblx.entities.Request@1fe4d40, message=Error!, the user isn't
> active.}
>  INFO [http-8080-Processor24] (WelcomeAction.java:27) - USER: jpp
>  INFO [http-8080-Processor23] (CommonAction.java:39) -
> SET_HTTP_SESSION: 12038D86D797FB8C9487E8CE271B731B
>  INFO [http-8080-Processor23] (CommonAction.java:40) - SET_SESSION:
> {req=org.gblx.entities.Request@ca1ada,
> user=org.gblx.entities.User@1886a34, page=welcome.jsp, message=Error!,
> the user isn't active.}
>
>
>
>
> 2008/5/29, Martin <mg...@hotmail.com>:
>> Hola!
>>
>> so if you execute the sessions separately
>> 1st run
>> index.jsp SET_HTTP_SESSION=
>> login.jsp  SET_HTTP_SESSION=
>> menu.jsp SET_HTTP_SESSION=
>> logout.jspSET_HTTP_SESSION=
>>
>> 2nd run
>> index.jsp SET_HTTP_SESSION=
>> login.jsp  SET_HTTP_SESSION=
>> menu.jsp SET_HTTP_SESSION=
>> logout.jsp SET_HTTP_SESSION=
>>
>> once you are able to verify the SessionIDs for session1
>> and different for session2
>> then run them together and compare the results..
>>
>> let me know if you have any questions
>>
>> Saludos Cordiales!
>> Martin
>> ----- Original Message ----- From: "Juan Pablo Pizarro"
>> <ju...@gmail.com>
>> To: "Martin" <mg...@hotmail.com>
>> Sent: Thursday, May 29, 2008 7:03 PM
>> Subject: Re: Are sessions confused?
>>
>>
>>
>> > I traied a lot of things.. now I'm reading things. Any idea?
>> >
>> > 2008/5/29, Juan Pablo Pizarro <ju...@gmail.com>:
>> >
>> > > The form that I use the user through the app is with a session object.
>> > > I put it in my login interceptor and ask for it in others.
>> > >
>> > > I'm searching attributes in the actions that are not used as fields in
>> > > the html, but until now, I didn't find.
>> > >
>> > > public String intercept(ActionInvocation invocation) throws Exception {
>> > >
>> > > final ActionContext context =
>> invocation.getInvocationContext();
>> > > HttpServletRequest request = (HttpServletRequest)
>> > >
>> context.get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
>> > >
>> > > session = request.getSession(true);
>> > >
>> > > User user = (User) session.getAttribute("user");
>> > > if (user == null || user.getLogin() == null) {
>> > >       String registerAttempt = (String)
>> > > request.getSession().getAttribute(REGISTER_ATTEMPT);
>> > >       String activateAttempt = (String) request.getSession()
>> > >
>> .getAttribute(ACTIVATE_ATTEMPT);
>> > >       String loginAttempt = (String)
>> request.getSession().getAttribute(
>> > >                                       LOGIN_ATTEMPT);
>> > >                       String page = (String)
>> request.getSession().getAttribute(PAGE);
>> > >
>> > >       if (registerAttempt == "yes" || activateAttempt == "yes"
>> > > || page == "index.jsp")
>> > >                return invocation.invoke();
>> > >
>> > >       if (loginAttempt == "yes") {
>> > >               if (processLoginAttempt(request, session)) {
>> > >
>> session.removeAttribute(LOGIN_ATTEMPT);
>> > >                       return "login-success";
>> > >               } else {
>> > >                       Object action = invocation.getAction();
>> > >                       if (action instanceof ValidationAware) {
>> > >                               ((ValidationAware) action)
>> > > .addActionError("Username or password incorrect.");
>> > >                       }// if
>> > >
>> > >               }// if-else
>> > >
>> > >       }// if
>> > >
>> > >       return "login-attempt";
>> > >       } else {
>> > >               return invocation.invoke();
>> > >       }
>> > > }
>> > >
>> > >
>> > > 2008/5/29, Juan Pablo Pizarro <ju...@gmail.com>:
>> > > > Ok, but the problem is that here
>> > > >
>> > > > lands on login.jsp..
>> > > > INFO http-8182-2 org.gblx.action.common.CommonAction
>> -
>> > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>> > > > INFO http-8182-2 org.gblx.action.common.CommonAction
>> - SET_SESSION:
>> > > > {user=org.gblx.entities.User@148b272,
>> LOGIN_ATTEMPT=yes,
>> > > > page=login.jsp}
>> > > >
>> > > >
>> > > > is User 2 with the session of user 1. But I've a idea to test.
>> > > >
>> > > > Regards,
>> > > >
>> > > > JP
>> > > >
>> > > > 2008/5/28, Martin <mg...@hotmail.com>:
>> > > > > Juan Pablo-
>> > > > >
>> > > > > 1st session
>> > > > > .lands on index.jsp
>> > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
>> > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > {page=index.jsp,
>> user=org.gblx.entities.User@1270107}
>> > > > >
>> > > > > .lands on login.jsp
>> > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
>> > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > {LOGIN_ATTEMPT=yes,
>> user=org.gblx.entities.User@63a1ae,
>> > > > > page=login.jsp}
>> > > > >
>> > > > > .lands on menu.jsp..
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_HTTP_SESSION: 47DBA3C65D5111633FDEE12200214F2C
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > {page=menu.jsp,
>> user=org.gblx.entities.User@145d424}
>> > > > >
>> > > > > 2nd session:
>> > > > > lands on index.jsp..
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > {page=index.jsp,
>> user=org.gblx.entities.User@17644c8}
>> > > > >
>> > > > > lands on login.jsp..
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > {user=org.gblx.entities.User@148b272,
>> LOGIN_ATTEMPT=yes,
>> > > > > page=login.jsp}
>> > > > >
>> > > > > .lands on welcome.jsp..
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_HTTP_SESSION: 1F08BED6D2343E9DD5FF92860D6B5AE2
>> > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > {user=org.gblx.entities.User@1a84b38,
>> > > > > req=org.gblx.entities.Request@19422d2,
>> page=welcome.jsp}
>> > > > >
>> > > > > Saludos Cordiales!
>> > > > > Martin
>> > > > > ----- Original Message ----- From: "Juan Pablo Pizarro"
>> > > > > <ju...@gmail.com>
>> > > > > To: "Struts Users Mailing List" <us...@struts.apache.org>
>> > > > > Sent: Wednesday, May 28, 2008 4:11 PM
>> > > > > Subject: Are sessions confused?
>> > > > >
>> > > > >
>> > > > > >
>> > > > > > The problem:
>> > > > > > I'm using two browsers into separate machines, so, I loged as "1"
>> > > > in
>> > > > > > a browser and when a login with user "2" in other browser (and
>> > > > > > separate machine), I see logged es "1", then I press ctrl+f5 and
>> > > > > > change to user "2", but if I don't press that, the session is > >
>> > wrong.
>> > > > > >
>> > > > > > The following are my logs.
>> > > > > >
>> > > > > > ...
>> > > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > > SET_HTTP_SESSION:
>> 47DBA3C65D5111633FDEE12200214F2C
>> > > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > > {page=index.jsp,
>> user=org.gblx.entities.User@1270107}
>> > > > > > ...
>> > > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > > SET_HTTP_SESSION:
>> 47DBA3C65D5111633FDEE12200214F2C
>> > > > > > INFO http-8182-1
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > > {LOGIN_ATTEMPT=yes,
>> user=org.gblx.entities.User@63a1ae,
>> > > > > > page=login.jsp}
>> > > > > > ...
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > > SET_HTTP_SESSION:
>> 1F08BED6D2343E9DD5FF92860D6B5AE2
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > > {page=index.jsp,
>> user=org.gblx.entities.User@17644c8}
>> > > > > > ...
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > > SET_HTTP_SESSION:
>> 1F08BED6D2343E9DD5FF92860D6B5AE2
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > > {user=org.gblx.entities.User@148b272,
>> LOGIN_ATTEMPT=yes,
>> > > > > > page=login.jsp}
>> > > > > > ...
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > > SET_HTTP_SESSION:
>> 1F08BED6D2343E9DD5FF92860D6B5AE2
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > > {user=org.gblx.entities.User@1a84b38,
>> > > > > > req=org.gblx.entities.Request@19422d2,
>> page=welcome.jsp}
>> > > > > > ...
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > > SET_HTTP_SESSION:
>> 47DBA3C65D5111633FDEE12200214F2C
>> > > > > > INFO http-8182-2
>> org.gblx.action.common.CommonAction -
>> > > > > SET_SESSION:
>> > > > > > {page=menu.jsp,
>> user=org.gblx.entities.User@145d424}
>> > > > > >
>> > > > > > Steps:
>> > > > > > 1.- The first 2 are the login with the user "1".
>> > > > > > 2.- The next 2 are the login with user "2".
>> > > > > > 3.- The next log is a operation with user "1" but it keeps the
>> > > > > > session of user "2"!!!.
>> > > > > > 4.- The last is the CTRL+F5 in the browser (in a separate PC) of >
>> > > user
>> > > > > > "1" and then, the http session is right.
>> > > > > >
>> > > > > > My hard:
>> > > > > > - The project is running in a hp proliant 1100.
>> > > > > > - 2 PC's 1 laptop. From thats, I open web browsers (IE6, FIREFOX).
>> > > > > >
>> > > > > > Soft:
>> > > > > > - tomcat 6.0.16 running on w2003 server.
>> > > > > > - strts2 2.0.11.
>> > > > > > - I use spring and hibernate to get domain objects, but not
>> > > > > > integrated with struts in a conf.
>> > > > > >
>> > > > > > Conf:
>> > > > > >       <interceptors>
>> > > > > >    <interceptor name="login"
>> > > > > >
>> class="org.gblx.interceptor.common.LoginInterceptor" />
>> > > > > >
>> > > > > >           <interceptor-stack name="defaultLoginStack">
>> > > > > >               <interceptor-ref name="servlet-config" />
>> > > > > >               <interceptor-ref name="params" />
>> > > > > >               <interceptor-ref name="login" />
>> > > > > >               <interceptor-ref name="prepare" />
>> > > > > >               <interceptor-ref name="chain" />
>> > > > > >               <interceptor-ref name="model-driven" />
>> > > > > >               <interceptor-ref name="fileUpload" />
>> > > > > >               <interceptor-ref name="static-params" />
>> > > > > >               <interceptor-ref name="params" />
>> > > > > >               <interceptor-ref name="conversionError" />
>> > > > > >               <interceptor-ref name="validation" />
>> > > > > >               <interceptor-ref name="workflow" />
>> > > > > >           </interceptor-stack>
>> > > > > >
>> > > > > >           <interceptor-stack name="defaultInsecureStack">
>> > > > > >               <interceptor-ref name="servlet-config" />
>> > > > > >               <interceptor-ref name="params" />
>> > > > > >               <interceptor-ref name="prepare" />
>> > > > > >               <interceptor-ref name="chain" />
>> > > > > >               <interceptor-ref name="model-driven" />
>> > > > > >               <interceptor-ref name="fileUpload" />
>> > > > > >               <interceptor-ref name="static-params" />
>> > > > > >               <interceptor-ref name="params" />
>> > > > > >               <interceptor-ref name="conversionError" />
>> > > > > >               <interceptor-ref name="validation" />
>> > > > > >               <interceptor-ref name="workflow" />
>> > > > > >           </interceptor-stack>
>> > > > > >       </interceptors>
>> > > > > >
>> > > > > >       <default-interceptor-ref name="defaultLoginStack" />
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Code:
>> > > > > > I've a class called CommonAction. All Actions extends from it.
>> > > > > >
>> > > > > > public class CommonAction extends ActionSupport implements > > >
>> SessionAware,
>> > > > > > ParameterAware {
>> > > > > >
>> > > > > > private static final long serialVersionUID = 1L;
>> > > > > > private static Logger logger =
>> > > > > Logger.getLogger(CommonAction.class);
>> > > > > > private Map session;
>> > > > > > private Map parameters;
>> > > > > >
>> > > > > > public void setSession(Map session) {
>> > > > > > HttpServletRequest request = (HttpServletRequest)
>> > > > > >
>> > > > >
>> ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
>> > > > > >
>> > > > > > logger.info("SET_HTTP_SESSION: " + request.getSession().getId());
>> > > > > > logger.info("SET_SESSION: " + session);
>> > > > > > this.session = session;
>> > > > > > }
>> > > > > >
>> > > > > > public Map getSession() {
>> > > > > > HttpServletRequest request = (HttpServletRequest)
>> > > > > >
>> > > > >
>> ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST);
>> > > > > > logger.info("GET_HTTP_SESSION: " + request.getSession().getId());
>> > > > > > logger.info("GET_SESSION: " + session);
>> > > > > > return session;
>> > > > > > }
>> > > > > > public void setParameters(Map parameters) {
>> > > > > > this.parameters = parameters;
>> > > > > > }
>> > > > > > public Map getParameters() {
>> > > > > > return parameters;
>> > > > > > }
>> > > > > > }
>> > > > > >
>> > > > > >
>> > > > > > I use two forms to modify the session. Through this.getSession() >
>> > > and using
>> > > > > >
>> > > > > >
>> > > > >
>> ServletActionContext.getRequest().getSession().setAttribute("message",
>> > > > > > getText("message_user_exists"));
>> > > > > >
>> > > > > >
>> > > > > > I'm traied several things, but nothing. Any idea?
>> > > > > >
>> > > > > > Regards,
>> > > > > >
>> > > > > > JP
>> > > > > >
>> > > > > >
>> > > > >
>> ---------------------------------------------------------------------
>> > > > > > To unsubscribe, e-mail:
>> > > > > user-unsubscribe@struts.apache.org
>> > > > > > For additional commands, e-mail: user-help@struts.apache.org
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > >
>> > >
>> > >
>> >
>> >
>>
>>
>

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