You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stanislaw Findeisen <sf...@students.mimuw.edu.pl> on 2003/07/17 15:30:42 UTC

IMAGE DISPLAY PROBLEM - PLEASE HELP!!

Hello,


I am having a simple problem regarding image displaying in a web 
application (.war).


My directory structure is:

MyWebApp.war
	- META-INF
	- WEB-INF
	- pages
		- graphics
			- MyPicture.gif
		- layout
			- upperBar.jsp


The problem is: HOW to display MyPicture.gif from upperBar.jsp?


I tried this:

	<html:img pageKey="graphics.MyPicture"/>


In properties file I have:

	graphics.MyPicture=/pages/graphics/MyPicture.gif


This works fine -- HTML generated contains this:

	<img src="/MyWebApp/pages/graphics/MyPicture.gif">


Unfortunately, when the browser tries to download the image I get this:

2003-07-17 15:17:05 org.apache.struts.action.RequestProcessor process
INFO: Processing a 'GET' for path '/pages/graphics/MyPicture'
2003-07-17 15:17:05 org.apache.struts.action.RequestProcessor processMapping
SEVERE: Invalid path /pages/graphics/MyPicture was requested


There are two questions arising here:


1). WHERE did the file extension go? Because I get:

	INFO: Processing a 'GET' for path '/pages/graphics/MyPicture'

and not

	INFO: Processing a 'GET' for path '/pages/graphics/MyPicture.gif'


2). WHY doesn't the image get loaded? I tried to refer it in a direct way:

	http://127.0.0.1:7001/MyWebApp/pages/graphics/MyPicture.gif

which of course didn't work either.


I am using Tomcat 4.1.24. My servlet is the 'default' servlet:

	<servlet-mapping>
		<servlet-name>MyWebApp</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>



Any help??
THANKS!!



-- Stanislaw Findeisen                  http://rainbow.mimuw.edu.pl/~sf

   Live life to the MAX.
   Follow JESUS.



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: IMAGE DISPLAY PROBLEM - PLEASE HELP!!

Posted by Nicolas De Loof <ni...@cgey.com>.
As your serlvet-mapping is setted to "<url-pattern>/</url-pattern>" every request is handled by Struts.

Struts RequestProcessor extracts the extension to get the action path to process.
request = "/MyWebApp/pages/graphics/MyPicture.gif"

When your request is handled, they're is no action-mapping for
"/MyWebApp/pages/graphics/MyPicture"


You should use ".do" url-pattern for Struts actions, so that other types are directly handled by HTTP server (or
container)

Nico.


>
> Hello,
>
>
> I am having a simple problem regarding image displaying in a web
> application (.war).
>
>
> My directory structure is:
>
> MyWebApp.war
> - META-INF
> - WEB-INF
> - pages
> - graphics
> - MyPicture.gif
> - layout
> - upperBar.jsp
>
>
> The problem is: HOW to display MyPicture.gif from upperBar.jsp?
>
>
> I tried this:
>
> <html:img pageKey="graphics.MyPicture"/>
>
>
> In properties file I have:
>
> graphics.MyPicture=/pages/graphics/MyPicture.gif
>
>
> This works fine -- HTML generated contains this:
>
> <img src="/MyWebApp/pages/graphics/MyPicture.gif">
>
>
> Unfortunately, when the browser tries to download the image I get this:
>
> 2003-07-17 15:17:05 org.apache.struts.action.RequestProcessor process
> INFO: Processing a 'GET' for path '/pages/graphics/MyPicture'
> 2003-07-17 15:17:05 org.apache.struts.action.RequestProcessor processMapping
> SEVERE: Invalid path /pages/graphics/MyPicture was requested
>
>
> There are two questions arising here:
>
>
> 1). WHERE did the file extension go? Because I get:
>
> INFO: Processing a 'GET' for path '/pages/graphics/MyPicture'
>
> and not
>
> INFO: Processing a 'GET' for path '/pages/graphics/MyPicture.gif'
>
>
> 2). WHY doesn't the image get loaded? I tried to refer it in a direct way:
>
> http://127.0.0.1:7001/MyWebApp/pages/graphics/MyPicture.gif
>
> which of course didn't work either.
>
>
> I am using Tomcat 4.1.24. My servlet is the 'default' servlet:
>
> <servlet-mapping>
> <servlet-name>MyWebApp</servlet-name>
> <url-pattern>/</url-pattern>
> </servlet-mapping>
>
>
>
> Any help??
> THANKS!!
>
>
>
> -- Stanislaw Findeisen                  http://rainbow.mimuw.edu.pl/~sf
>
>    Live life to the MAX.
>    Follow JESUS.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: IMAGE DISPLAY PROBLEM - PLEASE HELP!!

Posted by mo...@physics.gmu.edu.
Hey

I have used the usual image tag like this
 <img src="/GEST/images/attention.gif"...> and this works just fine for me

where GEST is the directory containing WEB-INF etc where your JSP reside

--Let me know if it works
  Mohan
> Hello,
>
>
> I am having a simple problem regarding image displaying in a web
> application (.war).
>
>
> My directory structure is:
>
> MyWebApp.war
> 	- META-INF
> 	- WEB-INF
> 	- pages
> 		- graphics
> 			- MyPicture.gif
> 		- layout
> 			- upperBar.jsp
>
>
> The problem is: HOW to display MyPicture.gif from upperBar.jsp?
>
>
> I tried this:
>
> 	<html:img pageKey="graphics.MyPicture"/>
>
>
> In properties file I have:
>
> 	graphics.MyPicture=/pages/graphics/MyPicture.gif
>
>
> This works fine -- HTML generated contains this:
>
> 	<img src="/MyWebApp/pages/graphics/MyPicture.gif">
>
>
> Unfortunately, when the browser tries to download the image I get this:
>
> 2003-07-17 15:17:05 org.apache.struts.action.RequestProcessor process
> INFO: Processing a 'GET' for path '/pages/graphics/MyPicture'
> 2003-07-17 15:17:05 org.apache.struts.action.RequestProcessor
> processMapping SEVERE: Invalid path /pages/graphics/MyPicture was
> requested
>
>
> There are two questions arising here:
>
>
> 1). WHERE did the file extension go? Because I get:
>
> 	INFO: Processing a 'GET' for path '/pages/graphics/MyPicture'
>
> and not
>
> 	INFO: Processing a 'GET' for path '/pages/graphics/MyPicture.gif'
>
>
> 2). WHY doesn't the image get loaded? I tried to refer it in a direct
> way:
>
> 	http://127.0.0.1:7001/MyWebApp/pages/graphics/MyPicture.gif
>
> which of course didn't work either.
>
>
> I am using Tomcat 4.1.24. My servlet is the 'default' servlet:
>
> 	<servlet-mapping>
> 		<servlet-name>MyWebApp</servlet-name>
> 		<url-pattern>/</url-pattern>
> 	</servlet-mapping>
>
>
>
> Any help??
> THANKS!!
>
>
>
> -- Stanislaw Findeisen                  http://rainbow.mimuw.edu.pl/~sf
>
>    Live life to the MAX.
>    Follow JESUS.
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: struts-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org