You cannot call static methods with JSTL 1.0. The simplest option is to create a JavaBean that you place in some application scope that wraps the static method call with a normal JavaBean getter instance method.

That being said, if you truly are formatting stuff then use the JSTL formatting tags if you can. If you are using JSTL 1.1 then you can create a function tag. Another alternative is to use the "bind" tag in the Jakarta Taglibs "unstandard" library ...

All in all, your best bet is probably one of the first two options (your own JavaBean or use JSTL fmt library).

Eric Schneider wrote:
Can you use the JSTL tags to call static API?

Something like this:

<c:out value="StringUtils.abbreviate(${aTopic.subject}, 30)"/>

Is this possible?

Thanks,
Eric

On Jun 26, 2004, at 5:48 AM, Pedro Salgado wrote:

On 04/06/26 1:33, "Michael McGrady" <[EMAIL PROTECTED]> wrote:

Looks like a test, Caroline!

At 05:20 PM 6/25/2004, Caroline Jen wrote:

I was told that JSTL can convert most of the Java code
in JSP.  I still have some problem with initializing
variables and if statments; for example, I do not know
how to write in JSTL of the following:

1. int i = 0;

<c:set var='i' value='0'/>

2. i++;

<c:set var='I' value='${i + 1}'/>

3. String prevArticle = null;

<c:set var='prevArticle'/>

4. if ( numberOfPosts - 1 == 1 ) {}

<c:if test='${numberOfPosts} - 1 == 1'>

5. if ( nextTopic != 0 )

<c:if test='${nextTopic != 0}'>

6. String threadID = String.valueOf( threadID_int );

<c:set var='threadID' value='${threadID_int}'/>

7. if ( threadRows.size() == 0 ) {}

<c:if test='${not empty threadRows}'>

8. if ( previousOffset >= 0 || nextOffset >= 0 ) {}

<c:if test='${previousOffset} >= 0 || ${nextOffset} >= 0'>

9. if ( prevArticle != null ) && ( !article.equals(
prevArticle ) ) {}

<c:if test='${not null ${prevArticle}} && ${article != prevArticle}'> The article != preArticle I am not quite sure.

Pedro Salgado


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




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



Reply via email to