Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 21st, 2006, 07:09 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to aadz5
Default ANT - Importing Images into WAR file in struts

Hiya Guys,

everytime I build my struts project, I copy my images over to the web-inf/Images directory. Everytime I load a jsp, the image file does not load. Here is the source of the html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Untitled</title>
</head>

<body>
<table>
    <tr>
        <td><img src="MNAMainPic.jpg" width="800" height="200"></td>
    </tr>
    <tr>
    </tr>
    <tr>
    </tr>
</table>


</body>
</html>

here is my ant file:


    <target name="resources">
        <copy todir="classes" includeEmptyDirs="no">
            <fileset dir="src/java">
            <patternset>
                <include name="**/*.conf"/>
                <include name="**/*.properties"/>
                <include name="**/*.xml"/>
            </patternset>
            </fileset>
        </copy>
        <copy todir="Images" includeEmptyDirs="no">
            <fileset dir="Images">
                <patternset>
                    <include name="**/*.swf"/>
                    <include name="**/*.gif"/>
                    <include name="**/*.jpg"/>
                </patternset>
            </fileset>
        </copy>
    </target>

what am I doing wrong?

Thanks

Adz - Its all about the JSPs baby!
__________________
Adz - Learning The J2EE Ways.
 
Old January 21st, 2006, 08:14 PM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Two things:

1) Open your .war in WinZip (or WinRAR) and verify that the images are being included.
2) Change the src URL to "Images/MNAMainPic.jpg"

If that fails, try running an HTTP monitor such as Charles (http://www.xk72.com/charles/) to see what image URL is being fetched and what error message the server is returning.

Jon Emerson
http://www.jonemerson.net/





Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying images in jsp using struts vijayalexander JSP Basics 0 November 6th, 2006 09:46 AM
New War File Will Not Replace Old One rkaplan Apache Tomcat 1 February 25th, 2005 05:45 AM
WAR file gauravchhabra9111 Servlets 1 February 11th, 2005 08:13 AM
WAR file gauravchhabra9111 Apache Tomcat 1 January 27th, 2005 12:34 AM
Extracting contents of a war file.. Pallav J2EE 1 September 24th, 2004 12:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.