You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by shenxiaojing <le...@sina.com> on 2009/10/17 04:14:28 UTC
about s:generator (struts 2.1.8) - new information
Hello, all
Sorry for sending my email twice, I found something wired.
Document from http://struts.apache.org/2.x/docs/generator.html
tell us:
var - The name to store the resultant iterator into page context, if such
name is supplied
but:
<s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator=","
var="myAtt" />
<%
java.util.Iterator i = (java.util.Iterator) request.getAttribute("myAtt ");
while(i != null && i.hasNext()) {
String s = (String) i.next(); %>
<%=s%> <br/>
<% }
%>
is right, and if I use pageContext.getAttribute("myAtt"); I got null.
Is there something wrong with my code?
Karen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
答复: about s:generator (struts 2.1.8) - new information
Posted by shenxiaojing <le...@sina.com>.
Actually, it's not my company code, just my tester.
I want to test if the "myAtt" in pageContext.
When I use pageContext, I got null from pageContext.getAttribute("myAttr");
When I tried request, I got the thing I want.
I just want to know the reason.
-----邮件原件-----
发件人: Chris Pratt [mailto:thechrispratt@gmail.com]
发送时间: 2009年10月17日 10:58
收件人: Struts Users Mailing List
主题: Re: about s:generator (struts 2.1.8) - new information
Personally, I don't allow scriplets in our company code, but the value is
placed in the page context, but you're trying to get it from the request
scope.
Try pageContext.getAttribute("myAtt").
(*Chris*)
On Fri, Oct 16, 2009 at 7:14 PM, shenxiaojing <le...@sina.com> wrote:
> Hello, all
>
> Sorry for sending my email twice, I found something wired.
>
> Document from http://struts.apache.org/2.x/docs/generator.html
> tell us:
> var - The name to store the resultant iterator into page context, if
such
> name is supplied
>
> but:
> <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator=","
> var="myAtt" />
> <%
> java.util.Iterator i = (java.util.Iterator) request.getAttribute("myAtt
> ");
> while(i != null && i.hasNext()) {
> String s = (String) i.next(); %>
> <%=s%> <br/>
> <% }
> %>
>
> is right, and if I use pageContext.getAttribute("myAtt"); I got null.
> Is there something wrong with my code?
>
>
>
> Karen
>
>
> ---------------------------------------------------------------------
> 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
reply: about s:generator (struts 2.1.8) - new information
Posted by shenxiaojing <le...@sina.com>.
Actually, it's not my company code, just my tester.
I want to test if the "myAtt" in pageContext.
When I use pageContext, I got null from pageContext.getAttribute("myAttr");
When I tried request, I got the thing I want.
I just want to know the reason.
-----邮件原件-----
发件人: Chris Pratt [mailto:thechrispratt@gmail.com]
发送时间: 2009年10月17日 10:58
收件人: Struts Users Mailing List
主题: Re: about s:generator (struts 2.1.8) - new information
Personally, I don't allow scriplets in our company code, but the value is
placed in the page context, but you're trying to get it from the request
scope.
Try pageContext.getAttribute("myAtt").
(*Chris*)
On Fri, Oct 16, 2009 at 7:14 PM, shenxiaojing <le...@sina.com> wrote:
> Hello, all
>
> Sorry for sending my email twice, I found something wired.
>
> Document from http://struts.apache.org/2.x/docs/generator.html
> tell us:
> var - The name to store the resultant iterator into page context, if
such
> name is supplied
>
> but:
> <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator=","
> var="myAtt" />
> <%
> java.util.Iterator i = (java.util.Iterator) request.getAttribute("myAtt
> ");
> while(i != null && i.hasNext()) {
> String s = (String) i.next(); %>
> <%=s%> <br/>
> <% }
> %>
>
> is right, and if I use pageContext.getAttribute("myAtt"); I got null.
> Is there something wrong with my code?
>
>
>
> Karen
>
>
> ---------------------------------------------------------------------
> 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: about s:generator (struts 2.1.8) - new information
Posted by Chris Pratt <th...@gmail.com>.
Personally, I don't allow scriplets in our company code, but the value is
placed in the page context, but you're trying to get it from the request
scope.
Try pageContext.getAttribute("myAtt").
(*Chris*)
On Fri, Oct 16, 2009 at 7:14 PM, shenxiaojing <le...@sina.com> wrote:
> Hello, all
>
> Sorry for sending my email twice, I found something wired.
>
> Document from http://struts.apache.org/2.x/docs/generator.html
> tell us:
> var - The name to store the resultant iterator into page context, if such
> name is supplied
>
> but:
> <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator=","
> var="myAtt" />
> <%
> java.util.Iterator i = (java.util.Iterator) request.getAttribute("myAtt
> ");
> while(i != null && i.hasNext()) {
> String s = (String) i.next(); %>
> <%=s%> <br/>
> <% }
> %>
>
> is right, and if I use pageContext.getAttribute("myAtt"); I got null.
> Is there something wrong with my code?
>
>
>
> Karen
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: about s:generator (struts 2.1.8) - new information
Posted by Alex Siman <al...@gmail.com>.
> iterator into page context
so try this:
jspContext.getAttribute("myAtt ");
leftkaren wrote:
>
> Hello, all
>
> Sorry for sending my email twice, I found something wired.
>
> Document from http://struts.apache.org/2.x/docs/generator.html
> tell us:
> var - The name to store the resultant iterator into page context, if
> such
> name is supplied
>
> but:
> <s:generator val="%{'aaa,bbb,ccc,ddd,eee'}" count="4" separator=","
> var="myAtt" />
> <%
> java.util.Iterator i = (java.util.Iterator) request.getAttribute("myAtt
> ");
> while(i != null && i.hasNext()) {
> String s = (String) i.next(); %>
> <%=s%> <br/>
> <% }
> %>
>
> is right, and if I use pageContext.getAttribute("myAtt"); I got null.
> Is there something wrong with my code?
>
>
>
> Karen
>
>
> ---------------------------------------------------------------------
> 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/about-s%3Agenerator-%28struts-2.1.8%29---new-information-tp25934754p25934910.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