<c:set var="pageItems" value="${optionsForm.pageItems}"/>
<jsp:useBean id="pageItems" type="java.lang.Integer"/>
<pg:pager maxPageItems="<%= pageItems.intValue() %>">
  ...
</pg:pager>

Quoting Kris Barnhoorn <[EMAIL PROTECTED]>:

> Because my production environment is still in JSP 1.2.
> And it looks like it will be for some time. 
> 
> In other words I still have to work with tomcat 4.1 but I'm trying to
> make as much code possible ready for the upgrade to tomcat 5.
> 
> 
> Kris.
> 
> -----Oorspronkelijk bericht-----
> Van: Craig McClanahan [mailto:[EMAIL PROTECTED] 
> Verzonden: donderdag 29 juli 2004 18:25
> Aan: Struts Users Mailing List
> Onderwerp: Re: bean:define vs c:set
> 
> You are correct that <c:set> does not create a scripting variable, so
> you can't use the specified identifier in a scriptlet.  The question,
> though, is why are you still using a scriptlet expression?  Why not
> use an EL expression instead?
> 
>   <pg:pager maxPageItems="${pageItems}"/>
> 
> or, to avoid needing to do the <c:set> in the first place:
> 
>   <pg:pager maxPageItems="${optionsForm.pagItems}"/>
> 
> 
> The appropriate conversions will happen for you automatically.
> 
> Craig
> 
> 
> On Thu, 29 Jul 2004 17:24:35 +0200, Kris Barnhoorn <[EMAIL PROTECTED]>
> wrote:
> > Hi,
> > 
> > First of all I'd like to thank the contributors of this mailinglist.
> I'm
> > using struts for over 1.5 years now and i always found answers in
> > archives.
> > 
> > In this mailinglist and in the contrib/el there is often suggested
> that
> > the best way to prepare for smooth transition to JSP 2.0 is to use el
> > tags now and once the application runs on a container that supports
> JSP
> > 2.0 just change the links to the tags in web.xml.
> > 
> > Well found an inconvenience in the fact that the define tag was not
> > ported.
> > 
> > I have a value in a request variable that specifies who many page
> items
> > should be displayed on the page.
> > But because the pager tag hasn't el capabilities i had to use the
> define
> > tag like:
> > 
> > <bean:define id="pageItems" name="optionsForm" property="pageItems"
> > type="java.lang.Integer"/>
> > 
> > <pg:pager
> >         maxPageItems="<%=pageItems.intValue()%>">
> > 
> > //items
> > </pg:pager>
> > 
> > In the el way it should be like:
> > 
> > <c:set var="pageItems" value="${optionsForm.pageItems}"/>
> > 
> > <pg:pager
> >         maxPageItems="<%=pageItems.intValue()%>">
> > 
> > //items
> > </pg:pager>
> > 
> > --> but the var pageItems can't be use in scriptlet (not in c or c_rt)
> > 
> > So I guess is there a way to work around this without declaring the
> > pageItems like this?
> > 
> > <% Integer pageItems =
> >
> ((com.mycompany.foo.struts.OptionsForm)request.getAttribute("optionsForm
> > ")).getItems();%>
> > 
> > Thank you
> > Kris.

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to