[opencms-dev] How to add a javascript file to the template

pat sad hlp.psaad at gmail.com
Mon Sep 19 14:41:23 CEST 2005


Hy Joe, 

Thank you for your prompt reply, im sorry I took so long to reply,
since I was on vacation for a week.

I have applied the code for the js file but it gives me an error when
I do so. Here is the error message:

Unable to compile class for JSP 

An error occurred at line: 13 in the jsp file:
/WEB-INF/jsp/offline/system/modules/org.opencms.welcome/templates/empty.jsp
Generated servlet error: 
C:\tomcat\work\Catalina\localhost\opencms\org\apache\jsp\WEB_002dINF\jsp\offline\system\modules\org_opencms_welcome\templates\empty_jsp.java:131:
cannot resolve symbol
symbol : class CmsJspActionElement 
location: class
org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.org_opencms_welcome.templates.empty_jsp
CmsJspActionElement cms = new CmsJspActionElement(pageContext,
request, response);
^ 

An error occurred at line: 13 in the jsp file:
/WEB-INF/jsp/offline/system/modules/org.opencms.welcome/templates/empty.jsp
Generated servlet error: 
C:\tomcat\work\Catalina\localhost\opencms\org\apache\jsp\WEB_002dINF\jsp\offline\system\modules\org_opencms_welcome\templates\empty_jsp.java:131:
cannot resolve symbol
symbol : class CmsJspActionElement 
location: class
org.apache.jsp.WEB_002dINF.jsp.offline.system.modules.org_opencms_welcome.templates.empty_jsp
CmsJspActionElement cms = new CmsJspActionElement(pageContext,
request, response);
^ 
2 errors 

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

Here is my template file:

<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<cms:template element="head">
<cms:include element="head" editable="true" />
<html>
<head>
<title><cms:property name="Title" escapeHtml="true" /></title>
<style type="text/css">
<!--
<%@ include file="../resources/sheet.css" %>
-->
</style>
<%
CmsJspActionElement cms = new CmsJspActionElement(pageContext,
request, response);
%>
<script src="<%=cms.link("/system/modules/org.opencms.welcome/javascript/menu.js")%>"></script>
<cms:editable />

</head>
<body>
</cms:template>

<cms:template element="body">
<cms:include element="body" editable="true" />
</cms:template>

<cms:template element="foot">
</body>
</html>
</cms:template>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

I have included the js file in a new directory called javascript just
like you told me.

Is my issue the placement where I included my initialization of the
cms variable ?



On 9/12/05, Joe Desbonnet <jdesbonnet at gmail.com> wrote:
> A follow up to my last posting:
> 
> I notice that for Mozilla 
> <sript src="..." /> does not work as expected. It seems that the "/>" is not
> being interpreted as a close element. 
> 
> You should instead use
> <script src="...">
> </script>
> 
> Joe.
> 
>



More information about the opencms-dev mailing list