Good call, but the problem there is obvious: it has to be a subpackage. So reusability is very limited, since you cannot use a package such as the java/main/img everywhere.
Thanks though :) Maybe my only option is writing a custom component for this (seemingly) trivial case? James Carman-3 wrote: > > You can do: > > <wicket:link> > img/bar.png > </wicket:link> > > However, the image itself must be in a subpackage of the > page/component's package called "img". That turns out to not be so > bad in our case, but it may be too much of a restriction for you. > > > On Sun, Feb 22, 2009 at 8:28 AM, svfarmer <twboer...@gmail.com> wrote: >> >> But that is not the static linking I'm after, since this still forces me >> to >> use a unique wicket:id in EVERY img tag, and in the java code. Unless I'm >> missing something here? :) >> >> Thanks, >> Tjeerd >> >> >> igor.vaynberg wrote: >>> >>> you can link to resources in the classpath using urlfor(new >>> resourcereference(class_in_resource_package, "resourcename")) >>> >>> -igor >>> >>> On Sat, Feb 21, 2009 at 4:45 PM, svfarmer <twboer...@gmail.com> wrote: >>>> >>>> Thanks for your reply! >>>> >>>> You are spot on there, I also figured out how to put my resources into >>>> WEB-INF/classes. These ARE published correctly when using Tomcat, but >>>> are >>>> indeed of no use for static linking. So this does not resolve my >>>> problem. >>>> >>>> -Tjeerd >>>> >>>> >>>> >>>> igor.vaynberg wrote: >>>>> >>>>> if they are static just put them into src/main/webapp - you should >>>>> have that dir. >>>>> >>>>> problem is whatever is in src/main/resources is copied into >>>>> WEB-INF/classes and servlet container does not stream anything out of >>>>> WEB-INF for security reasons. >>>>> >>>>> -igor >>>>> >>>>> On Sat, Feb 21, 2009 at 1:02 PM, svfarmer <twboer...@gmail.com> wrote: >>>>>> >>>>>> Alright so since we're talking about static resources that could >>>>>> easily >>>>>> be >>>>>> served by my servlet container, the problem actually is getting the >>>>>> /img/ >>>>>> directory into the context root. >>>>>> >>>>>> I put this in my pom.xml: >>>>>> >>>>>> <plugin> >>>>>> <groupId>org.apache.maven.plugins</groupId> >>>>>> <artifactId>maven-war-plugin</artifactId> >>>>>> <version>2.0</version> >>>>>> <configuration> >>>>>> <webResources> >>>>>> <resource> >>>>>> <!-- this is relative to the pom.xml directory >>>>>> --> >>>>>> <directory>src\main\resources</directory> >>>>>> </resource> >>>>>> </webResources> >>>>>> </configuration> >>>>>> </plugin> >>>>>> >>>>>> What this does is take the content of \src\main\resources and copy it >>>>>> into >>>>>> the context root when 'mvn install'-ing. This works fine, the >>>>>> directory >>>>>> structure in \target\mysoftware-1.0\ looks like this: >>>>>> >>>>>> mysoftware-1.0\img >>>>>> mysoftware-1.0\WEB-INF >>>>>> mysoftware-1.0\META-INF >>>>>> >>>>>> Generating a WAR file with either the Sysdeo Tomcat Plugin for >>>>>> Eclipse >>>>>> or >>>>>> with Maven works. All images work when serving this WAR in a >>>>>> container. >>>>>> >>>>>> However using 'mvn jetty:run' or running a Tomcat 5.5 server throught >>>>>> the >>>>>> plugin in Eclipse does not work. I do not know which directory Jetty >>>>>> uses >>>>>> for its context root, but my Tomcat Plugin is configured to use >>>>>> /target/mysoftware-1.0/ as its root. The Tomcat server functions >>>>>> nicely >>>>>> this >>>>>> way, and reflects all changes I make in my java or html files. But >>>>>> the >>>>>> images are broken! >>>>>> >>>>>> Looking in: >>>>>> \workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\mysoftware >>>>>> all I see are META-INF and WEB-INF >>>>>> >>>>>> Where did the img directory go? It gets skipped, but why? >>>>>> >>>>>> >>>>>> This turned out to be a bit more of a plumbing question than a Wicket >>>>>> problem, but I hope you will help me nonetheless! >>>>>> >>>>>> Thanks, >>>>>> Tjeerd >>>>>> >>>>>> >>>>>> svfarmer wrote: >>>>>>> >>>>>>> Hey everyone! >>>>>>> >>>>>>> I'm creating a basic webapp using Wicket, Tomcat 5.5, Maven 2 and >>>>>>> Eclipse. >>>>>>> I got it all to work together in the end, but now I'm having trouble >>>>>>> with >>>>>>> my images. >>>>>>> >>>>>>> Say I have a class Documents: >>>>>>> /src/main/java/XYZ/Frontend/Documents.java >>>>>>> And a directory with some images in the resources: >>>>>>> /src/main/resources/img/ >>>>>>> >>>>>>> In the Documents.html I now wish to repeatedly access these images, >>>>>>> preferably using the basic tag: >>>>>>> [img src="img/bar.png"] >>>>>>> >>>>>>> But this does not work. I don't mind moving the /img/ directory, but >>>>>>> I >>>>>>> haven't found a single place that allows me to access it from >>>>>>> everywhere, >>>>>>> except the context root of the tomcat server. However, I can't get >>>>>>> it >>>>>>> to >>>>>>> publish there. >>>>>>> >>>>>>> How do I get this to work with minimal java code? I have tried a >>>>>>> bunch >>>>>>> of >>>>>>> things in my pom.xml, but can't figure it out. I have everything set >>>>>>> up >>>>>>> as >>>>>>> described in this url: >>>>>>> http://spatula.net/blog/2007/04/how-to-make-eclipse-tomcat-maven-2-and.html >>>>>>> http://spatula.net/blog/2007/04/how-to-make-eclipse-tomcat-maven-2-and.html >>>>>>> >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/Linking-to-an-image-in-resources-with-just-html-tp22139793p22140542.html >>>>>> Sent from the Wicket - User mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>>>> >>>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Linking-to-an-image-in-resources-with-just-html-tp22139793p22142440.html >>>> Sent from the Wicket - User mailing list archive at Nabble.com. >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>> For additional commands, e-mail: users-h...@wicket.apache.org >>> >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Linking-to-an-image-in-resources-with-just-html-tp22139793p22146726.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > -- View this message in context: http://www.nabble.com/Linking-to-an-image-in-resources-with-just-html-tp22139793p22148426.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org