aspose file tools*
The moose likes JSP and the fly likes JSP Not able to Identify the JS, CSS file path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Not able to Identify the JS, CSS file path" Watch "JSP Not able to Identify the JS, CSS file path" New topic
Author

JSP Not able to Identify the JS, CSS file path

vijay sachin
Greenhorn

Joined: Jan 18, 2011
Posts: 23
Hi All,

I have one strange issue, JSP cannot Identify the JS, CSS file path when URL pattern is /*. Let me explain in detail.

Irrespective of relative path my application should have to call Home.jsp. So for that I have specified URL pattern as /*. This logic is working fine.
The application is calling JSP page but It cannot call the JS file. In the below Sample code I try to print two alert massages. But I am able to see only one alert message "welcome". Not able to see the alert message in Hi.js file. I tried with all possible scenarios by changing path but its not working. CAN ANY BODY PLEASE HELP ME IN THIS.

One more thing I have to mention here when I change the URL pattern to some /xyz its working fine. Please Help me in this issue.

My Directory Structure.

RedirectApp
+-----WEB-INF
+-----Home.jsp
+-----Hi.js
Web.xml



Home.jsp




Hi.js


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61773
    
  67

A URL pattern of /* matches everything -- including all references to images, CSS, and so on. Don't use it. That's a very common beginner's error.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

You can use that <welcome-file-list> attribute in your web.xml.

So if someone type localhost:8080/yourApp/ your container will redirect the user to the mapped file.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
vijay sachin
Greenhorn

Joined: Jan 18, 2011
Posts: 23
Thank You very much guys for your help

I solved the problem by modifying web xml file and Home jsp Script tag.

Web.xml


In Home.jsp for the script tag src I used


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP Not able to Identify the JS, CSS file path