Best way to store the company-Brands list ?

I am going to use a Java object in my Jsp. My Jsp has 2 dropdowns as follows. One is Company dropdown and second is corresponding brand dropdown.
Each Company owns bunch of brands as follows:
Coca ----- Classis
Diet
Lemon
GM ---------Chevrolet
Corvette
Saba
Gap---------Trouser
Shirts
Jackets
So, now you know. In my Jsp will be first dropdown which will have 3 Company names to select and the second dropdown will immediately show the bunch of corresponding brands, depending upon what company User selects in first dropdown.
Two questions:
I get companies and brands from database. Now I want to populate the object with all above info and send it to Jsp page for both the dropdowns to get populated as I mentioned above. I will be using the taglibs in jsp page like c:forEach and c:value c:out etc
a>What is the best way that i can store this company-brand info on server side and push it to Jsp page ? Should I go collections/ ArrayList OR SET OR what is best ?
If you have sample code for storing it will be helpful
b>I want to know how this object in a> I can loopover and show the company , brand values in my Jsp page dropdown using taglibs.
code snippet will surely help me. bcoz I want to store these values in an javascript array and each time user selects different brand it should fire a call to javascript function which would basically populate appropriate brand list in second SELECt dropdown. So more call to server for different company selection.
thanks again.
pp

I would use a Map<String, Set> or Map<String, List> (using Java 5 generics notation here to show clearly what is in the map, but using generics is not required).
The keys in the map are the company names, the values are Sets or Lists of brand names.
This snippet will get keys and values from a Map called companyBrandsMap:<c:forEach var="mapElement" items="${companyBrandsMap}">
   Company: <c:out value="${mapElement.key}"/><br>
   Brands:<c:forEach var="listElement" items="${mapElement.value}">
     <c:out value="${listElement}"/><br>
   </c:forEach><br>
</c:forEach>This code just prints the values, you can put your JavaScript code around that.

