Re: Adding CSS and JS to the components
Re: Adding CSS and JS to the components
- Subject: Re: Adding CSS and JS to the components
- From: Gavin Eadie <email@hidden>
- Date: Tue, 30 Sep 2008 11:38:17 -0400
On Sep 30, 2008, at 7:40 AM, Mike Schrag wrote:
ERXResponseRewriter
.addStylesheetResourceInHead(context().response(), context(), null,
"my.css");
ERXResponseRewriter.addScriptResourceInHead(context().response(),
context(), null, "my.js");
I would only use this method if you're injecting CSS/js from a
subcomponent. If you are adding it in your headerfooter component,
you should use:
<wo:ERXStyleSheet framework="whatever" filename="CSS/MyCSSFile.css"/>
<wo:ERXJavaScript framework="whataver" filename="Javascript/
MyJavascriptFile.css"/>
ms
I've been moving a moderately large application over to Wonder for a
while, and when I see a message like this that alerts me to a Wonder
usage I've not adopted, I make the change. I had my own personal
equivalents of "wo:ERXStyleSheet" and "wo:ERXJavaScript" in my page
header/footer template so I changed them to Wonder's with a view to
getting rid of my own.
ERXStyleSheet worked fine, but ERXJavaScript caused an error (see
trace below). I have a component called "MessageFormatter" (which is
a WOString-like component that performs substitutions -- essentially a
component form of java.text.MessageFormat), and it is used in a
component that is used by the page template. The hierarchy being:
PageTemplate
ERXJavaScript
<content>
PageTail
MessageFormatter
The error seems to indicate that a class with the same name in Xerces
has been pulled in to try satisfy that.
I believe that the component 'scanner' uses the base name and searches
through available frameworks till it finds that name. It seems that
using ERXJavaScript has caused the scanner to find the class
"org.apache.xerces.util.MessageFormatter" rather than
"com.ramsayconz.wocore.woc.MessageFormatter" -- I'm puzzled. The
'class order' has mine (CoreFrameworks) before Xerces (JavaXML), viz:
This with today's nightly WOLips and today's Wonder, WebObjects
5.4.3 .. Mac OS X 10.5.5 .. Gavin
___________________________________________
[2008-09-30 10:50:16,244 WorkerThread0] TRACE
marketplace.woc.PageTail : +++ constructor
[2008-09-30 10:50:16,273 WorkerThread0] WARN
NSLog : <com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
com.webobjects.foundation.NSForwardException
[java.lang.InstantiationException]
org
.apache
.xerces
.util.MessageFormatter:<org.apache.xerces.util.MessageFormatter> is an
abstract class. It can not be instantiated !
[2008-9-30 10:50:16 EDT] <WorkerThread0>
com.webobjects.foundation.NSForwardException
[java.lang.InstantiationException]
org
.apache
.xerces
.util.MessageFormatter:<org.apache.xerces.util.MessageFormatter> is an
abstract class. It can not be instantiated !
at
com
.webobjects
.foundation
._NSUtilities._explainInstantiationException(_NSUtilities.java:590)
at
com
.webobjects
.foundation._NSUtilities.instantiateObject(_NSUtilities.java:620)
at
com
.webobjects
.appserver
._private
.WOComponentDefinition
._componentInstanceInContext(WOComponentDefinition.java:557)
at
com
.webobjects
.appserver
._private
.WOComponentDefinition
.componentInstanceInContext(WOComponentDefinition.java:642)
at
com
.webobjects
.appserver
._private
.WOComponentReference
._pushComponentInContext(WOComponentReference.java:88)
at
com
.webobjects
.appserver
._private
.WOComponentReference.appendToResponse(WOComponentReference.java:134)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:
126)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at
com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:
1122)
at
com
.webobjects
.appserver
._private
.WOComponentReference.appendToResponse(WOComponentReference.java:135)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:
126)
at
com
.webobjects
.appserver
._private
.WOHTMLDynamicElement.appendToResponse(WOHTMLDynamicElement.java:447)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:
126)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:
126)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at
com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:
1122)
at
er
.extensions.components.ERXComponent.appendToResponse(ERXComponent.java:
106)
at
com
.webobjects
.appserver
._private
.WOComponentReference.appendToResponse(WOComponentReference.java:135)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendChildrenToResponse(WODynamicGroup.java:
126)
at
com
.webobjects
.appserver
._private.WODynamicGroup.appendToResponse(WODynamicGroup.java:136)
at
com.webobjects.appserver.WOComponent.appendToResponse(WOComponent.java:
1122)
at com.webobjects.appserver.WOSession.appendToResponse(WOSession.java:
1385)
at
er.extensions.appserver.ERXSession.appendToResponse(ERXSession.java:536)
at edu.umich.marketplace.Session.appendToResponse(Session.java:118)
at
com
.webobjects
.appserver.WOApplication.appendToResponse(WOApplication.java:1794)
at
er
.extensions
.appserver.ERXApplication.appendToResponse(ERXApplication.java:1546)
at
com
.webobjects
.appserver
._private
.WOComponentRequestHandler
._dispatchWithPreparedPage(WOComponentRequestHandler.java:242)
at
com
.webobjects
.appserver
._private
.WOComponentRequestHandler
._dispatchWithPreparedSession(WOComponentRequestHandler.java:298)
at
com
.webobjects
.appserver
._private
.WOComponentRequestHandler
._dispatchWithPreparedApplication(WOComponentRequestHandler.java:332)
at
com
.webobjects
.appserver
._private
.WOComponentRequestHandler
._handleRequest(WOComponentRequestHandler.java:369)
at
com
.webobjects
.appserver
._private
.WOComponentRequestHandler
.handleRequest(WOComponentRequestHandler.java:442)
at
com
.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:
1687)
at
er
.extensions
.appserver
.ERXApplication.dispatchRequestImmediately(ERXApplication.java:1646)
at
er
.extensions
.appserver.ERXApplication.dispatchRequest(ERXApplication.java:1610)
at
com
.ramsayconz
.wocore.CoreApplication.dispatchRequest(CoreApplication.java:147)
at
com
.webobjects
.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:144)
at
com
.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:
226)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.InstantiationException:
org.apache.xerces.util.MessageFormatter
at java.lang.Class.newInstance0(Class.java:335)
at java.lang.Class.newInstance(Class.java:303)
at
com
.webobjects
.foundation._NSUtilities.instantiateObject(_NSUtilities.java:616)
... 37 more
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden