• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP losing its style after an ActionForward

 
Andy Deighton
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have some pages in an /admin/ folder of my Struts-enabled site. One page has a link which executes an Action, which then forwards back to the same page. However, upon the forward (using mapping.findForward()), the page loses its style completely! I.e. the CSS that was once applied making it all nice and sexy, seems to no longer work and the page is all bland.
I'm sure I've seen this before but have no idea why?
Any clues?
Andy
UK
 
Eric Sexton
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the part of the JSP that's losing it's style?
 
Andy Deighton
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric, I changed the ref to my stylesheet so it was absolute and it worked. I also suspect that if I'd used <html:base/>, then that would have helped too.
Regards,
Andy
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is quite a general point -- in Struts (& other MVC frameworks), the location of the JSP is the location where your view happens to sit. This does not necessarily have a lot to do with the request URL. In your JSPs, you should therefore avoid any relative path, because you cannot make assumptions about what you're going to be relative to. The Struts link and rewrite tags will help you here.
The only exceptions are static <@includes>. I'll leave the reason why as an exercise for the reader
- Peter
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic