You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Александр Высоков <no...@gmail.com> on 2011/07/01 14:43:56 UTC

strange behavior of s:a tag with s:include tag inside

Hello all.

I have two files.

test.jsp
--------
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<s:set name="depId" value="1" scope="page"/>
<s:a id="%{#attr.depId}"
href="javascript:some-javascript-method('%{#attr.depId}')">
<s:include value="test2.jsp"/>
</s:a>

test2.jsp
---------
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<s:set name="test" value="1" scope="page"/>
1

The result of call http://localhost:8080/myapp/test.jsp is:
<a id="1" href="javascript:some-javascript-method('')">1</a>

as we can see, second evaluation of %{#attr.depId} is missing (must be
javascript:some-javascript-method('1')). I cannot understand why it
happens.
But when I remove line <s:set name="test" value="1" scope="page"/> from
test2.jsp file and call again I receive correct result:
<a id="1" href="javascript:some-javascript-method('1')">1</a>

Is this a bug or I do not understand something in Struts2?

Re: Any examples struts1.x using json jquery ?

Posted by Dave Newton <da...@gmail.com>.
Then look at the examples they provide, there's nothing really struts
specific.

Dave
 On Jul 5, 2011 1:36 PM, "A. Lotfi" <ma...@yahoo.com> wrote:
> I am trying to display a grid from an action.
> thanks
>
> --- On Sat, 7/2/11, Dave Newton <da...@gmail.com> wrote:
>
> From: Dave Newton <da...@gmail.com>
> Subject: Re: Any examples struts1.x using json jquery ?
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Saturday, July 2, 2011, 12:42 PM
>
> A. Lotfi wrote:
>> Where can I find an example of struts1.x using jquery and json ?
>
> What specifically are you trying to do?
>
> The use of jQuery/JSON is framework-neutral, any jQuery tutorial
> should be trivially adaptable to S1.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: Any examples struts1.x using json jquery ?

Posted by "A. Lotfi" <ma...@yahoo.com>.
I am trying to display a grid from an action.
thanks

--- On Sat, 7/2/11, Dave Newton <da...@gmail.com> wrote:

From: Dave Newton <da...@gmail.com>
Subject: Re: Any examples struts1.x using json jquery ?
To: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Saturday, July 2, 2011, 12:42 PM

A. Lotfi wrote:
> Where can I find an example of struts1.x using jquery and json ?

What specifically are you trying to do?

The use of jQuery/JSON is framework-neutral, any jQuery tutorial
should be trivially adaptable to S1.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Any examples struts1.x using json jquery ?

Posted by Dave Newton <da...@gmail.com>.
A. Lotfi wrote:
> Where can I find an example of struts1.x using jquery and json ?

What specifically are you trying to do?

The use of jQuery/JSON is framework-neutral, any jQuery tutorial
should be trivially adaptable to S1.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: strange behavior of s:a tag with s:include tag inside

Posted by Łukasz Lenart <lu...@googlemail.com>.
Added for review
https://reviews.apache.org/r/1003/


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: strange behavior of s:a tag with s:include tag inside

Posted by Łukasz Lenart <lu...@googlemail.com>.
Done!

https://issues.apache.org/jira/browse/WW-3659

2011/7/3 Maurizio Cucchiara <ma...@gmail.com>:
> Hi Lukasz,
> could you share your patch through JIRA (there was an open ticket IIRC)?
>
> 2011/7/3 Łukasz Lenart <lu...@googlemail.com>
>>
>> I don't know why it happens that way. I've changed a bit templates by
>> moving some code from a-close.ftl to a.ftl and now it works as you've
>> been expecting. But that change broken few tests and can be backward
>> incompatible.
>>
>>
>> Regards
>> --
>> Łukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>> Warszawa JUG conference - Confitura http://confitura.pl/
>>
>>
>> 2011/7/1 Александр Высоков <no...@gmail.com>:
>> > Do you mean
>> > <s:url action="test2" var="ac"/>
>> > <s:include value="%{ac}"/>
>> > ?
>> >
>> > Tried. Empty body of a tag.
>> >
>> >
>> > 2 июля 2011 г. 0:56 пользователь Dave Newton
>> > <da...@gmail.com>написал:
>> >
>> >> 2011/7/1 Александр Высоков <no...@gmail.com>:
>> >> > Dave, if I expressed roughly, I am very sorry (my bad english is not
>> >> > good
>> >> enough).
>> >>
>> >> Nope, you're doing great :)
>> >>
>> >> Try using a link to an action in the <s:include> tag instead of a plain
>> >> JSP.
>> >>
>> >> For now you could just create a class-less action mapping that
>> >> forwards to the JSP you're currently using. See if the behavior
>> >> continues.
>> >>
>> >> Dave
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>
>
>
> --
> Maurizio Cucchiara
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: strange behavior of s:a tag with s:include tag inside

Posted by Maurizio Cucchiara <ma...@gmail.com>.
Hi Lukasz,
could you share your patch through JIRA (there was an open ticket IIRC)?

2011/7/3 Łukasz Lenart <lu...@googlemail.com>

> I don't know why it happens that way. I've changed a bit templates by
> moving some code from a-close.ftl to a.ftl and now it works as you've
> been expecting. But that change broken few tests and can be backward
> incompatible.
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
> Warszawa JUG conference - Confitura http://confitura.pl/
>
>
> 2011/7/1 Александр Высоков <no...@gmail.com>:
> > Do you mean
> > <s:url action="test2" var="ac"/>
> > <s:include value="%{ac}"/>
> > ?
> >
> > Tried. Empty body of a tag.
> >
> >
> > 2 июля 2011 г. 0:56 пользователь Dave Newton <davelnewton@gmail.com
> >написал:
> >
> >> 2011/7/1 Александр Высоков <no...@gmail.com>:
> >> > Dave, if I expressed roughly, I am very sorry (my bad english is not
> good
> >> enough).
> >>
> >> Nope, you're doing great :)
> >>
> >> Try using a link to an action in the <s:include> tag instead of a plain
> >> JSP.
> >>
> >> For now you could just create a class-less action mapping that
> >> forwards to the JSP you're currently using. See if the behavior
> >> continues.
> >>
> >> Dave
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>


-- 
Maurizio Cucchiara

Re: strange behavior of s:a tag with s:include tag inside

Posted by Łukasz Lenart <lu...@googlemail.com>.
I don't know why it happens that way. I've changed a bit templates by
moving some code from a-close.ftl to a.ftl and now it works as you've
been expecting. But that change broken few tests and can be backward
incompatible.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/


2011/7/1 Александр Высоков <no...@gmail.com>:
> Do you mean
> <s:url action="test2" var="ac"/>
> <s:include value="%{ac}"/>
> ?
>
> Tried. Empty body of a tag.
>
>
> 2 июля 2011 г. 0:56 пользователь Dave Newton <da...@gmail.com>написал:
>
>> 2011/7/1 Александр Высоков <no...@gmail.com>:
>> > Dave, if I expressed roughly, I am very sorry (my bad english is not good
>> enough).
>>
>> Nope, you're doing great :)
>>
>> Try using a link to an action in the <s:include> tag instead of a plain
>> JSP.
>>
>> For now you could just create a class-less action mapping that
>> forwards to the JSP you're currently using. See if the behavior
>> continues.
>>
>> Dave
>>
>> ---------------------------------------------------------------------
>> 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


Any examples struts1.x using json jquery ?

Posted by "A. Lotfi" <ma...@yahoo.com>.
Hi,

Where can I find an example of struts1.x using jquery and json ?

if you know other examples for struts2.x using json and jquery please post them I will appreciate your help.
thanks



Re: strange behavior of s:a tag with s:include tag inside

Posted by Александр Высоков <no...@gmail.com>.
Do you mean
<s:url action="test2" var="ac"/>
<s:include value="%{ac}"/>
?

Tried. Empty body of a tag.


2 июля 2011 г. 0:56 пользователь Dave Newton <da...@gmail.com>написал:

