Assigning JSP variable to the output of tags

Hi,

It is often useful to capture the output of an X-Application tag and assign it to a JSP variable (eg. for further manipulation, validation, etc).

Unfortunately this is not trivial because the output of the tag is written directly to the page.

ie. we cannot say
<%
String zip = <bdm:display select=“/Address/Zip”>
%>

Here is a custom tag that allows us to do this using the following syntax:

<test:SetVariable name=“zip” create=“true”>
<bdm:display select=“/Address/Zip”>
</test:SetVariable>

Value of zip = <%= zip %>

I’ve attached a sample web application in addition to the .tld and .jar files.

Hope this will be of some use to anyone looking for this kind of functionality.

Best Regards,
Puny Sen
setvariable.zip (7.87 KB)

I should have known it before rewriting many pages with JAVA API…
Anyway I think it’s really useful…