• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

html:img NullPointerException

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm very new to struts - but I'm trying to set up a basic form page, and I'd like to place an image on it. I created an images directory in the same directory as my .jsp page. Then, i created an img tag:

<html:img page='/images/header.jpg'/>

This gives me a NullPointerException, although the file is definitely there.

Here's the whole page:



I created a parallel html page that finds it just fine. Any ideas would be wonderful -
Thanks in advance,
~{S}~
[ September 30, 2005: Message edited by: sarahl2 ]
 
sarah smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I've found a bit more information on this - not sure if it will clarify at all. When I added the img tag and opened the jsp page it was actually running my java code with an empty request. Naturally, since it was a totally empty request, there were no parameters and hence the NullPointer. So, i went into my java and put a catch for that.

Now there's no null pointer, but there's also no image and no error message to give me any clue about why.

Any ideas? This one's makin' me crazy.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:

<html:image page="/whatever/myimage.gif"/>
 
sarah smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same error

Thank you for your suggestion, though.
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you use '/' to start out your URL, you must include the context root. if your app is 'mydomain.com/myapp/', your reference must be '/myapp/images/etc.gif'.
 
reply
    Bookmark Topic Watch Topic
  • New Topic