File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Passing URL in src attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Passing URL in src attribute " Watch "Passing URL in src attribute " New topic

Passing URL in src attribute

satish pune
Ranch Hand

Joined: Sep 04, 2003
Posts: 44
Hello all ,
I have a static html page : decide.html"
which I invoke by the URL :




In this static page ( decide.html ) I want to make a call to a servlet .

Here I am making use of code similar to this in decide.html :

Now my control is transferred to the servlet and I can execute code

However the problem is : How do I pass the URL in the src attribute to the servlet

I would like to dynamically pass either :

based on which I would like the servlet to behave differently

Any help is appreciated
Thanks ,
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
Aside from the fact,that since they are different pages you can call 2 different servlets, you can add a parameter to your src url.
something like

You can get that currentUrl thing using javascript (at this case you need to use document.write to write script statement), or use JSP/Servlet API and don't forget to encode the url.
Than in a servlet you use request.getParameter("url") to get the value
I agree. Here's the link:
subject: Passing URL in src attribute
It's not a secret anymore!