> 2011/7/1 Александр Высоков <no...@gmail.com>:
> > Dave, if I expressed roughly, I am very sorry (my bad english is not good
> enough).
>
> Nope, you're doing great :)
>
> Try using a link to an action in the <s:include> tag instead of a plain
> JSP.
>
> For now you could just create a class-less action mapping that
> forwards to the JSP you're currently using. See if the behavior
> continues.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
С уважением, Александр.

Re: strange behavior of s:a tag with s:include tag inside

Posted by Dave Newton <da...@gmail.com>.
2011/7/1 Александр Высоков <no...@gmail.com>:
> Dave, if I expressed roughly, I am very sorry (my bad english is not good enough).

Nope, you're doing great :)

Try using a link to an action in the <s:include> tag instead of a plain JSP.

For now you could just create a class-less action mapping that
forwards to the JSP you're currently using. See if the behavior
continues.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: strange behavior of s:a tag with s:include tag inside

Posted by Александр Высоков <no...@gmail.com>.
Dave, if I expressed roughly, I am very sorry (my bad english is not good
enough).
But if I misunderstand you, please explain more details. Thank you.

2 июля 2011 г. 0:41 пользователь Dave Newton <da...@gmail.com>написал:

> 2011/7/1 Александр Высоков <no...@gmail.com>:
> > So you try to tell me that in include's value must be only *.action?
>
> No, I don't.
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
С уважением, Александр.

Re: strange behavior of s:a tag with s:include tag inside

Posted by Dave Newton <da...@gmail.com>.
2011/7/1 Александр Высоков <no...@gmail.com>:
> So you try to tell me that in include's value must be only *.action?

No, I don't.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: strange behavior of s:a tag with s:include tag inside

Posted by Александр Высоков <no...@gmail.com>.
So you try to tell me that in include's value must be only *.action? I think
it is not.
Documentation says that in include's value attribute may be JSP (
http://struts.apache.org/2.2.3/docs/include.html)
And in examples almost everywhere is jsp-page in include... Strange...

But I've tried your version.
I've change test.jsp to:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<s:set var="depId" value="1" scope="page"/>
<s:a id="%{#attr.depId}"
action="javascript:some-javascript-method('%{#attr.depId}')" >
<s:include value="test2.action"/>
</s:a>

Add method to class sviborg.TestAction
public String test2() {
  return SUCCESS;
}

Add action mapping to struts.xml:
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="actions" extends="struts-default">
<action name="test" method="test" class="sviborg.TestAction">
<result name="success">/test.jsp</result>
</action>
<action name="test2" method="test2" class="sviborg.TestAction">
<result name="success">/test2.jsp</result>
</action>
</package>
</struts>

and then, after clicking on <a href="test.action">....</a> I received this:
<a id="1" href="javascript:some-javascript-method('1').action<http://localhost:8080/StrutsBugTest/javascript:some-javascript-method('1').action>
"></a>

Wrong again. No data in the a's body.

I think it is completely wrong. And how it corellates with Maurizio
Cucchiara's words about direct call of jsp by a browser. Include's value is
called by a browser? It is not. Strange...

By the way. I tried follows - I changed the s:a tag in test.jsp with s:div:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%> <%@ taglib uri="/struts-tags" prefix="s" %> <s:set
var="depId" value="1" scope="page"/> <s:div id="%{#attr.depId}"
title="javascript:some-javascript-method('%{#attr.depId}')" > <s:include
value="test2.jsp"/> </s:div>

and received CORRECT result:
<div id="1" title="javascript:some-javascript-method('1')">1</div>
Completely strange. Please tell me the difference between this cases...



1 июля 2011 г. 23:49 пользователь Dave Newton <da...@gmail.com>написал:

> But the include tag is still directly referencing a JSP, no?
>
> Dave
>
> On Friday, July 1, 2011, Александр Высоков <no...@gmail.com> wrote:
> > In attached in jira test-project (StrutsBugTest.war) index.html contains
> > link:
> > <a href="test.action">click</a>
> >
> > Action mapping file contains:
> > <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
> > Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
> > <struts>
> > <package name="actions" extends="struts-default">
> > <action name="test" method="test" class="sviborg.TestAction">
> > <result name="success">/test.jsp</result>
> > </action>
> > </package>
> > </struts>
> >
> > Result is the same - strange.
> >
> > May be we talking about different things. I think I do not understand you
> > completely.
> >
> > 1 июля 2011 г. 19:27 пользователь Maurizio Cucchiara <
> > maurizio.cucchiara@gmail.com> написал:
> >
> >> As I said before, don't call jsp directly via browser: rather you need
> to
> >> invoke a struts action that, after looked at your action mapping
> >> configuration, forward the request to your final jsp
> >>
> >> Maurizio Cucchiara
> >>
> >> Il giorno 01/lug/2011 16.30, "Александр Высоков" <no...@gmail.com> ha
> >> scritto:
> >> > I've created test project (attached StrutsBugTest.war) in jira. In
> that
> >> > project you can click to the link in index.html and see the same
> strange
> >> > behavior.
> >> >
> >> > 1 июля 2011 г. 17:28 пользователь Dave Newton <davelnewton@gmail.com
> >> >написал:
> >> >
> >> >> Unless the JSP is processed through an action, the original comment
> in
> >> the
> >> >> jira ticket is correct.
> >> >>
> >> >> Recall that a filter can stop processing a request, which is what
> >> happens
> >> >> if
> >> >> it's not a request that hits an action.
> >> >>
> >> >> Dave
> >> >> On Jul 1, 2011 8:59 AM, "Александр Высоков" <no...@gmail.com>
> wrote:
> >> >> > Hello all.
> >> >> >
> >> >> > I have two files.
> >> >> >
> >> >> > test.jsp
> >> >> > --------
> >> >> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> >> >> > pageEncoding="UTF-8"%>
> >> >> > <%@ taglib uri="/struts-tags" prefix="s" %>
> >> >> > <s:set name="depId" value="1" scope="page"/>
> >> >> > <s:a id="%{#attr.depId}"
> >> >> > href="javascript:some-javascript-method('%{#attr.depId}')">
> >> >> > <s:include value="test2.jsp"/>
> >> >> > </s:a>
> >> >> >
> >> >> > test2.jsp
> >> >> > ---------
> >> >> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> >> >> > pageEncoding="UTF-8"%>
> >> >> > <%@ taglib uri="/struts-tags" prefix="s" %>
> >> >> > <s:set name="test" value="1" scope="page"/>
> >> >> > 1
> >> >> >
> >> >> > The result of call http://localhost:8080/myapp/test.jsp is:
> >> >> > <a id="1" href="javascript:some-javascript-method('')">1</a>
> >> >> >
> >> >> > as we can see, second evaluation of %{#attr.depId} is missing (must
> be
> >> >> > javascript:some-javascript-method('1')). I cannot understand why it
> >> >> > happens.
> >> >> > But when I remove line <s:set name="test" value="1" scope="page"/>
> >> from
> >> >> > test2.jsp file and call again I receive correct result:
> >> >> > <a id="1" href="javascript:some-javascript-method('1')">1</a>
> >> >> >
> >> >> > Is this a bug or I do not understand something in Struts2?
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > С уважением, Александр.
> >>
> >
> >
> >
> > --
> > С уважением, Александр.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
С уважением, Александр.

Re: strange behavior of s:a tag with s:include tag inside

Posted by Dave Newton <da...@gmail.com>.
But the include tag is still directly referencing a JSP, no?

Dave

On Friday, July 1, 2011, Александр Высоков <no...@gmail.com> wrote:
> In attached in jira test-project (StrutsBugTest.war) index.html contains
> link:
> <a href="test.action">click</a>
>
> Action mapping file contains:
> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
> Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
> <package name="actions" extends="struts-default">
> <action name="test" method="test" class="sviborg.TestAction">
> <result name="success">/test.jsp</result>
> </action>
> </package>
> </struts>
>
> Result is the same - strange.
>
> May be we talking about different things. I think I do not understand you
> completely.
>
> 1 июля 2011 г. 19:27 пользователь Maurizio Cucchiara <
> maurizio.cucchiara@gmail.com> написал:
>
>> As I said before, don't call jsp directly via browser: rather you need to
>> invoke a struts action that, after looked at your action mapping
>> configuration, forward the request to your final jsp
>>
>> Maurizio Cucchiara
>>
>> Il giorno 01/lug/2011 16.30, "Александр Высоков" <no...@gmail.com> ha
>> scritto:
>> > I've created test project (attached StrutsBugTest.war) in jira. In that
>> > project you can click to the link in index.html and see the same strange
>> > behavior.
>> >
>> > 1 июля 2011 г. 17:28 пользователь Dave Newton <davelnewton@gmail.com
>> >написал:
>> >
>> >> Unless the JSP is processed through an action, the original comment in
>> the
>> >> jira ticket is correct.
>> >>
>> >> Recall that a filter can stop processing a request, which is what
>> happens
>> >> if
>> >> it's not a request that hits an action.
>> >>
>> >> Dave
>> >> On Jul 1, 2011 8:59 AM, "Александр Высоков" <no...@gmail.com> wrote:
>> >> > Hello all.
>> >> >
>> >> > I have two files.
>> >> >
>> >> > test.jsp
>> >> > --------
>> >> > <%@ page language="java" contentType="text/html; charset=UTF-8"
>> >> > pageEncoding="UTF-8"%>
>> >> > <%@ taglib uri="/struts-tags" prefix="s" %>
>> >> > <s:set name="depId" value="1" scope="page"/>
>> >> > <s:a id="%{#attr.depId}"
>> >> > href="javascript:some-javascript-method('%{#attr.depId}')">
>> >> > <s:include value="test2.jsp"/>
>> >> > </s:a>
>> >> >
>> >> > test2.jsp
>> >> > ---------
>> >> > <%@ page language="java" contentType="text/html; charset=UTF-8"
>> >> > pageEncoding="UTF-8"%>
>> >> > <%@ taglib uri="/struts-tags" prefix="s" %>
>> >> > <s:set name="test" value="1" scope="page"/>
>> >> > 1
>> >> >
>> >> > The result of call http://localhost:8080/myapp/test.jsp is:
>> >> > <a id="1" href="javascript:some-javascript-method('')">1</a>
>> >> >
>> >> > as we can see, second evaluation of %{#attr.depId} is missing (must be
>> >> > javascript:some-javascript-method('1')). I cannot understand why it
>> >> > happens.
>> >> > But when I remove line <s:set name="test" value="1" scope="page"/>
>> from
>> >> > test2.jsp file and call again I receive correct result:
>> >> > <a id="1" href="javascript:some-javascript-method('1')">1</a>
>> >> >
>> >> > Is this a bug or I do not understand something in Struts2?
>> >>
>> >
>> >
>> >
>> > --
>> > С уважением, Александр.
>>
>
>
>
> --
> С уважением, Александр.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: strange behavior of s:a tag with s:include tag inside

Posted by Александр Высоков <no...@gmail.com>.
In attached in jira test-project (StrutsBugTest.war) index.html contains
link:
<a href="test.action">click</a>

Action mapping file contains:
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="actions" extends="struts-default">
<action name="test" method="test" class="sviborg.TestAction">
<result name="success">/test.jsp</result>
</action>
</package>
</struts>

Result is the same - strange.

May be we talking about different things. I think I do not understand you
completely.

1 июля 2011 г. 19:27 пользователь Maurizio Cucchiara <
maurizio.cucchiara@gmail.com> написал:

