?
Solved

Java dynamic html href

Posted on 2014-10-09
5
Medium Priority
?
168 Views
Last Modified: 2014-10-09
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,
0
Comment
Question by:Dovberman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 40370653
Unescape the '"' and replace the string and I get:
<li class=""><a href="HTTP://MySite.com/Help/Contact/front.cfm?fromJSP=1" title="PMS385">PMS385</a></li>

Open in new window

0
 

Author Comment

by:Dovberman
ID: 40370759
Now it is clear.  The \" represents the "  character.

thanks,
0
 

Author Closing Comment

by:Dovberman
ID: 40370761
Thank you,
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40370773
>>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:
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question