Escaping special sequences in HTML

Sorry if this is in the wrong forum, but I am stuck and can't find the answer. In Java, I am forwarding a page and passing a string into the new Forward. The problem is that part of the string is?/b>, and in HTML is keeps resolving the the registration symbol (circle with an R inside)

rtn ="https://www.mypage.com/page.do?accountNumber="+accountNum+"&registrationCode="+registrationCode;

returnnew Forward(rtn);

I've tried using double quotes to escape it, but it still resolves to the registration code symbol

rtn ="https://www.mypage.com/page.do?accountNumber="+accountNum+"\\&registrationCode="+registrationCode;

Any ideas how to escape ?in a string to make it actually resolve to ?in an jsp page?

thanks

Message was edited by:

drakester

Message was edited by:

drakester

[1026 byte] By [drakestera] at [2007-11-27 1:13:43]
# 1

> The

> problem is that part of the string is ?/b>, and

> in HTML is keeps resolving the the registration

> symbol (circle with an R inside)

> I've tried using double quotes to escape it, but it

> still resolves to the registration code symbol

> Any ideas how to escape ?in a string to make it

> actually resolve to ?in an jsp page?

I don't get what you're asking. Do you want the ?to appear in the page or not? You seem to be contradicting yourself.

hunter9000a at 2007-7-11 23:49:06 > top of Java-index,Java Essentials,Java Programming...
# 2

Well, for characters in a URL (like what you have there), they are supposed to be URL-escaped if they aren't letters or digits or a few other things that I don't quite remember. The URLEncoder class will do that for you.

You won't see the ® character when you do that, you will see a % character followed by some hexadecimal data.

DrClapa at 2007-7-11 23:49:06 > top of Java-index,Java Essentials,Java Programming...
# 3

> I don't get what you're asking. Do you want the ?to

> appear in the page or not? You seem to be

> contradicting yourself.

I do not want &reg to appear, I want (&.reg) to appear(but without the period). I am trying to pass &.reg as an URL string but the &.registration keeps resolving to &registration.

drakestera at 2007-7-11 23:49:06 > top of Java-index,Java Essentials,Java Programming...
# 4

> > I don't get what you're asking. Do you want the ?br>> to

> > appear in the page or not? You seem to be

> > contradicting yourself.

>

> I do not want ?to appear, I want (&.reg) to

> appear(but without the period). I am trying to pass

> &.reg as an URL string but the &.registration keeps

> resolving to &registration.

Gotcha. I was even more confused until I quoted your reply. If the URLEncoder doesn't handle the problem, you could encode the '&' yourself: http://www.w3schools.com/tags/ref_urlencode.asp

hunter9000a at 2007-7-11 23:49:06 > top of Java-index,Java Essentials,Java Programming...