Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 20th, 2009, 04:41 PM
Authorized User
Points: 101, Level: 2
Points: 101, Level: 2 Points: 101, Level: 2 Points: 101, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default href jsp

I want to have and <a href="<% var %>" target="_blank">Link</a>

but cannot seem to get the syntax correct.

Please advise.

Thanks
Reply With Quote
  #2 (permalink)  
Old April 20th, 2009, 07:19 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

<a href="<%= var %>" target="_blank">Link</a>

The = after the <% is needed.

Or you can code

<a href="<% out.write(var); %>" target="_blank">Link</a>

but why, when the shorthand format works?
Reply With Quote
  #3 (permalink)  
Old January 15th, 2010, 10:47 AM
Registered User
 
Join Date: Jun 2005
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default using HREF in jsp

Hope u find following useful...


<%
//assign the required URL in a string variable
Strubg strURL = "/myweb/mypage.jsp";
//Then use jsp expression in anchor tag of html
%>
<a href="<%= strURL%>" target="_blank">Link</a>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
REGEX to get href="#" monfu BOOK: Beginning Regular Expressions 2 July 24th, 2008 11:46 AM
Chapter 8, href and HRef (p. 285) roman BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 June 16th, 2008 10:40 AM
href in xslt rahulsk1947 XSLT 2 May 18th, 2007 07:39 PM
href darkhalf Javascript 2 November 20th, 2005 10:59 AM
Urgent please HREF mikedeepak HTML Code Clinic 2 September 26th, 2005 08:17 AM



All times are GMT -4. The time now is 03:46 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.