You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bugs_ <bu...@centrum.cz> on 2008/03/11 18:39:49 UTC
How to write variable in a Struts 2 tag?
I need rewrite jsp page from Struts 1 to Struts 2.
In Strust 1 is in the page something like this:
<% String variable = ... %>
<html:hidden property="foo" value="<%= variable %>"/>
I tried to rewrite it in Struts 2:
<% String variable = ... %>
<s:hidden name="foo" value="<%= variable %>" />
but this doesn't work. It return an error message: "According to TLD or
attribute directive in tag file, attribute value does not accept any
expressions"
I really don't know how to access variable in a Struts 2 tag?
I tried to read Struts 2 documentation, but I didn't find solution.
--
View this message in context: http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
Re: How to write variable in a Struts 2 tag?
Posted by javajunkie <hi...@googlemail.com>.
newton.dave wrote:
>
> --- bugs_ <bu...@centrum.cz> wrote:
>> I must find some good tutorial for ognl
>
> http://struts.apache.org/2.x/docs/ognl.html
> http://struts.apache.org/2.x/docs/ognl-basics.html
>
> http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/index.html
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
I don't normally register to reply or thank people for stuff, but this was
really annoying me, and your quote made me read OGNL doco's. Worked really
well, thanks.
Rod
--
View this message in context: http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p19638275.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
Re: How to write variable in a Struts 2 tag?
Posted by Dave Newton <ne...@yahoo.com>.
--- bugs_ <bu...@centrum.cz> wrote:
> I must find some good tutorial for ognl
http://struts.apache.org/2.x/docs/ognl.html
http://struts.apache.org/2.x/docs/ognl-basics.html
http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/index.html
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to write variable in a Struts 2 tag?
Posted by bugs_ <bu...@centrum.cz>.
%{#attr.varName} works fine. Thank you everybody
I am so happy :-D
I must find some good tutorial for ognl
newton.dave wrote:
>
> #attr.title will search through the various scopes.
>
> --- Laurie Harper <la...@holoweb.net> wrote:
>> If you're using 2.0.11.1, Struts tags do not allow JSTL expressions. You
>> need to use OGNL instead. I don't recall the OGNL syntax for accessing
>> page-scope variables, but it's probably something like %{title}, or
>> %{#title}. Check the OGNL documentation to be sure if someone else
>> doesn't chime in here.
>>
>> L.
>>
>> bugs_ wrote:
>> > But
>> > <%
>> > // declare or construct your variable...
>> > String title="My page";
>> > // set the variable in the page context under the variable name
>> "title"
>> > pageContext.setAttribute("title",title);
>> > %>
>> > <s:hidden name="foo" value='${title}' />
>> >
>> > This return the same error. Could you write me here any simple working
>> > example?
>> >
>> >
>> >
>> >
>> >
>> > Musachy Barroso wrote:
>> >> http://answers.google.com/answers/threadview?id=371241
>> >>
>> >> musachy
>> >>
>> >> On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
>> >>> I need rewrite jsp page from Struts 1 to Struts 2.
>> >>>
>> >>> In Strust 1 is in the page something like this:
>> >>> <% String variable = ... %>
>> >>> <html:hidden property="foo" value="<%= variable %>"/>
>> >>>
>> >>> I tried to rewrite it in Struts 2:
>> >>> <% String variable = ... %>
>> >>> <s:hidden name="foo" value="<%= variable %>" />
>> >>> but this doesn't work. It return an error message: "According to TLD
>> or
>> >>> attribute directive in tag file, attribute value does not accept any
>> >>> expressions"
>> >>>
>> >>> I really don't know how to access variable in a Struts 2 tag?
>> >>>
>> >>> I tried to read Struts 2 documentation, but I didn't find solution.
>> >>> --
>> >>> View this message in context:
>> >>>
>>
> http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
>> >>>
>> >>>
>> >>
>> >>
>> >> --
>> >> "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
>> >>
>> >>
>> >>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15995836.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
Re: How to write variable in a Struts 2 tag?
Posted by Dave Newton <ne...@yahoo.com>.
#attr.title will search through the various scopes.
--- Laurie Harper <la...@holoweb.net> wrote:
> If you're using 2.0.11.1, Struts tags do not allow JSTL expressions. You
> need to use OGNL instead. I don't recall the OGNL syntax for accessing
> page-scope variables, but it's probably something like %{title}, or
> %{#title}. Check the OGNL documentation to be sure if someone else
> doesn't chime in here.
>
> L.
>
> bugs_ wrote:
> > But
> > <%
> > // declare or construct your variable...
> > String title="My page";
> > // set the variable in the page context under the variable name "title"
> > pageContext.setAttribute("title",title);
> > %>
> > <s:hidden name="foo" value='${title}' />
> >
> > This return the same error. Could you write me here any simple working
> > example?
> >
> >
> >
> >
> >
> > Musachy Barroso wrote:
> >> http://answers.google.com/answers/threadview?id=371241
> >>
> >> musachy
> >>
> >> On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
> >>> I need rewrite jsp page from Struts 1 to Struts 2.
> >>>
> >>> In Strust 1 is in the page something like this:
> >>> <% String variable = ... %>
> >>> <html:hidden property="foo" value="<%= variable %>"/>
> >>>
> >>> I tried to rewrite it in Struts 2:
> >>> <% String variable = ... %>
> >>> <s:hidden name="foo" value="<%= variable %>" />
> >>> but this doesn't work. It return an error message: "According to TLD
> or
> >>> attribute directive in tag file, attribute value does not accept any
> >>> expressions"
> >>>
> >>> I really don't know how to access variable in a Struts 2 tag?
> >>>
> >>> I tried to read Struts 2 documentation, but I didn't find solution.
> >>> --
> >>> View this message in context:
> >>>
>
http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
> >>>
> >>>
> >>
> >>
> >> --
> >> "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
> >>
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> 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
Re: How to write variable in a Struts 2 tag?
Posted by Laurie Harper <la...@holoweb.net>.
If you're using 2.0.11.1, Struts tags do not allow JSTL expressions. You
need to use OGNL instead. I don't recall the OGNL syntax for accessing
page-scope variables, but it's probably something like %{title}, or
%{#title}. Check the OGNL documentation to be sure if someone else
doesn't chime in here.
L.
bugs_ wrote:
> But
> <%
> // declare or construct your variable...
> String title="My page";
> // set the variable in the page context under the variable name "title"
> pageContext.setAttribute("title",title);
> %>
> <s:hidden name="foo" value='${title}' />
>
> This return the same error. Could you write me here any simple working
> example?
>
>
>
>
>
> Musachy Barroso wrote:
>> http://answers.google.com/answers/threadview?id=371241
>>
>> musachy
>>
>> On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
>>> I need rewrite jsp page from Struts 1 to Struts 2.
>>>
>>> In Strust 1 is in the page something like this:
>>> <% String variable = ... %>
>>> <html:hidden property="foo" value="<%= variable %>"/>
>>>
>>> I tried to rewrite it in Struts 2:
>>> <% String variable = ... %>
>>> <s:hidden name="foo" value="<%= variable %>" />
>>> but this doesn't work. It return an error message: "According to TLD or
>>> attribute directive in tag file, attribute value does not accept any
>>> expressions"
>>>
>>> I really don't know how to access variable in a Struts 2 tag?
>>>
>>> I tried to read Struts 2 documentation, but I didn't find solution.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
>>>
>>>
>>
>>
>> --
>> "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
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to write variable in a Struts 2 tag?
Posted by bugs_ <bu...@centrum.cz>.
But
<%
// declare or construct your variable...
String title="My page";
// set the variable in the page context under the variable name "title"
pageContext.setAttribute("title",title);
%>
<s:hidden name="foo" value='${title}' />
This return the same error. Could you write me here any simple working
example?
Musachy Barroso wrote:
>
> http://answers.google.com/answers/threadview?id=371241
>
> musachy
>
> On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
>>
>> I need rewrite jsp page from Struts 1 to Struts 2.
>>
>> In Strust 1 is in the page something like this:
>> <% String variable = ... %>
>> <html:hidden property="foo" value="<%= variable %>"/>
>>
>> I tried to rewrite it in Struts 2:
>> <% String variable = ... %>
>> <s:hidden name="foo" value="<%= variable %>" />
>> but this doesn't work. It return an error message: "According to TLD or
>> attribute directive in tag file, attribute value does not accept any
>> expressions"
>>
>> I really don't know how to access variable in a Struts 2 tag?
>>
>> I tried to read Struts 2 documentation, but I didn't find solution.
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
>>
>>
>
>
>
> --
> "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
>
>
>
--
View this message in context: http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15994418.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
Re: How to write variable in a Struts 2 tag?
Posted by Dave Newton <ne...@yahoo.com>.
--- Musachy Barroso <mu...@gmail.com> wrote:
> I am trying to let people know about this new cool google thingy,
> that finds stuff for you :)
Riiiiight. Even if it did it'll never catch on.
Dave
>
> musachy
>
> On Tue, Mar 11, 2008 at 2:35 PM, Dave Newton <ne...@yahoo.com> wrote:
> > --- Musachy Barroso <mu...@gmail.com> wrote:
> > > http://answers.google.com/answers/threadview?id=371241
> >
> > Wow, you're like Meta-Google.
> >
> > Dave
> >
> >
> >
> > > On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
> > > >
> > > > I need rewrite jsp page from Struts 1 to Struts 2.
> > > >
> > > > In Strust 1 is in the page something like this:
> > > > <% String variable = ... %>
> > > > <html:hidden property="foo" value="<%= variable %>"/>
> > > >
> > > > I tried to rewrite it in Struts 2:
> > > > <% String variable = ... %>
> > > > <s:hidden name="foo" value="<%= variable %>" />
> > > > but this doesn't work. It return an error message: "According to
> TLD or
> > > > attribute directive in tag file, attribute value does not accept
> any
> > > > expressions"
> > > >
> > > > I really don't know how to access variable in a Struts 2 tag?
> > > >
> > > > I tried to read Struts 2 documentation, but I didn't find solution.
> > > > --
> > > > View this message in context:
> > >
> >
>
http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > "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
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
>
> --
> "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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to write variable in a Struts 2 tag?
Posted by Musachy Barroso <mu...@gmail.com>.
I am trying to let people know about this new cool google thingy, that
finds stuff for you :)
musachy
On Tue, Mar 11, 2008 at 2:35 PM, Dave Newton <ne...@yahoo.com> wrote:
> --- Musachy Barroso <mu...@gmail.com> wrote:
> > http://answers.google.com/answers/threadview?id=371241
>
> Wow, you're like Meta-Google.
>
> Dave
>
>
>
> > On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
> > >
> > > I need rewrite jsp page from Struts 1 to Struts 2.
> > >
> > > In Strust 1 is in the page something like this:
> > > <% String variable = ... %>
> > > <html:hidden property="foo" value="<%= variable %>"/>
> > >
> > > I tried to rewrite it in Struts 2:
> > > <% String variable = ... %>
> > > <s:hidden name="foo" value="<%= variable %>" />
> > > but this doesn't work. It return an error message: "According to TLD or
> > > attribute directive in tag file, attribute value does not accept any
> > > expressions"
> > >
> > > I really don't know how to access variable in a Struts 2 tag?
> > >
> > > I tried to read Struts 2 documentation, but I didn't find solution.
> > > --
> > > View this message in context:
> >
> http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
> > >
> > >
> >
> >
> >
> > --
> > "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
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
"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
Re: How to write variable in a Struts 2 tag?
Posted by Dave Newton <ne...@yahoo.com>.
--- Musachy Barroso <mu...@gmail.com> wrote:
> http://answers.google.com/answers/threadview?id=371241
Wow, you're like Meta-Google.
Dave
> On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
> >
> > I need rewrite jsp page from Struts 1 to Struts 2.
> >
> > In Strust 1 is in the page something like this:
> > <% String variable = ... %>
> > <html:hidden property="foo" value="<%= variable %>"/>
> >
> > I tried to rewrite it in Struts 2:
> > <% String variable = ... %>
> > <s:hidden name="foo" value="<%= variable %>" />
> > but this doesn't work. It return an error message: "According to TLD or
> > attribute directive in tag file, attribute value does not accept any
> > expressions"
> >
> > I really don't know how to access variable in a Struts 2 tag?
> >
> > I tried to read Struts 2 documentation, but I didn't find solution.
> > --
> > View this message in context:
>
http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
> >
> >
>
>
>
> --
> "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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to write variable in a Struts 2 tag?
Posted by Musachy Barroso <mu...@gmail.com>.
http://answers.google.com/answers/threadview?id=371241
musachy
On Tue, Mar 11, 2008 at 1:39 PM, bugs_ <bu...@centrum.cz> wrote:
>
> I need rewrite jsp page from Struts 1 to Struts 2.
>
> In Strust 1 is in the page something like this:
> <% String variable = ... %>
> <html:hidden property="foo" value="<%= variable %>"/>
>
> I tried to rewrite it in Struts 2:
> <% String variable = ... %>
> <s:hidden name="foo" value="<%= variable %>" />
> but this doesn't work. It return an error message: "According to TLD or
> attribute directive in tag file, attribute value does not accept any
> expressions"
>
> I really don't know how to access variable in a Struts 2 tag?
>
> I tried to read Struts 2 documentation, but I didn't find solution.
> --
> View this message in context: http://www.nabble.com/How-to-write-variable-in-a-Struts-2-tag--tp15981156p15981156.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
>
>
--
"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