• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display tag and Struts multibox tag

 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on an application that uses Display Tag to render tables. In some of the tables, I am using the Struts tag "multibox" to render a list of options. I am having a problem with the checkboxs not holding the values after clicking the next page on the table.

Let me explain. Form example, if there are 100 records and the <pagesize> attribute -in the display tag decleration- set to "10", then there are 10 records shown at a time. When the user click on the little arrow on the top of the table, the table check out the next ten records.

Now, if I have a column of check boxes, when a user check some boxes and then click next arrow - to choose from the next values- the previous selection disappears.

How can I save the user selections?
Her are a snipet of the code from the JSP page

<display:table name="metadataList" export="true" id="row" requestURI="/publish.do?action=preExportSelect" pagesize="10" class="display_tag">

<bean efine name="row" property="metadataId" id="metadataId"/>
<display:column sortable="false" title="Select" media="html">
<html:multibox name="PublishingForm" property="selectedMetadataIds" value="<%= String.valueOf(metadataId) %>" />
</display:column>
</display:table>
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the Struts forum.
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ttt
anybody has any idea. I can't be the only one who wants to do this?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many of us who hang out at this forum have a lot of experience with Struts, but I don't think there are many of us who use the display tag library. I'm guessing your problem has to do more with the display tag than it does with Struts.

I know this sounds like passing the buck, but I think you might have better luck getting an answer to this in a forum dedicated to the display tag library. Try this link.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Merrill Higginson:
[qb]Many of us who hang out at this forum have a lot of experience with Struts, but I don't think there are many of us who use the display tag library.

Merrill,
What tag libraries do most people here use? I see there are different options out there, and would like to get up to speed on the best, most popular.

Thanks,
Eric
[ March 26, 2006: Message edited by: Eric Gero ]

 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now that I re-read your question, it sounds similar to an issue that we had in my project a while back. We are not using the Display Tag library, but it is the same issue. I hate to admit that we pushed back and got the requirements simplified so that a user's selection did not have to persist across multiple pages. This was a page where an end user would select people to add to a group. The end user would have to select users on one page and click the add button, or click the "view all results" link where they could see all the users on a single page.

To implement this you would have to wrap your page in a html:form tag and submit the page when the user clicked one of the page links. I am not sure if it would be best to keep your ActionForm in session, to keep selections from previous pages in hidden fields on the jsp or to implement logic that would process the submitted set of selection and build a master list of all selected items and save that in session.

- Brent
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brent Sterling,
The problem is that display:tag paging function doesn't populate and sumbit the form fields. What I mean is, if you have input fields, ie. checkbox, which are associated with a form bean, and when I click on next page, a function provided by display:tag, the value of the fields are not sumbited. So, I can't catch them and save tham in let say a session object.

Thank you for replaying
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yea, that is the basic reason that we got that requirement removed...we did not see an easy way to support that functionality within our paging and searching framework. We are using the "Pager Tab Library" and I don't think it really has support for submitting forms either. I am sure it is possible, but I am not sure how.

- Brent
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hanna,

I'm not sure if u still have this problem persisting, or if my solution might help u; why don't u try keeping the form bean associated with that action into the session, by changing the entry in the struts-config.xml file's <action> tag.

Hope this helps.

Liju
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey I found a way to do this although the implementation is a bit choppy and my users are asking me to do this in another way. Before I get into my fix though I want to point out that the attribute in the tag can be set to your action and the display tag library has ways to add your column data to the request if you use the

Smart Linking

feature.

Anyway I had the same problem you did, and I was able to solve it this way:

One of the developers created a Selection class that is essentially wrapper class that adds a boolean value to a bean. I store a collection of MyObjectSelection beans in the ActionForm. The MyObject objects generally store a unique identifier so I can use that to build my checkbox name. Then I add a javascript onclick handler to the page so that it will take my identifer and submit the form with the identifier. I'm using DispatchActions so I have to set the action parameter to "update." The update method then toggles the selected value on the MyObjectSelection bean. Of course when I load the page I have to check the selected value first. Here is the JSP code:


I have a hidden form object called "selectedObj" but it isn't a Struts Form object. The update method finds the selectedObj value in the collection and just toggles the selected property.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic