You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by NR031 <na...@cognizant.com> on 2009/05/11 07:57:28 UTC

Using session object in JSP page

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Locale specific stringlength validation, how?

Posted by Qunhuan Mei <qm...@qm18.wanadoo.co.uk>.
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

 


Re: Using session object in JSP page

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/5/11 NR031 <na...@cognizant.com>:
> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using session object in JSP page

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
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 <na...@cognizant.com> 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: 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