Solved

Hiting a url inside a jsp

Posted on 2014-03-11
7
496 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
check java version using powershell 13 306
jsp login check 12 54
swing controls 2 24
Setup GlassFish 4 37
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

730 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