Hi Xi,
It is not the problem of having included JavaScript, but having included a custom tag within the XML node of a custom tag - which is illegal.
<html:link href="javascriptOpenScript('display.jsp?id=<bean:write name="mybean" property="id" />');">my link</html:link> It's error!
If you really want to use the
Struts tags, then you have to use the Struts-EL tags instead of normal Struts Tags. With Struts-EL, the above tag is rewritten as follows:
<html-el:link href="javascriptOpenScript('display.jsp?id=${mybean.id}');">my link</html-el:link> Be sure to include jstl.jar, standard.jar (remember to use the Jakarta Taglibs version, not the Sun reference implementation jar), struts-el.jar in your web application classpath. These jars are needed in addition to the already existing jars from regular Struts.
The above tag uses the JSTL Expression language to simplify the tag.
Some more explanation about the Expression language is in order. Here goes:
Any value to be evaluated in a JSTL tag lies in ${ and } blocks. EL defines
several implicit objects much like
JSP defines its implicit objects. If the name of the variable in the ${ and } block does not match one of the implicit objects (in this case it does not), then EL searches the page, request, session application scopes in that order for the variable name specified. In the above code snippet, �mybean� is the name of an attribute in one of these scopes. id is a JavaBean property in the bean, mybean.
Hope this helps.
Srikanth Shenoy
Author: Struts Survival Guide - Basics to Best Practices ObjectSource Publications [ February 20, 2004: Message edited by: Srikanth Shenoy ]