You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Claudia Woestheinrich <cl...@vit.de> on 2004/02/17 10:19:41 UTC

trubble with session

Hello,

I am new. I have Problems with my first Struts Projekt.

After a User is logged in, I show a List of datas. This list I put
as Object in the session (session.put("list",datas))
When another side is opend I cant`t read the Parameter from the
Session, when the User don`t
accept Cookis in his Browser. In a old the Servlet-Programm, I used
the Method response.encode... to manage this
Problem. But in Struts I use in the Action-Class
actionMappping.findForwar("sucess") and der URL is definied in
the Struts config. How can I give the SessionId with? Or how can I
manage  this Problem?

Sorry, My English perfect.

Thanks
Claudia


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


Re: trubble with session

Posted by Mark Lowe <ma...@talk21.com>.
I doubt you need to store your list in the session, 'in this case' you 
can use the request without introducing additional work, complication, 
geeking and/or messing around.

request.setAttribute("list",data);

[data is the plural (datum singular), not that this matters I 
understood what you are saying]

forwards are not like writing to the response its not a new request 
unless you have

<action path="/myaction" ..
		<forward name="success" path="some.jsp" redirect="true" />
..
If you set redirect="false" then this wont create a new request when 
forwarding.


<example>
//in the action (com.mydomain.struts.FooAction)

ArrayList fooList = new ArrayList()
fooList.add("one");
fooList.add("two");

request.setAttribute("list",fooList);

return (mapping.findForward("success"));
..
//struts-config.xml
<action path="/myaction.do" type="com.mydomain.struts.FooAction">
	<forward name="success" path="foo.jsp" redirect="false" />
</action>
...
//jsp page (foo.jsp)

<logic:iterate id="foo" name="list">
	<bean:write property="foo" />
</logic:iterate>

or

<c:forEach var="foo" items="${list}">
	<c:out value="${foo}" />
</c:forEach>


</example>


On 17 Feb 2004, at 10:19, Claudia Woestheinrich wrote:

> Hello,
>
> I am new. I have Problems with my first Struts Projekt.
>
> After a User is logged in, I show a List of datas. This list I put
> as Object in the session (session.put("list",datas))
> When another side is opend I cant`t read the Parameter from the
> Session, when the User don`t
> accept Cookis in his Browser. In a old the Servlet-Programm, I used
> the Method response.encode... to manage this
> Problem. But in Struts I use in the Action-Class
> actionMappping.findForwar("sucess") and der URL is definied in
> the Struts config. How can I give the SessionId with? Or how can I
> manage  this Problem?
>
> Sorry, My English perfect.
>
> Thanks
> Claudia
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Antwort: trubble with session

Posted by Manuel Lenz <Lz...@viessmann.com>.




Hi Claudia,
why donĀ“t you put the list in a Struts FormBean?
You can get the list from the form bean easily, if you use the
"UseBean"-Tag in your jsp-Site.

Greetings,
Manuel



                                                                           
                                                                           
                                                                           
                                                                        An 
                                        struts-user@jakarta.apache.org     
 "Claudia Woestheinrich"                                             Kopie 
 <claudia.woestheinrich@vit.de                                             
 >                                                                   Thema 
 17.02.2004 10:19                       trubble with session               
                                                                           
                                                                           
                                                                           
                                                                           
       Bitte antworten an                                                  
  "Struts Users Mailing List"                                              
  <struts-user@jakarta.apache.                                             
              org>                                                         
                                                                           
                                                                           




Hello,

I am new. I have Problems with my first Struts Projekt.

After a User is logged in, I show a List of datas. This list I put
as Object in the session (session.put("list",datas))
When another side is opend I cant`t read the Parameter from the
Session, when the User don`t
accept Cookis in his Browser. In a old the Servlet-Programm, I used
the Method response.encode... to manage this
Problem. But in Struts I use in the Action-Class
actionMappping.findForwar("sucess") and der URL is definied in
the Struts config. How can I give the SessionId with? Or how can I
manage  this Problem?

Sorry, My English perfect.

Thanks
Claudia


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




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


RE: trubble with session

Posted by Navjot Singh <na...@net4india.net>.
When the user doesn't accept cookies, session is of no use.
After login, you can fill the data in request object and *forward* the
request.

look into RequestDispatcher.forward()

HTH
Navjot Singh

>-----Original Message-----
>From: Claudia Woestheinrich [mailto:claudia.woestheinrich@vit.de]
>Sent: Tuesday, February 17, 2004 2:50 PM
>To: struts-user@jakarta.apache.org
>Subject: trubble with session
>
>
>Hello,
>
>I am new. I have Problems with my first Struts Projekt.
>
>After a User is logged in, I show a List of datas. This list I put
>as Object in the session (session.put("list",datas))
>When another side is opend I cant`t read the Parameter from the
>Session, when the User don`t
>accept Cookis in his Browser. In a old the Servlet-Programm, I used
>the Method response.encode... to manage this
>Problem. But in Struts I use in the Action-Class
>actionMappping.findForwar("sucess") and der URL is definied in
>the Struts config. How can I give the SessionId with? Or how can I
>manage  this Problem?
>
>Sorry, My English perfect.
>
>Thanks
>Claudia
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


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