This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

On forwarding request to jsp, its CSS and JScript files aren't loading

 
crazy programmer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm calling a servlet from a JSP page and setting some Attributes in servlet and finally calling ANOTHER JSP using RequestDispatcher's forward method. the second JSP is loading, showing the attributes that I've passed to it but none of the STYLESHEETS or jQuery/JAVASCRIPT files are loading into the page.

Error Msg: Upon Element Inspection in Mozilla of the forwarded JSP page I'm getting following error msg .

The stylesheet .../java/tutorial/mystyle.css was not loaded because its MIME type, “text/html”, is not “text/css”.

And for javascript its showing SYNTAX ERROR msg.

Without this forwarding if the JSP page is run, both the CSS and JavaScript called on this page are loading.

I've tried adding mime-mapping in my web.xml for css but still its not working.

I tried calling the second JSP page separately without servlet forwarding everything is working fine, stylesheets and javascripts are all loading.

How can I load my CSS and Javascript during Request forwarding ??

Thanks in advance
 
sachin naikwadi
Greenhorn
Posts: 7
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
verify the relative path for all the css and js files referenced in your jsp.
if your problem still exists then better post your code here...


Regards,
Sachin
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64701
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to be using server-relative URLs for the resources. See the JspFaq for more details.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic