File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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.
Don't get me started about those stupid light bulbs.
subject: JSTL Help needed
Similar Threads
JSF TreeMap Iteration Problem Using JSTL In XHTML
Obtaining total items for c:forEach
First (Semi-real) JSP and Error Message
javascript error: object expected
JSTL type casting