heriyanto binduni wrote:
> dear all,
> i have a code in my jsp like this:
> <%=mybean.printDate()%>
>
> how can i convert this code into jstl?
> i'm trying to wrote like this:
> <c:out value="${mybean.printDate()}"/>
>
> but it gives me an error that i can using "(" or ")" in my jstl code(?).
> can you help me or suggest me how to convert my jsp code into jstl code?.

The EL in JSTL 1.0 only supports bean getter methods, called when you
use the property access operator, e.g ${myBean.myProperty}. One solution
is therefore to rename your printDate() method to getDate(). You can
then print the value with <c:out> and an expression like this:

   <c:out value="${mybean.date}"/>

JSP 2.0 will include a new revision of the EL with support for function
calls, but not support for arbitrary method calls on an object. An EL
function is a static method declared in the TLD, invoked with this
type of syntax: ${foo.myFunction(arg1, arg2}. For details, see the JSP
2.0 Proposed Final Draft:

   <http://java.sun.com/products/jsp/>

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to