Link to home
Start Free TrialLog in
Avatar of Dovberman
DovbermanFlag for United States of America

asked on

Java dynamic html href

I am trying to decipher someone elses undocumented code.

I do know that the following statement is designed to render a hyperlink on a line.

String myURL= “HTTP://MySite.com”;
out.println("<li class=\"\"><a href=\""+myURL+"/Help/Contact/front.cfm?fromJSP=1\" title=\"PMS385\">PMS385</a></li>");

What is the HTML that this statement renders?

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dovberman

ASKER

Now it is clear.  The \" represents the "  character.

thanks,
Thank you,
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

>>Now it is clear.  The \" represents the "  character.

It is 'escaping' the next character.

Java interprets the " as a string delimiter.  To have one inside a string you 'escape' it.

http://docs.oracle.com/javase/tutorial/java/data/characters.html

Escape Sequences

A character preceded by a backslash (\) is an escape sequence and has special meaning to the compiler. The following table shows the Java escape sequences: