This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSP and the fly likes JSTL Help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL Help needed " Watch "JSTL Help needed " New topic

JSTL Help needed

sonali sawant

Joined: Oct 24, 2005
Posts: 13
Hi I want to replace following code of JSP with JSTL tags..

<a href="<%=retailerCardVO.getRetailerCardId()%>"><%=retailerCardVO.getCardNumber()%></a>

I replaced the code like below..

<a href=" <cut value="${retailerCardVO.getRetailerCardId()}"/><cut value="${retailerCardVO.getCardNumber()}"/>></a>

But its giving error 'Element is not closed'...
Can anyone tell me where is the error?..
badri nath
Ranch Hand

Joined: Dec 21, 2005
Posts: 57
Hi Sonali,

<a href=" <cut value="${retailerCardVO.getRetailerCardId()}"/><cut value="${retailerCardVO.getCardNumber()}"/>></a>

You have not closed the inverted comma, the one in bold.

More over, you will not call the getter directly like you were doing
<cut value="${retailerCardVO.getRetailerCardId()}"/>

It should be some thing like
<cut value="${retailerCardVO.retailerCardId}"/>
Mario Rezende

Joined: Dec 13, 2006
Posts: 5
Try this:
1) Create a Instance of your class (may be in the top of the page):
<jsp:useBean id="retailerCardVO" class="" />

2) Invoque the methods:
<a href="<cut value="${retailerCardVO.retailerCardId}"/><cut value="${retailerCardVO.cardNumber}"/>></a>

Note: You don't need the "get" and "()" when invoque a method in a TagLib.

Good Lucky :]
sonali sawant

Joined: Oct 24, 2005
Posts: 13
Thanks Badri and mario.
I made changes and used usebean.Thanks.It is my first day of work in JSTL.Now program is not giving any error.
I agree. Here's the link:
subject: JSTL Help needed
It's not a secret anymore!