> As I said before, don't call jsp directly via browser: rather you need to
> invoke a struts action that, after looked at your action mapping
> configuration, forward the request to your final jsp
>
> Maurizio Cucchiara
>
> Il giorno 01/lug/2011 16.30, "Александр Высоков" <no...@gmail.com> ha
> scritto:
> > I've created test project (attached StrutsBugTest.war) in jira. In that
> > project you can click to the link in index.html and see the same strange
> > behavior.
> >
> > 1 июля 2011 г. 17:28 пользователь Dave Newton <davelnewton@gmail.com
> >написал:
> >
> >> Unless the JSP is processed through an action, the original comment in
> the
> >> jira ticket is correct.
> >>
> >> Recall that a filter can stop processing a request, which is what
> happens
> >> if
> >> it's not a request that hits an action.
> >>
> >> Dave
> >> On Jul 1, 2011 8:59 AM, "Александр Высоков" <no...@gmail.com> wrote:
> >> > Hello all.
> >> >
> >> > I have two files.
> >> >
> >> > test.jsp
> >> > --------
> >> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> >> > pageEncoding="UTF-8"%>
> >> > <%@ taglib uri="/struts-tags" prefix="s" %>
> >> > <s:set name="depId" value="1" scope="page"/>
> >> > <s:a id="%{#attr.depId}"
> >> > href="javascript:some-javascript-method('%{#attr.depId}')">
> >> > <s:include value="test2.jsp"/>
> >> > </s:a>
> >> >
> >> > test2.jsp
> >> > ---------
> >> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> >> > pageEncoding="UTF-8"%>
> >> > <%@ taglib uri="/struts-tags" prefix="s" %>
> >> > <s:set name="test" value="1" scope="page"/>
> >> > 1
> >> >
> >> > The result of call http://localhost:8080/myapp/test.jsp is:
> >> > <a id="1" href="javascript:some-javascript-method('')">1</a>
> >> >
> >> > as we can see, second evaluation of %{#attr.depId} is missing (must be
> >> > javascript:some-javascript-method('1')). I cannot understand why it
> >> > happens.
> >> > But when I remove line <s:set name="test" value="1" scope="page"/>
> from
> >> > test2.jsp file and call again I receive correct result:
> >> > <a id="1" href="javascript:some-javascript-method('1')">1</a>
> >> >
> >> > Is this a bug or I do not understand something in Struts2?
> >>
> >
> >
> >
> > --
> > С уважением, Александр.
>



-- 
С уважением, Александр.

Re: strange behavior of s:a tag with s:include tag inside

Posted by Maurizio Cucchiara <ma...@gmail.com>.
As I said before, don't call jsp directly via browser: rather you need to
invoke a struts action that, after looked at your action mapping
configuration, forward the request to your final jsp

Maurizio Cucchiara

Il giorno 01/lug/2011 16.30, "Александр Высоков" <no...@gmail.com> ha
scritto:
> I've created test project (attached StrutsBugTest.war) in jira. In that
> project you can click to the link in index.html and see the same strange
> behavior.
>
> 1 июля 2011 г. 17:28 пользователь Dave Newton <davelnewton@gmail.com
>написал:
>
>> Unless the JSP is processed through an action, the original comment in
the
>> jira ticket is correct.
>>
>> Recall that a filter can stop processing a request, which is what happens
>> if
>> it's not a request that hits an action.
>>
>> Dave
>> On Jul 1, 2011 8:59 AM, "Александр Высоков" <no...@gmail.com> wrote:
>> > Hello all.
>> >
>> > I have two files.
>> >
>> > test.jsp
>> > --------
>> > <%@ page language="java" contentType="text/html; charset=UTF-8"
>> > pageEncoding="UTF-8"%>
>> > <%@ taglib uri="/struts-tags" prefix="s" %>
>> > <s:set name="depId" value="1" scope="page"/>
>> > <s:a id="%{#attr.depId}"
>> > href="javascript:some-javascript-method('%{#attr.depId}')">
>> > <s:include value="test2.jsp"/>
>> > </s:a>
>> >
>> > test2.jsp
>> > ---------
>> > <%@ page language="java" contentType="text/html; charset=UTF-8"
>> > pageEncoding="UTF-8"%>
>> > <%@ taglib uri="/struts-tags" prefix="s" %>
>> > <s:set name="test" value="1" scope="page"/>
>> > 1
>> >
>> > The result of call http://localhost:8080/myapp/test.jsp is:
>> > <a id="1" href="javascript:some-javascript-method('')">1</a>
>> >
>> > as we can see, second evaluation of %{#attr.depId} is missing (must be
>> > javascript:some-javascript-method('1')). I cannot understand why it
>> > happens.
>> > But when I remove line <s:set name="test" value="1" scope="page"/> from
>> > test2.jsp file and call again I receive correct result:
>> > <a id="1" href="javascript:some-javascript-method('1')">1</a>
>> >
>> > Is this a bug or I do not understand something in Struts2?
>>
>
>
>
> --
> С уважением, Александр.

