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

Reply via email to