aspose file tools*
The moose likes JSP and the fly likes Jsp Expression tag inside <a href> html tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp Expression tag inside <a href> html tag" Watch "Jsp Expression tag inside <a href> html tag" New topic
Author

Jsp Expression tag inside <a href> html tag

pratapsiva sivakumar
Greenhorn

Joined: Nov 10, 2008
Posts: 18
<%
String url =response.encodeURL("hello2.jsp");
%>

\'> >hello2.jsp --- this line in not working.I want to know the syntax of giving jsp Expression tag inside html tag.Please help
Anjali Raman
Ranch Hand

Joined: Nov 28, 2007
Posts: 57
Hi...
This is the code snippet. Hope this answers your questions

hello1.jsp
<%@ page session=\"true\" %>
<%
String url =response.encodeURL("hello2.jsp");
%>
\'>hello2.jsp

~Anjali
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9317
    
  17

The syntax of an expression is <%= expression %>. If you want to put the url variable in the anchor tag's href attribute, you'll need to do this



SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Anjali Raman
Ranch Hand

Joined: Nov 28, 2007
Posts: 57
Sorry some problem with the way I was putting the code. My answer was the same as Ankit.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

A more modern approach would be to use the <c:url> JSP action.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9317
    
  17

Anjali Raman wrote:Sorry some problem with the way I was putting the code. My answer was the same as Ankit.


You can disable HTML in your messages. There is a checkbox in the options area that says "Disable HTML in this message". Checking that solves the problem...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jsp Expression tag inside <a href> html tag