Solved

Hiting a url inside a jsp

Posted on 2014-03-11
7
507 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 500 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
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

728 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