File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes including .js file in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "including .js file in JSP" Watch "including .js file in JSP" New topic

including .js file in JSP

pritam sabnis

Joined: Dec 27, 2007
Posts: 6
I am developing one application using JSP and Servlet.
To include menu in my application i am using .js(javascript) files.
When I am forwarding request from servlet to JSP using forward method of request dispatcher i am unable to display the menu,but when i am using sendRedirect() method it is working fine.
Can anyone help in this issue?

Thanks and regards,

Pritam Sabnis
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Most likely you are using page-relative addressing for your JavaScript file, and that's not going to work in general.

See the ResourceUrlProblems entry of the JSP FAQ. Always be sure to check the FAQs first to see if your question has already been addressed.
[ August 02, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [About Bear] [Books by Bear]
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2851

Hi pritam sabnis welcome to Javaranch ,
looks like Bear has provided your required answer.
Please take some time to read the ask good questions link below.

|Asking Good Questions|
I agree. Here's the link:
subject: including .js file in JSP
jQuery in Action, 3rd edition