[opencms-dev] combining JSP an JavaScript + [edit: and CSS]

Scott Carlson scott at optionvue.com
Mon Feb 5 06:57:27 CET 2007

I do create CSS files from JSP's. But, the final output is static (i.e. from request to request, it is the same). I personally would not create CSS files that change from request to request.
If I were using a style that changed from page to page, I would set that style in the HEAD of each specific page. That allows the CSS file to be cached by the browser, and also allows for the dynamic changing of a few specific styles.
Even if style sheet files are properly loaded for each request, I think there might be side effects of the changing style sheets. For example, image displaying page A, then page B, then using the browser to display the previous page. Will page A display with page B style sheet? That would be my guess...


From: opencms-dev-bounces at opencms.org on behalf of Jonathan Woods
Sent: Sun 2/4/2007 6:17 AM
To: 'The OpenCms mailing list'
Subject: RE: [opencms-dev] combining JSP an JavaScript + [edit: and CSS]

It's not that unconventional - after all, all it means is there may need to be some element of the CSS which is dynamic.
However, you may find a problem if you expect a CSS to be loaded on each request.  Browsers tend to cache linked stylesheet files for longer than they're meant to, in my experience, so you can't reliably use a CSS for the purpose you describe.  Instead, you could make the background style part of the main page itself ("<body style="background: url(....)" ).


From: sfdbfoui at host2.scintillance.com [mailto:sfdbfoui at host2.scintillance.com] On Behalf Of Volkmar Emberger
Sent: 04 February 2007 08:17
To: The OpenCms mailing list
Subject: Re: [opencms-dev] combining JSP an JavaScript + [edit: and CSS]

do you think it is very "unconventional" if I mix JSP and CSS?

like different background images on every load of the css?

best regards volkmar

Scott Carlson schrieb: 

	The key is that the OpenCms type needs to be JSP. The extension in the
	name can still be "js" (i.e. it need not have a "jsp" extension).
	I do this all the time. In fact, all my normal jsp pages have an
	extension of "html" instead of "jsp". OpenCms is nice in the fact that
	it handles the complexity of using the "wrong" extension for jsp pages
	behind the scenes.
	-----Original Message-----
	From: opencms-dev-bounces at opencms.org
	[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Guillaume Lederrey
	Sent: Thursday, February 01, 2007 6:25 AM
	To: The OpenCms mailing list
	Subject: Re: [opencms-dev] combining JSP an JavaScript

		 I thought the cms-tags will be inserted with the information before


		script is sended to the client
		 so why is it working with css but not with javascript?

	  I havent tried it myself but ...
	  A ".js" file sould be treated as a simple resource, and should not
	be interpreted by OpenCms. If you want to have dynamic content inside
	you .js file, you should declare it as a JSP file. You can than
	include "myJavaScript.jsp" in your template and it should  work.
	   Good luck


Mit freundlichen Grüßen

Volkmar Emberger

e-tecture GmbH
Hirschstraße 2
76133 Karlsruhe

Tel: +49 721 570458-17
Fax: +49 721 1205468
volkmar.emberger at e-tecture.com

e-tecture GmbH
Darmstädter Landstraße 112
60598 Frankfurt am Main
Amtsgericht Frankfurt am Main
HRB 56449
Gesellschaft mit Sitz in Frankfurt am Main
Geschäftsführer: Christian Schwab

Diese e-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese e-Mail irrtuemlich erhalten
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese e-Mail. 
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser e-Mail ist nicht gestattet.

This e-Mail may contain confidential and/or privileged information. If you are not
the intended recipient (or have received this e-Mail in error) please notify the sender
immediately and destroy this e- Mail. Any unauthorized copying, disclosure or
distribution of the material in this e-Mail is strictly forbidden.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 8168 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20070204/542a6c0e/attachment.bin>

More information about the opencms-dev mailing list