RE: strange behavior of s:a tag with s:include tag inside

Posted by Martin Gainty <mg...@hotmail.com>.
Set.html:
String name Deprecated. Use 'var' insteadchange attribute name="depId"
   to     var="depId"

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.




> Date: Fri, 1 Jul 2011 18:30:22 +0400
> Subject: Re: strange behavior of s:a tag with s:include tag inside
> From: node81@gmail.com
> To: user@struts.apache.org
> 
> I've created test project (attached StrutsBugTest.war) in jira. In that
> project you can click to the link in index.html and see the same strange
> behavior.
> 
> 1 июля 2011 г. 17:28 пользователь Dave Newton <da...@gmail.com>написал:
> 
> > Unless the JSP is processed through an action, the original comment in the
> > jira ticket is correct.
> >
> > Recall that a filter can stop processing a request, which is what happens
> > if
> > it's not a request that hits an action.
> >
> > Dave
> >  On Jul 1, 2011 8:59 AM, "Александр Высоков" <no...@gmail.com> wrote:
> > > Hello all.
> > >
> > > I have two files.
> > >
> > > test.jsp
> > > --------
> > > <%@ page language="java" contentType="text/html; charset=UTF-8"
> > > pageEncoding="UTF-8"%>
> > > <%@ taglib uri="/struts-tags" prefix="s" %>
> > > <s:set name="depId" value="1" scope="page"/>
> > > <s:a id="%{#attr.depId}"
> > > href="javascript:some-javascript-method('%{#attr.depId}')">
> > > <s:include value="test2.jsp"/>
> > > </s:a>
> > >
> > > test2.jsp
> > > ---------
> > > <%@ page language="java" contentType="text/html; charset=UTF-8"
> > > pageEncoding="UTF-8"%>
> > > <%@ taglib uri="/struts-tags" prefix="s" %>
> > > <s:set name="test" value="1" scope="page"/>
> > > 1
> > >
> > > The result of call http://localhost:8080/myapp/test.jsp is:
> > > <a id="1" href="javascript:some-javascript-method('')">1</a>
> > >
> > > as we can see, second evaluation of %{#attr.depId} is missing (must be
> > > javascript:some-javascript-method('1')). I cannot understand why it
> > > happens.
> > > But when I remove line <s:set name="test" value="1" scope="page"/> from
> > > test2.jsp file and call again I receive correct result:
> > > <a id="1" href="javascript:some-javascript-method('1')">1</a>
> > >
> > > Is this a bug or I do not understand something in Struts2?
> >
> 
> 
> 
> -- 
> С уважением, Александр.
 		 	   		  

Re: strange behavior of s:a tag with s:include tag inside

Posted by Александр Высоков <no...@gmail.com>.
I've created test project (attached StrutsBugTest.war) in jira. In that
project you can click to the link in index.html and see the same strange
behavior.

1 июля 2011 г. 17:28 пользователь Dave Newton <da...@gmail.com>написал:

