Solved

concatenate variable with HTML

Posted on 2009-05-18
3
3,375 Views
Last Modified: 2013-12-29
In my JSP I want to concatenate a variable in the anchor tag url

I did the following but it does not work

Please help
<% String object_id="123" %>
 <td class="formtext"><a href="http://localhost:8080/webtop/drl/objectId/'"+object_id+"'>View</a></td>
  	  <td class="formtext"><a href="http://localhost:8080/webtop/component/bravaview?objectId='"+object_id+'">Annotate</a></td>

Open in new window

0
Comment
Question by:sam990
[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
  • 3
3 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24419170
Try
<% String object_id="123" %>
 <td class="formtext"><a href="http://localhost:8080/webtop/drl/objectId/'<%=object_id%>'>View</a></td>
          <td class="formtext"><a href="http://localhost:8080/webtop/component/bravaview?objectId='<%=object_id%>">Annotate</a></td>

Open in new window

0
 
LVL 86

Accepted Solution

by:
CEHJ earned 50 total points
ID: 24419177
Typos sorry
<% String object_id="123" %>
 <td class="formtext"><a href="http://localhost:8080/webtop/drl/objectId/'<%=object_id%>'>View</a></td>
          <td class="formtext"><a href="http://localhost:8080/webtop/component/bravaview?objectId=<%=object_id%>">Annotate</a></td>

Open in new window

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 24419191
:-)
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ejb stateless example 2 68
hashmap order 17 62
ArrayList Adding/settign data 3 37
Given a github repo find email address of all collaborators in that repo 1 56
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses

734 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