Perhaps template inheritance can help you here. I have a 'base' page that contains the HTML head tag that all my pages use. For example I have a Basepage.html:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/"> <head> <link rel="stylesheet" type="text/css" href="css/main.css"/> <link rel="stylesheet" type="text/css" href="css/header.css"/> </head> <body> <wicket:child /> ... and a Basepage.java (which does some stuff common to all pages, like setting a feedbackpanel or whatever you like to have for all pages) Then in my "real" pages I do like this RealPage.java public class Index extends BasePage { public Index() { ... but the real funny stuff goes on in the template for the real page: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/"> <head> <link rel="stylesheet" type="text/css" href="../../../../../../WebContent/css/main.css"/> <link rel="stylesheet" type="text/css" href="../../../../../../WebContent/css/header.css"/> </head> <body> <wicket:extend> Real content here </wicket:extend> </body> ... In this way the template can be edited as a static HTML and include the right CSS relative to the sources in the filesystem. In runtime wicket will discard anythiong outside the wicket:extend in the template and use the HTML from the 'base' page. Hope this can help you somewhat. Cheers, Johan M On 9/10/07, Jason Mihalick <[EMAIL PROTECTED]> wrote: > > <sigh> Ok, thanks for the help on this. My objective was to be able to have > a structure of HTML and resource dependencies (css, js, img, etc) that could > be easily edited in an HTML editor such that the editor doesn't have > problems resolving the resources and such that Wicket doesn't have problems > resolving the resources. From reading your comments and those of others, > however, this doesn't seem to be an easy task at all. So, I've gone back to > the standard Wicket approach where I have placed all HTML files along side > my Java classes and have located my resources (css, js, img, etc) at the > root of my web context (in the maven world, this is under the webapp dir, as > a sibling to WEB-INF). This keeps Wicket very happy at runtime, but makes > it difficult for me to edit my site using a HTML editor. Maybe this won't > be that big of a deal in practice. I guess I will find out in time. > > Thanks again guys! > > > igor.vaynberg wrote: > > > > oi. the basic problem is that WEB-INF is inaccessible via direct urls. > > this > > is because it houses stuff like classes and you dont want the user to have > > access to those. > > > > so there is a way to make it work, but it will involve wicket or another > > servlet streaming those static resources, which is a lot of overhead. > > > > my suggestion is to move all the css/js/foo out of WEB-INF > > > > -igor > > > > > > On 9/8/07, Jason Mihalick <[EMAIL PROTECTED]> wrote: > >> > >> > >> I've been searching the forums and wiki on this half the night and I just > >> can't figure out what I'm doing wrong here, so please bear with me if > >> there > >> is an obvious answer to this. > >> > >> Wicket is not finding my css or js resources when the application is > >> deployed. > >> > >> I followed the wiki instructions for Wicket 1.3 on how to "Control where > >> HTML files are loaded from" > >> ( > >> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html#ControlwhereHTMLfilesareloadedfrom-InWicket1.3 > >> ). > >> I have the following structure under WEB-INF: > >> > >> WEB-INF/ > >> +--- content/ > >> +--- css/ > >> +--- help/ > >> +--- img/ > >> +--- js/ > >> BasePage.html > >> Page1.html > >> Page2.html > >> etc. > >> web.xml > >> > >> In the init() method of my application class, I have added this code as > >> per > >> the wiki: > >> > >> IResourceSettings resourceSettings = this.getResourceSettings(); > >> resourceSettings.addResourceFolder( "WEB-INF/content" ); > >> resourceSettings.setResourceStreamLocator( new PathStripperLocator() > >> ); > >> > >> My implementation of the PathStripperLocator class matches that found on > >> the > >> wiki. > >> > >> When I view the source of Page1.html (which inherits from my BasePage) in > >> my > >> browser after wicket has served it, I see that Wicket is rewriting the > >> location of the css resources as follows: > >> > >> <link href="../css/styles.css" rel="stylesheet" type="text/css"/> > >> > >> I expected the href value to instead be "css/styles.css" (without the > >> "../"). > >> > >> What do I need to do here in order to make this work? > >> > >> Your help is greatly appreciated! > >> > >> -- > >> Jason > >> > >> > >> -- > >> View this message in context: > >> http://www.nabble.com/Locating-CSS-under-WEB-INF%2C-please-help-tf4408084.html#a12575952 > >> Sent from the Wicket - User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/Locating-CSS-under-WEB-INF%2C-please-help-tf4408084.html#a12592027 > Sent from the Wicket - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
