This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

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: 42958
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
Have you checked out Aspose?
subject: Avoid Scriptlet..
It's not a secret anymore!