Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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?
  #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>


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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.