tags:

views:

652

answers:

2

I would like to do something like <test:di id="someService" /`>
<% someService.methodCall(); %>

where <test:di
gets and instantiates a service bean and creates a scripting variable for use. similar to how jsp:usebean works for example <jsp:useBean id="someDate" class="java.util.Date" />
<%
someDate.getYear();

%>

how do i make my own objects available as a scritping variable?

+1  A: 

I think you're trying to write your own tag library.

Check out the tutorial at: http://www.ironflare.com/docs/tutorials/taglibs/

Edit: As Garth pointed out, you want to use the TagExtraInfo class after you've defined your tag lib. http://www.stardeveloper.com/articles/display.html?article=2001081601&amp;page=2

zmf
yup, trying to write my own taglib that sets the "id" attributes to be available as a scripting variable. any ideas?
joshjdevl
Garth Gilmour has the correct answer, i didn't read the question carefully enough. Use the Tag Extra Info class as he recommends.
zmf
+2  A: 

The way this is done in a Tag Library is by using a Tag Extra Info (TEI) class.

You can find an example here.

Garth Gilmour