Similar Messages

  • What is the best way to store and iterate over lists of words?

    Hi,
    Im trying to create a naive bayesian classifier to attribute aurthorship to some texts. I have three text files in the form of a list of words (listA, listB and listC, where listA is a disputed text and listB, listC are those of known authors). I need to feed these into my program, than compare listA to listB (to check if listA has the same words as listB), perform the classification and do the same for listA and listC.
    Im new to java and would like to know the best way of comparing the text files....could i store listA in an array....listB in a hashmap, iterate over the hashmap to check which words are also contained in listA and store the similar words in a seperate arraylist?
    plz help.

    If you just want to check if one set of words contains another set of words then something implementing java.util.Set might be sufficient. Read the API docs, you don't need to write much code yourself. Maps are for looking up values based on keys; your problem statement doesn't mention that so you don't need them. Lists are for when the order of entries matters. Read this for more information:
    http://java.sun.com/docs/books/tutorial/collections/index.html

  • Best way to store TenantID in Azure

    I'm developing a multi tenant application
    I am using ASP.NET MVC and Asp.net Identity for authentication
    My client can have more than one company and you can change, user have multiple company
    I wonder what is the best way to store the TenantID in azure
    Claims?
    I'm Claims my value is:
    Type = "TenantId"
    Value = is Guid ( difficult or impossible to be guessed by changing the value of the cookie )
    Cache?
    Session ["TenatId"]?
    Router? {tenantid}}/controller/action

    Hi
    When you get a Graph Token from AAD, it has an Issuer claim in the Claims that has the TenantId in it, so you don't need to store the TenantId in a different claim:
    Sample issuer claim:<Issuer>https://sts.windows.net/cbb1a5ac-f33b-45fa-9bf5-f37db0fed422/</Issuer>For your reference of all available claims in AAD token take a look at here:https://msdn.microsoft.com/en-us/library/azure/dn195587.aspx#BKMK_TokenClaims
    Regards
    Aram

  • Best way to store all this data!!

    Hi i have run into a problem and cant think at the mo. I need to know the best way to store this data:
    Meet(List of events in meet, Runners in meet, Relay team in meet, Which runner/ relay team is registered for which event, results of each event updated once meet is run, event being run(or has finished) or not started yet so runners can still register for it);
    Runner(RunnerID, Name, D.O.B, national team affiliation, Gender, Events in?, Seedtime for each event?, actual time for event?)
    RelayTeam(RelayID, Team name, Runner names, seedtime for events, events in, Acutal time)
    Event(ID, Name, Meet in, Runners in which lane)
    I just want to know how i can store these to make it as easy as possible to update etc.
    Anyhelp apprec.
    Thanks
    J

    Crossposted: http://forums.java.sun.com/thread.jsp?thread=509544&forum=31&message=2419334

  • Best way to store documents and images in a web application

    All,
    Which is the best way to store the documents, is it Oracle DB or file system or Virtual Directory Mapping in weblogic.
    We are working on a Internet based application into CRM domain, there is a requirement where user can upload and download the documents (.pdf, .xls, .doc etc). Right now we are storing images in the DB. Is it advisable to store all the docs in database and will it scale up in future.
    PS: There is no scope for using content server because of business constraints.
    Please let me know, thanks in advance.
    Regards
    Girish

    Best way to store depends entirely on requirements.
    Why store it in the database when it for example is purely static images (e.g. used as part of the web GUI)? Instead that can be served up directly by a web server - which is specifically designed for this.
    If it is more than just an image, but include tags (non spatial data attributes), requires transaction control (e.g. updating an old passport/id photo with a newer one), auditing, filtering/searching and ordering, requires backup, needs security and access controls, and so on - than that is most definitely a database function.
    So the issue is not what the binary file is or contains - an image or pdf or something else. It depends entirely on how it is to be used and what the business requirements are in this respect.

  • Best way to store lots of tile images

    Hey, In my game I'm gonna need to store probably thousands of tile images. They are all in .png format, and I am wondering the best way to store the image data. I could of course keep them in some folder called images, and then have thousands of files...but then people could jack them, and plus that would be inneficient use of space??? right?
    What is the best way to store them??
    thanks

    Anything can be "jacked". The other possible ways are storing them in some sort of archived file like a JAR or ZIP or GZIP. The only way to even remotely ensure no one will "jack" your images would be to store them in a compressed format which you created. Which would entail creating your own compression algorithms. Have Fun! :)
    Seriously though, I wouldn't worry too much about the images and people "jacking" them. As far as inneficient use of space, I personally wouldn't worry about this either unless your app will be delivered via WebStart or Applet. Then load time could be an issue. You could use lazy downloading though and download the images when they are needed.
    HTH
    Gregg

  • Best way to store an ipod classic

    I tend to use my ipod then store it for a week or two (or longer), depending on my schedule. What is the best way to store the ipod when it is not in use.
    Plugged in through the USB port so it is continuously/fully charged at all times?
    Unplugged and off (the battery slowly drains)?
    Any danger if not used for extended periods of time? ie battery totally drains

    I don't think that you necessarily need to keep it constantly plugged in, I doubt the battery will drain itself in that timeframe. It may drain quicker if there are temperature extremes, but that shouldn't be a problem.

  • What is the best way to store and search 2D data

    Hi,
    There is a set of data (~10k records ) in 2D dimension.
    like this :
    Col 1, Col 2, Col3....
    What is the best way to store and search those records ?
    Thanks in advance
    Wilson

    Hi,
    Either userObjet[][] if you know how much data you have, and the data size is fixed, or use a list of lists. E.g. A Vector of Vectors (some will probably say that you should use an ArrayList instead, and that could be the case, but it sounds like you would want to display the data later on, and a DefaultTableModel (for JTables) uses a Vector as data holder).
    Kaj

  • What's the best way to store my info externally

    I have recently bought my first Macbook Pro 13" with 2.4 Ghz. I am currently using it for my own business and do tend to get a lot of files together. I went to look at "About this Mac" and have already got 369 Gb used up in storage... I have no idea how I have done that as I have hardly downloaded any apps on this computer besides the ones that were on here. I did download Vware Fusion 4 as I have a reservation system which I used to run on my pc and need to have this on here too so perhaps that software takes a lot of space.
    Could anyone advise on which is the best way to store my info externally, will any external harddrive do, or do you need a special one for Apple or Macbook pro. I am just asking as I have no idea and prefer to buy the right one straight away.
    Any help would be much appreciated !
    Thanks, Sara***

    Sara,
    The most reliable method is to use an external hard drive.  Some are better than others, but most will work.
    For the least amount of setup pain, I prefer to deal with the Mac specialists at OWC, http://www.macsales.com as they stand behind their products with great warranty and support.  I have one of their Mercury Elite Pro 2 TB drives that has multiple interface capability so you can get a fast interface for data transfer.
    Take a look at what they offer and see what fits your needs.  If you have more questions about doing thin, just ask on here.
    Ralph

  • What's the best way to store old FCP projects & media?

    Hey
    I've started to accumulate more and more video content of client projects, but I don't want to delete it in case they come back a year later looking for an update on the video product I made them.
    So, what's he best way to store FCP projects and video files?
    I thought maybe a BluRay burner might do the trick.
    Any suggestions?
    Sam

    Since you're using RAW files you might peruse the DAM Forum to learn about possible other DAM (digital asset management) software and workflows. There is a wealth of information at that site.
    I useMedia Expression for my primary DAM application and iPhoto for special projects like books, calendars, etc.

  • What is the best way to store a battery?

    Hi,
    I have an extra MBP battery. What is the best way to store this extra battery? Should I store it when it is fully charged? or Should I store it when it is half full? Is it necessary to use that batter once in a while?
    Thank you beforehand.
    Bob

    http://www.apple.com/batteries/notebooks.html
    If you're storing it for a long time, put it away when it's about half full. If you have a couple of batteries for your MacBook, I'd recommend swapping batteries once a month or so to extend the life of both batteries.

  • How do you move pictures to an external drive to open space on the Mac hard drive? Or what is the best way to store photos safely?

    How do you move pictures to an external drive to open harddrive space? Or what is the best way to store large photo files? Ive tried copy/cut and paste and it doesnt work. I have nothing on my Mac but photos and its telling me startup disk is too full to download updates.

    Are the photos being stored in iPhoto now?
    How is the external disk formatted?
    Allan

  • Best way to store big amount of data

    Hi, i need to store a big amount of data, written in a txt its size is almost 12 mg, anyway it depends on the computer it runs, beacause what i want to store is all the shared files in a computer.
    Which is the best way to store it? Array string? textfile? List? I don�t need the data after the app close.
    Thanks

    Well, then which is the best solution? LinkedList or
    Tree? i only need to store the full path.
    What i didn�t say, my fail, is that i need to search
    for a file name once i have stored them...For searching, LinkedList will be very slow if it's very large. I think the same is true of javax.swing .tree.DefaultTreeModel, which is the JDK's only tree implementation. I don't know what Jakarta-collections has - it's possible they have a tree that offers fast searching. If you want to stick to the standard Java libraries, you'll want a Set for fast searching. TreeSet keeps the entries in sorted order. If you also need to display them as a tree, you can keep them in both a Set and a tree. If you don't have enough memory to do that, then displaying the whole tree isn't going to be useful to the user anyway, so rethink your goal.

  • Best way to make a to do list

    new to apple - what is the best way to make a to do list? Reminders, an app, sticky notes?

    If I read your post correctly you want to build a string that looks the same as how Script Editor would display a list, correct?
    If so, that's not hard.
    You can use 'text item delimiters' to tell AppleScript how to convert a list to a text object - the TID will be inserted between each list item.
    Then all you have to do is prefix the list with {" and suffix it with "} and you're done:
    -- start off with something in the list:
    set theList to {"cold", "drink", "beer"}
    set oldDelims to my text item delimiters
    set my text item delimiters to "\", \""
    set myString to theList as text
    set my text item delimiters to oldDelims
    return "{\"" & myString & "\"}" as text
    This will result in a text object that looks like:
    {"cold", "drink", "beer"}
    which you can easily store in your Filemaker database.
    Note the copious use of the backslash to escape the quote characters so they can be embedded in a text object.
    I'm curious as to why you want to do this, though.

  • Best Way to store references to other objects

    Hi there,
    I want to design a class, that has several references to other instances. What is the best way to store such references within the class? As a vector? As a Hash-Table?
    What I need are:
    -get a certain element in this data-structure fast (let's say the fifth)
    -be able to list all elements referenced
    -delete a certain element (e.g. 5th one out of 10)
    What I do not necissarily need is:
    -to be able to search if a certain object is referenced by this one
    What do you propose?
    Any ideas?
    Thx
    Karlheinz Toni

    Any thoughts on hashtables etc?
    I used them in an application where i needed to get
    objects quickly. It allowed me to get the objects
    based on a criteria instead of by the object itself.
    It was really useful for me.Use HashMap instead of Hashtable. HashMap would also work but you can't get element 5 unless you use the element number as a key. If you do use the element number as the key, it's kind of like using a List except it won't renumber itself, which you may or may not want. For example, if you remove element 5 from a List element 6 (if it exists) becomes element 5. If you remove key 5 from the HashMap you just don't have an element 5 anymore i.e. the map will return null for get(new Integer(5));

Maybe you are looking for

  • I have photos in photoshop that did not transfer

    I have photos in my photoshop that did not transfer to Adobe Revel.  What can I do about this?  I don't want to lose them!

  • IPhoto 9.6 won't upload new pics/confuses thumbnails

    So frustrated! I upgraded my MacBook Pro to OX Yosemite 10.10.1 and iPhoto to 9.6... everything should be up to date. But when I opened iPhoto to import new pictures, it pretends to upload them but doesn't actually. In my "Last Uploaded" folder, ther

  • How do I restore Firefox/Google home page without Yahoo?

    In an attempt to delete Yahoo, my Home Page which features Google changed entirely and still shows Yahoo with all its add ons. Also now when closing a link page Mozilla shuts down and I have to start all over again. How can I restore what I had and t

  • HU : external HU to be packed in inbound delivery

    hi experts, scenario : process order goods receipt will be done to HU managed sloc. no WM inegration . inbound delivery will be created at the time of proces order GR. we will get HU number from legacy , we need to pack that HU in the inbound deliver

  • Doctype for Safari

    Hello Do I need a particular DOCTYPE at the head of a Web page in order to be able to see images on a Web page through Safari. I have a Web page on my C drive and can see the page formatted correctly with images showing (I am using Safari 3.2.3). How