?
Solved

Hiting a url inside a jsp

Posted on 2014-03-11
7
Medium Priority
?
522 Views
Last Modified: 2014-03-27
HI,
I want to fire a url from inside a jsp.
How do i do it.

Also in the following function :
function hitInternalTrackerSystem(){
	var prmstr = window.location.search.substr(1);
	var prmarr = prmstr.split ("&");
	var params = {};

	for ( var i = 0; i < prmarr.length; i++) {
	    var tmparr = prmarr[i].split("=");
	    params[tmparr[0]] = tmparr[1];
	}
	if(params.ci){
		//hit the url
		var image = new Image(1,1);
		<c:out value="${applicationScope.affilatePrefix}" />
		<c:out value="hi hih ihii" />
		image.src= "${applicationScope.affilatePrefix}" + "/flights-aff-tracking/Tracker?ci="+params.ci;
		<img src=image.src />
	}
	
}

Open in new window


The img tag is not working.
That is if i view the source
the image.src variable value is not getting picked up
It shows as <img src=image.src />

Thanks
0
Comment
Question by:Rohit Bajaj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 20

Accepted Solution

by:
chaitu chaitu earned 1500 total points
ID: 39919899
window.location.href="${applicationScope.affilatePrefix}" + "/flights-aff-tracking/Tracker?ci="+params.ci;
0
 

Author Comment

by:Rohit Bajaj
ID: 39920031
Hi,
I tried above but it didnt work. Probably there is a mistake at my end.

function hitInternalTrackerSystem(){
	var prmstr = window.location.search.substr(1);
	var prmarr = prmstr.split ("&");
	var params = {};

	for ( var i = 0; i < prmarr.length; i++) {
	    var tmparr = prmarr[i].split("=");
	    params[tmparr[0]] = tmparr[1];
	}
	var string = "rock";
	<c:out value='string' />
	<c:out value="${params.ci}" />
	if(params.ci){
		//hit the url
		var image = new Image(1,1);
		<c:out value="${params.ci}" />
		window.location.href="${applicationScope.affilatePrefix}" + "/flights-aff-tracking/Tracker?ci="+params.ci;
		
	}
	
}

Open in new window


I tried the above code.
Probably its nor firing because the condition if(params.ci) is not holding true.

I tried c:out the value but its not working.
Please help me in how do i debug this.

How to c:out the value of the variable params.ci

Is there any other way i can debug jsp using eclipse ?
0
 

Author Comment

by:Rohit Bajaj
ID: 39920055
The above code is inside a <script> tag. On debuggin with firebug i found it is indeed empty.

What i am trying to achive is the following.
I am hitting my Java spring App with url http://localhost:8080/mobile/?ci=vizury
Now i need this string "vizury" in a parameter in my jsp .
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

Author Comment

by:Rohit Bajaj
ID: 39920087
Hi,
I somewhat sorted out the issue at my end.
But your code :window.location.href="${applicationScope.affilatePrefix}" + "/flights-aff-tracking/Tracker?ci="+params.ci;

Redirects me to this url.
I dont want to redirect to this url. But just hit it and stay on the same page
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 39920266
what do you want to do after you want to fire a url?intiailly i thought to redirecting the url to another page.

if you stay on the same page user ajax-jquery combination in the javascript..

check these examples

https://api.jquery.com/jQuery.post/
0
 

Author Comment

by:Rohit Bajaj
ID: 39922609
That url is actually calling another webapp deployed on local which will set a cookie.
0
 
LVL 20

Expert Comment

by:chaitu chaitu
ID: 39922820
have you checkd the examples that i posted on ajax,jquery
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month13 days, 6 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question