The solution to this problem is you first need to import the struts tag library using:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> in the .js file.
This line will be shown in error, ignore the same that is the feature of the IDE like netbeans or eclipse.
The path where the java script files are stored is given to the servlet engine so that at runtime the jsp tags will be interpreted properly. This can be done by adding the following servlet mapping and servlet elements in the web.xml file. Here the javascript files are stored at /scripts/dynamic/ location in the root folder
< servlet-mapping>
< servlet-name>JspServlet< /servlet-name>
< url-pattern>/scripts/dynamic/*< /url-pattern>
< /servlet-mapping>
Hence all the javascript part will be rendered to the client using the servlet engine which is able to interpret the struts jsp tags.