I have a JSP page that creates a link to a php page. (..:: I have ZERO JSP experience ::..) and I need to do some encoding or string substitution because a '&' is being passed and interpreted by the php as a separate variable rather then part of a a previous one.

Here is the code in the jsp page.
code:

<td class="ThumbnailViewText">
	<script>
	var theURL = "http://cumulus/Firestar/notes.php";
	theURL = theURL + "?recordID=<cumulus:recordID/>";
	theURL = theURL + "&recordName=<cumulus:fieldValue name='Record Name' locale='en_US'/>";
	theURL = theURL + "&cumulusUser=<cumulus:userName server='CumulusServer'/>";
	theURL = theURL + "&recordPath=<cumulus:fieldValue name='Volume Name'/>:<cumulus:fieldValue name='Folder Name'/>:<cumulus:fieldValue name='Asset Name'/>";
	document.write("<a href=\"javascript:openNotesWindow('" + theURL + "')\">Notes</a>");
	</script>
</td>

I am primarily concerned with the field 'Folder Name' . It is that field which I would like to url encode or do a string substitution for the '&' character.

Can anyone help? I did some searches around last night and for whatever reason the solution is escaping me :-(

Thanks!

Honestly I do not see anything of JSP in your page, just Javascript.
And following is what you can use to encode your field

var encoded_data = escape("<string_data_to_encode>");

Honestly I do not see anything of JSP in your page, just Javascript.
And following is what you can use to encode your field

var encoded_data = escape("<string_data_to_encode>");

The escape / unescape functions have been deprecated since they don't work well with non-ASCII characters. Use encodeURI / encodeURIComponent .

Be a part of the DaniWeb community

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