You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Upasana Sharma <sh...@gmail.com> on 2010/04/27 10:36:19 UTC
struts session help
Hi
I have a jsp that displays some data . To refine the data based on some
criteria i have two comboboxes.
<s:select list="categoryList" id="categorySelect" name="categorySelect"
onchange="getDisplayCriteria();" emptyOption="true"></s:select>
<s:select list="statusList" id="statusSelect" name="statusSelect"
onchange="getDisplayCriteria();" emptyOption="true"></s:select>
the lists for these two select option are obtained from the action that
calls the page containing them..
public String getAllLists() throws Exception{
ActionContext.getContext().put("categoryList", EComplaintType.values());
ActionContext.getContext().put("statusList", EComplaintStatus.values());
return SUCCESS;
}
but the problem is that whatever we put in this action context , those
values are for that action only.... if we call any other action that renders
the same jsp.... these values are not accessible.
there is some issue with session management what i feel... can u suggest how
should i approach this problem...... to make the values stay in the session
after the first call.
--
Thanks and Regards
Upasana Sharma
Re: struts session help
Posted by Ma...@hsbc.com.mx.
Hello:
You can use session context if implements SessionAware for example:
public class MyAction extends ActionSupport implements SessionAware {
private Map session;
public String execute() {
session.put("categoryList", EComplaintType.values())
return SUCCESS;
}
public void setSession(Map session) {
this.session = session;
}
}
SALUDOS!!
Mario HIDALGO
Java EE Consultant | Risk IT
___________________________________________________________________
Phone 1. (722) 2799997 ext. 783042
Phone 2. (55) 5721 2222 opción 3 , ext. 783042
Mobile. 0447223547727
Email. Mario.HIDALGO@hsbc.com.mx
Internet. HSBC México
___________________________________________________________________
Alex Rodriguez Lopez <al...@flordeutopia.pt>
27 Apr 2010 04:23 AM
Mail Size: 7370
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
Struts Users Mailing List <us...@struts.apache.org>
cc
Subject
Re: struts session help
Hi,
you could put/get from session like so:
ActionContext.getContext().getSession();
You can define a "parent" action (implementing preparable) with a
prepare() method that retrieves data and store it in session for later
(and check each time if data is already in session) and puts it into
properties with public getters that your other actions extending that
one (and jsps) will inherit.
Em 27-04-2010 09:36, Upasana Sharma escreveu:
> Hi
>
> I have a jsp that displays some data . To refine the data based on some
> criteria i have two comboboxes.
>
> <s:select list="categoryList" id="categorySelect" name="categorySelect"
> onchange="getDisplayCriteria();" emptyOption="true"></s:select>
>
> <s:select list="statusList" id="statusSelect" name="statusSelect"
> onchange="getDisplayCriteria();" emptyOption="true"></s:select>
>
>
> the lists for these two select option are obtained from the action that
> calls the page containing them..
>
> public String getAllLists() throws Exception{
>
> ActionContext.getContext().put("categoryList",
EComplaintType.values());
> ActionContext.getContext().put("statusList", EComplaintStatus.values());
> return SUCCESS;
> }
>
> but the problem is that whatever we put in this action context , those
> values are for that action only.... if we call any other action that
renders
> the same jsp.... these values are not accessible.
>
> there is some issue with session management what i feel... can u suggest
how
> should i approach this problem...... to make the values stay in the
session
> after the first call.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
"This email may contain confidential information, and is intended
only for the named recipient and may be privileged. Distribution or
copying of this email by anyone other than the named recipient is
prohibited. If you are not the named recipient, please notify us
immediately and permanently destroy this email and all copies of
it. Internet email is not private, secure, or reliable. No member
of the HSBC Group is liable for any errors or omissions in the
content or transmission of this email. Any opinions contained in
this email are solely those of the author, and unless clearly
indicated otherwise in writing, are not endorsed by any member of
the HSBC group."
“Este correo electrónico puede contener información confidencial,
sólo está dirigida al destinatario del mismo, la información puede
ser privilegiada. Está prohibido que cualquier persona distinta al
destinatario copie o distribuya este correo. Si usted no es el
destinatario, por favor notifíque esto de inmediato y destruya el
correo, lo mismo que todas las copias que existan del mismo. Los
correos electrónicos en internet, no son privados, seguros ni
confiables. Ningún miembro del Grupo HSBC será responsable de los
errores u omisiones en el contenido o transmisión de este correo
electrónico. Cualquier opinión contenida en este correo es
responsabilidad única y exclusiva del autor del mismo y, a menos
que lo contrario se indique claramente y por escrito, no está
respaldado por ningún miembro del Grupo HSBC”.
"This email may contain confidential information, and is intended
only for the named recipient and may be privileged. Distribution or
copying of this email by anyone other than the named recipient is
prohibited. If you are not the named recipient, please notify us
immediately and permanently destroy this email and all copies of
it. Internet email is not private, secure, or reliable. No member
of the HSBC Group is liable for any errors or omissions in the
content or transmission of this email. Any opinions contained in
this email are solely those of the author, and unless clearly
indicated otherwise in writing, are not endorsed by any member of
the HSBC group."
“Este correo electrónico puede contener información confidencial,
sólo está dirigida al destinatario del mismo, la información puede
ser privilegiada. Está prohibido que cualquier persona distinta al
destinatario copie o distribuya este correo. Si usted no es el
destinatario, por favor notifíque esto de inmediato y destruya el
correo, lo mismo que todas las copias que existan del mismo. Los
correos electrónicos en internet, no son privados, seguros ni
confiables. Ningún miembro del Grupo HSBC será responsable de los
errores u omisiones en el contenido o transmisión de este correo
electrónico. Cualquier opinión contenida en este correo es
responsabilidad única y exclusiva del autor del mismo y, a menos
que lo contrario se indique claramente y por escrito, no está
respaldado por ningún miembro del Grupo HSBC”.
Re: struts session help
Posted by Alex Rodriguez Lopez <al...@flordeutopia.pt>.
Hi,
you could put/get from session like so:
ActionContext.getContext().getSession();
You can define a "parent" action (implementing preparable) with a
prepare() method that retrieves data and store it in session for later
(and check each time if data is already in session) and puts it into
properties with public getters that your other actions extending that
one (and jsps) will inherit.
Em 27-04-2010 09:36, Upasana Sharma escreveu:
> Hi
>
> I have a jsp that displays some data . To refine the data based on some
> criteria i have two comboboxes.
>
> <s:select list="categoryList" id="categorySelect" name="categorySelect"
> onchange="getDisplayCriteria();" emptyOption="true"></s:select>
>
> <s:select list="statusList" id="statusSelect" name="statusSelect"
> onchange="getDisplayCriteria();" emptyOption="true"></s:select>
>
>
> the lists for these two select option are obtained from the action that
> calls the page containing them..
>
> public String getAllLists() throws Exception{
>
> ActionContext.getContext().put("categoryList", EComplaintType.values());
> ActionContext.getContext().put("statusList", EComplaintStatus.values());
> return SUCCESS;
> }
>
> but the problem is that whatever we put in this action context , those
> values are for that action only.... if we call any other action that renders
> the same jsp.... these values are not accessible.
>
> there is some issue with session management what i feel... can u suggest how
> should i approach this problem...... to make the values stay in the session
> after the first call.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: struts session help
Posted by Upasana Sharma <sh...@gmail.com>.
hi can u give me some example how to do that??
On Tue, Apr 27, 2010 at 2:09 PM, jaya krishna <kr...@gmail.com> wrote:
> HI upasana,
>
> y dont u store them in the application context variable??
>
> Regards,
> Jay
>
> On Tue, Apr 27, 2010 at 2:06 PM, Upasana Sharma <sh...@gmail.com>
> wrote:
>
> > Hi
> >
> > I have a jsp that displays some data . To refine the data based on some
> > criteria i have two comboboxes.
> >
> > <s:select list="categoryList" id="categorySelect" name="categorySelect"
> > onchange="getDisplayCriteria();" emptyOption="true"></s:select>
> >
> > <s:select list="statusList" id="statusSelect" name="statusSelect"
> > onchange="getDisplayCriteria();" emptyOption="true"></s:select>
> >
> >
> > the lists for these two select option are obtained from the action that
> > calls the page containing them..
> >
> > public String getAllLists() throws Exception{
> >
> > ActionContext.getContext().put("categoryList", EComplaintType.values());
> > ActionContext.getContext().put("statusList", EComplaintStatus.values());
> > return SUCCESS;
> > }
> >
> > but the problem is that whatever we put in this action context , those
> > values are for that action only.... if we call any other action that
> > renders
> > the same jsp.... these values are not accessible.
> >
> > there is some issue with session management what i feel... can u suggest
> > how
> > should i approach this problem...... to make the values stay in the
> session
> > after the first call.
> >
> > --
> > Thanks and Regards
> > Upasana Sharma
> >
>
Re: struts session help
Posted by jaya krishna <kr...@gmail.com>.
HI upasana,
y dont u store them in the application context variable??
Regards,
Jay
On Tue, Apr 27, 2010 at 2:06 PM, Upasana Sharma <sh...@gmail.com> wrote:
> Hi
>
> I have a jsp that displays some data . To refine the data based on some
> criteria i have two comboboxes.
>
> <s:select list="categoryList" id="categorySelect" name="categorySelect"
> onchange="getDisplayCriteria();" emptyOption="true"></s:select>
>
> <s:select list="statusList" id="statusSelect" name="statusSelect"
> onchange="getDisplayCriteria();" emptyOption="true"></s:select>
>
>
> the lists for these two select option are obtained from the action that
> calls the page containing them..
>
> public String getAllLists() throws Exception{
>
> ActionContext.getContext().put("categoryList", EComplaintType.values());
> ActionContext.getContext().put("statusList", EComplaintStatus.values());
> return SUCCESS;
> }
>
> but the problem is that whatever we put in this action context , those
> values are for that action only.... if we call any other action that
> renders
> the same jsp.... these values are not accessible.
>
> there is some issue with session management what i feel... can u suggest
> how
> should i approach this problem...... to make the values stay in the session
> after the first call.
>
> --
> Thanks and Regards
> Upasana Sharma
>