Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Javascript library not loading

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I open a jsp from another jsp using window.open
The child window has a javascript library included.
The child window has a form, which on submitting calls a servlet. After some processing there I do a RequestDispatcher.forward to the same page(child window) from the servlet. But this time when the child window reloads the javascript library is not loading. I see the message

"1Error 404: No target servlet configured for uri: /js/ratingsys.js" in firebug and hence the onload method of the body which needs to be executed is not executed.

Please let me know what could be the problem. Thanks in advance for all your time.
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The URL to your JS file is likely invalid.
 
sri pathi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope! For the first time when I open the window using javascript(window.open), it works fine and it calls the onload method successfully. But the problem is when I do a RequestDispatcher.forward from the servlet the library is not loading and the onload method is not executing.
[ July 26, 2008: Message edited by: sri pathi ]
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK then.
 
sri pathi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
OK then.


I could not understand. Is my input not enough or I've sounded offensive in anyway?!
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Nope!" doesn't give any more useful information (and is a tad rude). You haven't shown us what URLs you are using, where the JS files are located, what resources you are forwarding to, or any other information that will help us help you.
 
sri pathi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
"Nope!" doesn't give any more useful information (and is a tad rude). You haven't shown us what URLs you are using, where the JS files are located, what resources you are forwarding to, or any other information that will help us help you.



Originally posted by Bear Bibeault:
"Nope!" doesn't give any more useful information (and is a tad rude). You haven't shown us what URLs you are using, where the JS files are located, what resources you are forwarding to, or any other information that will help us help you.



I think this message might be too long, but bear with me.
Structure of my app:
Rating (application directory)
1. JavaSource
1.1 Java files in package structure
2. WebContent
2.1 js
2.1.1 javascript files (the javascript files reside here)
2.2 jsp
2.2.1 jsp files (jsp files, parent, child windows and other jsps)
2.3 css
2.3.1 the style sheet files (.css)
Parent Window:
parent.jsp

1. Has a link which when clicked (onclik method) calls a method from the library included as below.
<script type="text/javascript" src="../js/ratingsys.js"></script>
This part works absolutely fine.
child.jsp


3. ratingsys.js


My problem is with the child.jsp (when I open child.jsp from parent.jsp onclick method ratingsys.js loads properly and the javascript onload method transferdata executes properly). This child.jsp when submitted calls a servlet which after some processing does a RequestDispatcher.forward from the servlet to child.jsp again. But this time the javascript onload method transferdata does not execute. I see the following message in the firebug (firefox add on), "1Error 404: No target servlet configured for uri: /js/ratingsys.js")
But this time the rating sys

Please let me know if you need more details. Thanks in advance

[ July 26, 2008: Message edited by: sri pathi ]
[ July 26, 2008: Message edited by: sri pathi ]
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I suspected:
Page-relative URLs are not valid in web applications where URLs generally reflect mappings rather than folder structures.

See the JSP FAQ on resource URLs to find out how to properly format resource URLs in a web application.
[ July 26, 2008: Message edited by: Bear Bibeault ]
 
sri pathi
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
As I suspected:
Page-relative URLs are not valid in web applications where URLs generally reflect mappings rather than folder structures.

See the JSP FAQ on resource URLs to find out how to properly format resource URLs in a web application.

[ July 26, 2008: Message edited by: Bear Bibeault ]


I think it fixed my problem, Thanks a lot! for your time!!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic