Search code examples
jsptagfile

jsp create scripting variable like jsp:usebean does


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?


Solution

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

    You can find an example here.