Solved

concatenate variable with HTML

Posted on 2009-05-18
3
3,032 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
  • 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now