Solved

Java dynamic html href

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS question 4 50
allow link tag to be submit like form 15 52
HTML CSS and  Table design 4 56
Can't Find the Homepage on my site 4 40
This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

742 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