File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes displaytag help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "displaytag help" Watch "displaytag help" New topic

displaytag help

Ranch Hand

Joined: Oct 26, 2006
Posts: 58
Dear all,

I am new to struts.I am developing a small application. In that i want to use displaytag to display items. I want to select few items and add to cart.
Could any one please suggest me, how can i do that?
is it possible?

Thank you
sirish veer

Joined: Feb 06, 2008
Posts: 3
Download displaytags jar file.
<display:table name="offices" requestURI="" pagesize="${row}" sort="list"
id="officeResults" class="jobResults" >
<% String office = (String)(((Office)((ManageOfficesDao)pageContext.getAttribute("officeResults")).getOffice())).getOfficeId() ;
request.setAttribute("officeResult", office); %>
<display:column><s:checkbox theme="simple" name="checked" fieldValue="%{#request.officeResult}" /></display:column>
<display:column sortProperty="sortList" property="office.officeId" title="ID" sort="true"/>
<display:column property="office.officeName" href="viewoffice.action" paramId="Id"
paramProperty="office.officeId" title="Name" sort="true"/>

Here we are passing the officeId when they select the check box and
retrieving it in action class.
Ranch Hand

Joined: Oct 26, 2006
Posts: 58
Hi sirish,
From your reply i understood that we can do shoppingcart type application using display tag. But honestly i did not understand your code.
Could you please send me a simple application which works like shopping cart .. to add items to cart. I just need how the add button works. Please

Thank you in advance
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
You're overestimating what DisplayTag can do. It is a tag library that can display tabular data (from data structures or the database) in a web page. You most certainly can not "do shoppingcart type application using display tag". You will need to use various Struts capabilities to do that.

It sounds as if you need a server session in which you can store the items of the shopping cart until checkout. What do you have so far?
I agree. Here's the link:
subject: displaytag help
It's not a secret anymore!