• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

html:checkbox or html:multibox

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

I have a jsp which shows a drop down combobox, a text box and submit cancel buttons.
the drop down combo box is a collection of objects. to be exact an arraylist which is placed in session in the action class.

The object is a technique object which has the following attributes:
techCd : type String : primary key
techDscr : type String : a description of the technique
actCd : type String : can be A indicating Active and D indicating Deleted

----------------------Earlier only these where present--------------------

-----------------------------------------------------------------------
Earlier the value can be selected and updated. select an old technique and enter the new description in the textbox.

But now I need to place a checkbox alongside the drop down combo box , so that the checkbox gets checked when the selection in the combobox changes.

I read everything I could on how to implement this, and I think I need to do this via html:multibox
----------------------Now trying to implement checkboxes-------------

------------------------------------
the above code gives me a
[ServletException in:/tiles/modifytile.jsp] Cannot create iterator for this collection'

I have the following code in my ModifyForm




Could anyone give any suggestions/help on what am I doing wrong, please? Is it possible to check/uncheck a checkbox/multibox based on the selected value in the dropdown combo box?

I think it will be simpler to write them as a list using <bean;write> and place checkboxes along side for each as indicated in this article

http://www.onjava.com/pub/a/onjava/2003/07/30/jakartastruts.html?page=last

But when there are too many values , the page can be too long.

If I use a single select list , the display will be better and users can easily navigate to a value , but we should only have a single checkbox and the problem becomes similar to that I am facing now.
single select list code sample
http://javaboutique.internet.com/tutorials/strutsform/index-4.html

Please help out. my only other option is scriplets.
Thanks,
Aparna
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So when the user selects a different option in the list the checkbox check needs to toggle?
If so, that's a javascript thing.
 
Aparna Sharma
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But arent they in the same collection as attributes of a bean/object?
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't matter because the user is interacting with html by that point. The Java code, scriptlets, and Struts tags don't exist anymore because it's already done its job and sent the html to the user's browser.
 
Aparna Sharma
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok..some light shines through!

I assume I would be doing a javascript like

onchange="getStatus(techCd)"

where techCd is the primary key attribute , which goes to the server and brings back the checked/unchecked status.

Then how can you think I can make this work?
 
Marc Peabody
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With what you just described, you'd have to submit the entire form.

A better solution might be to use the Strutstags/scriptlets/whatever to create a collection in javascript to hold all the possible checkbox mates for the list values. That way, an onchange event on the client (the user's browser) can handle the change internally without needing to submit the entire form to the server.
 
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic