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
Solved

Hiting a url inside a jsp

Posted on 2014-03-11
7
486 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
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 …
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 scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

860 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