Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

generate selectonemenu dynamically

 
Sukruti Patel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am working on shopping cart application in which i want to generate selectonemenu dynamically for setting Item attribute from database.
for eg, I have 4 tables item, attribute,attribute_value and mapping of this three. Now i want that I ask user to select attribute for item and than assign value.
to assign attribute to item i created checkboxlist that is working perfectly then i want that selected attribute as label and their value appear inside dropdown
i made to display but get confused when it comes to storing this value in database
confused in red underlined place....
This is without any dynamic generation but i think solution is dynamic component but dont know how
code snippets:


 
Tim Holloway
Bartender
Posts: 18423
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Sukruti!

We have a "Code" button on our message editor. You can use it to format structured text like Java code and XML so that it's easier to read. I've applied it to your post.

Avoid using JSTL tags like the "c:forEach". JSTL does not work well with JSF and JSF has native tags that work better.

In the case of a set of similar UI constructs of varying number arranged vertically, my first preference is the h:dataTable tag. This will layout the constructs as rows in a 2-dimensional grid.

For horizonal layout of constructs or for more free-form layouts, I'd use the ui:repeat tag.

You almost never have to create components dynamically in JSF, and especially not in cases where the size of the generator data is the sole reason, since JSF is designed to adapt the view based on the model.

An alternative for when you need complex controls not available from raw HTML (and thus not from the core JSF tagset) is to use a third-party extension tagset such as RichFaces, IceFaces, PrimeFaces or Apache Tomahawk. These extension sets generally have actual menu tags offering both horizontal and vertical menu layouts already debugged and ready to use.
 
Sukruti Patel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply i'll take care of this...
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!