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

Martin van den Bemt mvdb at ibl-software.nl
Mon Sep 19 14:52:57 CEST 2005


Add 
<%@ page import="org.opencms.jsp.CmsJspActionElement" %>
To the top of empty.jsp..

Mvgr,
Martin 

-----Oorspronkelijk bericht-----
Van: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] Namens pat sad
Verzonden: maandag 19 september 2005 14:41
Aan: joe at galway.net
CC: The OpenCms mailing list
Onderwerp: Re: [opencms-dev] How to add a javascript file to the template

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\off
line\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.te
mplates.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\off
line\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.te
mplates.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.
> 
>


_______________________________________________
This mail is send to you from the opencms-dev mailing list To change your
list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list