> Unless the JSP is processed through an action, the original comment in the
> jira ticket is correct.
>
> Recall that a filter can stop processing a request, which is what happens
> if
> it's not a request that hits an action.
>
> Dave
>  On Jul 1, 2011 8:59 AM, "Александр Высоков" <no...@gmail.com> wrote:
> > Hello all.
> >
> > I have two files.
> >
> > test.jsp
> > --------
> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> > pageEncoding="UTF-8"%>
> > <%@ taglib uri="/struts-tags" prefix="s" %>
> > <s:set name="depId" value="1" scope="page"/>
> > <s:a id="%{#attr.depId}"
> > href="javascript:some-javascript-method('%{#attr.depId}')">
> > <s:include value="test2.jsp"/>
> > </s:a>
> >
> > test2.jsp
> > ---------
> > <%@ page language="java" contentType="text/html; charset=UTF-8"
> > pageEncoding="UTF-8"%>
> > <%@ taglib uri="/struts-tags" prefix="s" %>
> > <s:set name="test" value="1" scope="page"/>
> > 1
> >
> > The result of call http://localhost:8080/myapp/test.jsp is:
> > <a id="1" href="javascript:some-javascript-method('')">1</a>
> >
> > as we can see, second evaluation of %{#attr.depId} is missing (must be
> > javascript:some-javascript-method('1')). I cannot understand why it
> > happens.
> > But when I remove line <s:set name="test" value="1" scope="page"/> from
> > test2.jsp file and call again I receive correct result:
> > <a id="1" href="javascript:some-javascript-method('1')">1</a>
> >
> > Is this a bug or I do not understand something in Struts2?
>



-- 
С уважением, Александр.

Re: strange behavior of s:a tag with s:include tag inside

Posted by Dave Newton <da...@gmail.com>.
Unless the JSP is processed through an action, the original comment in the
jira ticket is correct.

Recall that a filter can stop processing a request, which is what happens if
it's not a request that hits an action.

Dave
 On Jul 1, 2011 8:59 AM, "Александр Высоков" <no...@gmail.com> wrote:
> Hello all.
>
> I have two files.
>
> test.jsp
> --------
> <%@ page language="java" contentType="text/html; charset=UTF-8"
> pageEncoding="UTF-8"%>
> <%@ taglib uri="/struts-tags" prefix="s" %>
> <s:set name="depId" value="1" scope="page"/>
> <s:a id="%{#attr.depId}"
> href="javascript:some-javascript-method('%{#attr.depId}')">
> <s:include value="test2.jsp"/>
> </s:a>
>
> test2.jsp
> ---------
> <%@ page language="java" contentType="text/html; charset=UTF-8"
> pageEncoding="UTF-8"%>
> <%@ taglib uri="/struts-tags" prefix="s" %>
> <s:set name="test" value="1" scope="page"/>
> 1
>
> The result of call http://localhost:8080/myapp/test.jsp is:
> <a id="1" href="javascript:some-javascript-method('')">1</a>
>
> as we can see, second evaluation of %{#attr.depId} is missing (must be
> javascript:some-javascript-method('1')). I cannot understand why it
> happens.
> But when I remove line <s:set name="test" value="1" scope="page"/> from
> test2.jsp file and call again I receive correct result:
> <a id="1" href="javascript:some-javascript-method('1')">1</a>
>
> Is this a bug or I do not understand something in Struts2?

strange behavior of s:a tag with s:include tag inside

Posted by Александр Высоков <no...@gmail.com>.
Hello all.

I have two files.

test.jsp
--------
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<s:set name="depId" value="1" scope="page"/>
<s:a id="%{#attr.depId}"
href="javascript:some-javascript-method('%{#attr.depId}')">
<s:include value="test2.jsp"/>
</s:a>

test2.jsp
---------
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<s:set name="test" value="1" scope="page"/>
1

The result of call http://localhost:8080/myapp/test.jsp is:
<a id="1" href="javascript:some-javascript-method('')">1</a>

as we can see, second evaluation of %{#attr.depId} is missing (must be
javascript:some-javascript-method('1')). I cannot understand why it
happens.
But when I remove line <s:set name="test" value="1" scope="page"/> from
test2.jsp file and call again I receive correct result:
<a id="1" href="javascript:some-javascript-method('1')">1</a>

Is this a bug or I do not understand something in Struts2?