• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem witn Request Dispatcher..

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

i have a JSP page in which im having one navigation bar created using JavaScript and DHTML.
all the javascript coding is done in seprate javascript file which i load in jsp using script tag

Now if i invoke that JSP directly from tomcat. Everything works fine Navigation bar is shown .

Now if i use RequestDispatcher from a servlet to call that JSP page Navigation Bar does not appear there is no script error.

I have checked this problem is occuring only when i use request dispatcher to call JSp Page . if i use send redirect then it works fine but if i use requestdispatch it does not work javascript file does not get loaded.

please help..any clue
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am betting that the way the script is loaded depends on what the browser thinks is the directory that originates the page. You get the same problem with loading images with a servlet generated page.
My suggestion is that you use the BASE tag in the generated page to specify where the browser should look for resources. An alternative would be to give a complete location for the javascript file instead of a relative one.
Bill
 
yogesh sood
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot !
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic