The moose likes Struts and the fly likes Avoid Scriptlet.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Avoid Scriptlet.." Watch "Avoid Scriptlet.." New topic

Avoid Scriptlet..

Henrik Krievs
Ranch Hand

Joined: Jan 05, 2004
Posts: 60

I've a class with a static method in it. Is it possible for me to access this static method directly from jsp - without using scriptlet?

Best regards, Henrik
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You could write a tag that wraps around the method, and put it into a tag library.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If your web container supports JSP 2.0 (Tomcat 5, for example), You could also write a function that calls your static method. See Chapter 12 of Sun's J2EE Tutorial.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Avoid Scriptlet..
jQuery in Action, 3rd edition