We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,485 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How can i get Context Path in JavaScript functions

Hi JavaGeeks, i am trying to get context path of my Applcation. But it is showing errors in that. Can you please mention the way how to get context path in javascript functions.

4
Contributors
4
Replies
8 Hours
Discussion Span
1 Year Ago
Last Updated
5
Views
GeekDude
Newbie Poster
3 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

javascript != Java

jwenting
duckman
Team Colleague
8,522 posts since Nov 2004
Reputation Points: 1,656
Solved Threads: 345
Skill Endorsements: 19

Ok. Then how can i get the context path.?
I have a code like this.

case 6: {//print
				LeftPosition = (screen.width) ? (screen.width-290)/2 : 0;
				TopPosition = (screen.height) ? (screen.height-240)/2 : 0;
				var _h=options.values.length*23;
				settings = 'height='+_h+',width=245,top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable';
				saveField = options;
				win = open('/dnweb/pages/favorite.jsp','Print_Favorite_win',settings);
				win.focus();
				break;
			}

i have to change

/dnweb

context as dynamically.

GeekDude
Newbie Poster
3 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

What do you mean by 'context path' - the tree of routines which calls the current one?

MartinRinehart
Junior Poster in Training
97 posts since Jun 2010
Reputation Points: 11
Solved Threads: 10
Skill Endorsements: 0

Ok. Then how can i get the context path.?
I have a code like this.

win = open('/dnweb/pages/favorite.jsp','Print_Favorite_win',settings);
				win.focus();
				break;
			}

i have to change

/dnweb

context as dynamically.

You can use a variable value concatenation with the string path value.

var contextPath = "";
    contextPath = "\/dnWeb2"; //the value assignment is done for illustration purpose here
            win = open( [B]contextPath[/B] + '/pages/favorite.jsp','Print_Favorite_win',settings);
Troy III
Master Poster
746 posts since Jun 2008
Reputation Points: 140
Solved Threads: 95
Skill Endorsements: 5

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0673 seconds using 2.77MB