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.

Re: How can i get Context Path in JavaScript functions 80 80

javascript != Java

Re: How can i get Context Path in JavaScript functions 80 80

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.

Re: How can i get Context Path in JavaScript functions 80 80

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

Re: How can i get Context Path in JavaScript functions 80 80

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);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.