Hi Shawn, Thank you again for your very valueable help. I have happily solve the problem.
Regards, Hao >===== Original Message From Tag Libraries Users List <[EMAIL PROTECTED]> ===== >On Tue, 25 Jun 2002, Hao Ding wrote: > >> Hi, >> >> I have not got an idea to solve the problem below. Can anybody give me >> a hand? > >Hi Hao. Sorry for the delay. > >> The initial code is >> >> <%@ page import="mm.*" %> >> <jsp:useBean id="cate" scope="session" class="mm.CateBean" /> >> <jsp:useBean id="report" scope="page" class="mm.ReportBean" /> > >This code can stand if your goal is really to create the objects in a JSP >page. If you instead want to retrieve the objects as exposed by a >servlet, you need no analogue to this code in a page that uses JSTL; no >preparation is necessary to use a scoped variable (though we have talked >about adding a <declare> tag in future versions of JSP or JSTL to improve >data typing, much along the lines of Perl's 'use strict'). > >> <% >> int idx = report.getId(); >> mm.LData ld = cate.getLData(idx); >> %> >> >> How to translate the Java code into EL using JSTL core library? > >The first is straightforward; you may simply say '${report.id}' to >retrieve the result of the invocation to report.getId(). The latter is >trickier; JSTL's expression language isn't intended for method access. If >you must pass a value to a method, you may do any of the following things, >some of which are better than others: > > - continue to use a scriptlet > - write a custom tag > - provide the logic through a bean, where the parameter is set (using > perhaps the <c:set target="..." property="..." /> tag) as a bean > property, and the result is later retrieved from another bean property. > >Hope that helps, > >-- >Shawn Bayern >"JSTL in Action" http://www.jstlbook.com >(coming in July 2002 from Manning Publications) > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>