I am using the html java script tag in two parts, but some of it seems more cumbersome then it needs to be.

I have a validation.jsp file that contains:
<html:javascript dynamicJavascript="false" staticJavaScript="true"/>

it sole purpose is to provide the java script functions that are constant for all forms/validations in this application.

In the jsp where I want a for validates I have the required onSubmit handler etc, and I need to do two other things:
1) Generate the dynamic portion, which I do like this:
<html:javascript formName="myform" staticJavascript="false"/>
2) Make sure the static stuff is included. The obvious below does not work:
<SCRIPT language="Javascript1.1" src="validation.jsp"></SCRIPT>


It does not work because I store the validation.jsp file where I store all my other jsps, meaning they need to be addressed within the web app context. It is impossible to know this before hand, so one need's to resort to some java scriptlet inside the src attribute to dynamically construct the correct path.

Many of the other struts taglibs have options to have this transformation done for you (html:link comes to mind as one of them). It would be nice if one could write:
<html:javascript dynamicJavascript="false" staticJavascript="false" src="validation.jsp"/>
and have the above requested behavior happen. The idea here is that if both attributes are false, the only reasonable meaning would be to create an empty <SCRIPT> tag with the dynamically created src tag.
Of course this dynamic behavior would mess up existing code which depends on src's static implementation. I believe the check for both javascript attributes being false addresses this, but I would gladly accept a different/new attribute to use for this purpose.


In fact, many custom java script approaches have exactly such a script tag at the top of JSPs, and also need the scriptlet work around to allow the files themselves to be stored inside the context resources. Therefore, this could be a very useful feature without the validator even.

Godo idea, or am I missing something?


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to