Using session object in JSP page

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Using session object in JSP page

NR031
Hi,


   I am having a session object created in the execute method of my action class like this :

Map sesion=ActionContext.getContext().getSession();
sesion.put("username",getUn());    /*getun() returns the username form field data*/

I want to use this session data in all my JSP pages, how to use the session data in my JSP? I am using Struts -2 and NetBeans 6.1 IDE.


Thnaks in advance,

Reply | Threaded
Open this post in threaded view
|

Re: Using session object in JSP page

Nils-Helge Garli
That depends on how you want to use it. The tag reference should give
you the information you need.

http://struts.apache.org/2.1.6/docs/tag-developers-guide.html
http://struts.apache.org/2.1.6/docs/ognl.html
http://struts.apache.org/2.1.6/docs/tag-syntax.html

Nils-H

On Mon, May 11, 2009 at 7:57 AM, NR031 <[hidden email]> wrote:

>
> Hi,
>
>
>   I am having a session object created in the execute method of my action
> class like this :
>
> Map sesion=ActionContext.getContext().getSession();
> sesion.put("username",getUn());    /*getun() returns the username form field
> data*/
>
> I want to use this session data in all my JSP pages, how to use the session
> data in my JSP? I am using Struts -2 and NetBeans 6.1 IDE.
>
>
> Thnaks in advance,
>
>
> --
> View this message in context: http://www.nabble.com/Using-session-object-in-JSP-page-tp23477472p23477472.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Locale specific stringlength validation, how?

Qunhuan Mei-2
In reply to this post by NR031
Hi,

 

Characters from one language often carry more information than another (e.g.
Chinese vs. English). To express a word/phrase/sentence string, different
locale may need different string length.

 

I was wondering if it is possible to have locale specific stringlength
validation using Struts' validation framework. The only approach I could
think of is checking the locale and string length in ActionSupport code and
output json block but I suppose this is not taking fully advantage of
Struts' validation framework.

 

Am I right or is there any better way?

 

Many thanks in advance,

 

Qunhuan

 

Reply | Threaded
Open this post in threaded view
|

Re: Using session object in JSP page

Łukasz Lenart
In reply to this post by NR031
2009/5/11 NR031 <[hidden email]>:
> Map sesion=ActionContext.getContext().getSession();
> sesion.put("username",getUn());    /*getun() returns the username form field
> data*/
>
> I want to use this session data in all my JSP pages, how to use the session
> data in my JSP? I am using Struts -2 and NetBeans 6.1 IDE.

<s:property value="#session.username"/>


Regards
--
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]