You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Farshad Rabbani <fa...@hotmail.com> on 2009/07/10 21:20:47 UTC
assigning a JSP variable a value coming from
Hi Everyone,
I am trying to create a java variable in the jsp scriplet and assign it a value coming from <s: property> tag
so for example
<%
int id = <s: property value="userId"/> ;
%>
I know the above is completely incorrect, but essentially, that is what I want to accomplish. Can anyone give me any idea how this can be done? Thanks.
My action class looks like:
public class UserAction extends ActionSupport implements SessionAware, DataSourceAware, UserAware, Preparable, ModelDriven
{
private User loggedInUser;
private Map session;
private DataSource dataSource;
private int userId;
public int getUserId()
{
return userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
_________________________________________________________________
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
RE: assigning a JSP variable a value coming from
Posted by Farshad Rabbani <fa...@hotmail.com>.
Hi Musachy,
I appreciate the assistance, it worked.
-Farshad
> Date: Fri, 10 Jul 2009 13:08:00 -0700
> Subject: Re: assigning a JSP variable a value coming from <s: property>
> From: musachy@gmail.com
> To: user@struts.apache.org
>
> do something like:
>
> <s:set var="myId" value="..." scope="page"/>
>
> then in your scriplet, get a reference to the page context (cant
> remember the API) and do a getAttribute("myId") on it.
>
> musachy
>
> On Fri, Jul 10, 2009 at 12:20 PM, Farshad
> Rabbani<fa...@hotmail.com> wrote:
> >
> > Hi Everyone,
> >
> >
> >
> >
> > I am trying to create a java variable in the jsp scriplet and assign it a value coming from <s: property> tag
> >
> > so for example
> >
> > <%
> >
> > int id = <s: property value="userId"/> ;
> >
> > %>
> >
> >
> >
> > I know the above is completely incorrect, but essentially, that is what I want to accomplish. Can anyone give me any idea how this can be done? Thanks.
> >
> >
> >
> >
> >
> > My action class looks like:
> > public class UserAction extends ActionSupport implements SessionAware, DataSourceAware, UserAware, Preparable, ModelDriven
> > {
> >
> >
> > private User loggedInUser;
> >
> > private Map session;
> > private DataSource dataSource;
> > private int userId;
> >
> >
> >
> >
> > public int getUserId()
> > {
> > return userId;
> > }
> >
> > public void setUserId(int userId)
> > {
> > this.userId = userId;
> > }
> >
> >
> >
> > _________________________________________________________________
> > Hotmail® has ever-growing storage! Don’t worry about storage limits.
> > http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009
Re: assigning a JSP variable a value coming from
Posted by Musachy Barroso <mu...@gmail.com>.
do something like:
<s:set var="myId" value="..." scope="page"/>
then in your scriplet, get a reference to the page context (cant
remember the API) and do a getAttribute("myId") on it.
musachy
On Fri, Jul 10, 2009 at 12:20 PM, Farshad
Rabbani<fa...@hotmail.com> wrote:
>
> Hi Everyone,
>
>
>
>
> I am trying to create a java variable in the jsp scriplet and assign it a value coming from <s: property> tag
>
> so for example
>
> <%
>
> int id = <s: property value="userId"/> ;
>
> %>
>
>
>
> I know the above is completely incorrect, but essentially, that is what I want to accomplish. Can anyone give me any idea how this can be done? Thanks.
>
>
>
>
>
> My action class looks like:
> public class UserAction extends ActionSupport implements SessionAware, DataSourceAware, UserAware, Preparable, ModelDriven
> {
>
>
> private User loggedInUser;
>
> private Map session;
> private DataSource dataSource;
> private int userId;
>
>
>
>
> public int getUserId()
> {
> return userId;
> }
>
> public void setUserId(int userId)
> {
> this.userId = userId;
> }
>
>
>
> _________________________________________________________________
> Hotmail® has ever-growing storage! Don’t worry about storage limits.
> http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org