Solved

Java dynamic html href

Posted on 2014-10-09
5
167 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 500 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

688 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