How do I use one drop down list to refresh the list in another drop down?

I am using a drop down list full of years (i.e. 2008, 2009..etc). When I make my selection from this drop down list (say for instance I select 2009) I want it to update the available data in the second drop down list. I have the query statement set up within the JSP page but it needs to be a dynamic SQL statement based off the value I selected in the first drop down.
String sql = "SELECT GameId, GameDescription FROM Games WHERE Year = " + year;
The variable "year" is the value I need to figure out how to assign. Now this variable is a Java variable (attribute) and Im unsure how to get the value from the previous drop down and assign it to that. Basically I need the JavaScript value from the first drop down assigned to the Java attribute "year".
Anyone able to help me with this???
Thanks,
Jed

Here are my two drop down lists. As you can see I build the second list dynamically based off the value of the year. I want to be able to assign my year to the value I select in this first drop down. How do I do that?? I only want to show games for the year I select. I currently have the year hardcoded to "2009" as you see below. How can i change that to be assigned to the JavaScript value i extract from the first select box?
<select name="season">
<option value='2009' selected>2009</option>
<option value='2008'>2008</option>
</select>
<select name="gameselect">
<%
try
String year = "2009";
String connectionURL = "jdbc:mysql://localhost:3306/ElmwoodExpos";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(connectionURL, "root", "thejedster");
String sql = "SELECT GameId, GameDescription FROM Games WHERE Year = " + year;
Statement s = con.createStatement();
s.executeQuery(sql);
ResultSet rs = s.getResultSet();
while(rs.next())
%>
<option value="1"><% out.print(rs.getString("GameDescription"));%></option>
<%
catch(Exception e)
%>
</select>
Thanks,
Jed

Similar Messages

  • My husband and I both have iPhones . How do I use one account for purchases and keep the email separate when using iCloud?

    My husband and I both have iPhones . How do I use one iTunes account to share music, photos and apps, and keep our email accounts separate since all data will use the iCloud function.

    You shouldn't be using the same account on phone iphones. Have him setup his own and make sure his iCloud is logged in with that one

  • How can I use Auto Import to name files after the folder they are dropped into?

    I'm camera tethered on a new Macbook Pro Retina, Lightroom 5, all latest software and OS. Using  EOS Utility to connect and drop into a DROP folder. When Lightroom Autoimports, I would like it to rename the file after the destination folder. Capture One has this feature and I could have sworn I saw a drop down menu on one of the naming tokens in LR5 about a month ago.  ANY IDEAS?

    The closest you can come is to create a File Naming Template that includes "Custom Text" as a part of the file name.  Then, you will have to change the Auto Import Settings to use this Template when auto-importing and manually type that folder name in every time you change folders.  There is no "Folder" token of which I am aware.

  • Using One Context Node's Info in the Setter of Another

    I am very new to WebUI.
    I have a view.  In its context, it already uses context node BUILHeader .  I need to create a field based on BP_NUMBER info in BUILHeader and place the derived information on the screen.
    I created a new context node that has a field  DerivedValue in it. I think I am supposed to populate it in it's P_Setter.  How do I make he information from BUILHeader available to my setter.
    I think this is simple, but I'm new. so I need a good code example here.
    Thank you .
    ...Mike

    Hi
    Like Amar pointed out if it is possible pleae make sure that the field is also in BUILHeader context nide itself.
    If you want it to be in different context node then
    you can use me->typed_context -> "<context_node name >"
    create an attribute  "typed_context" pointing to the context class.
    "<context_node name >" --- Here you can replace the any of the context node which is present in your view!! you can use
    this anywhere inside the view. Hence you will be able to access other context nodes as well within the purview of the view.
    Thanks
    Abishek

  • How can I use ONE Text search iView to event/affect mutliple Result Sets?

    hello everyone,
    i have a special situation in which i have 6 flat tables in my repository which all have a common field called Location ID (which is a lookup flat to the Locations table).
    i am trying to build a page with a free-form text search iView on Table #1 (search field = Location ID).  when I execute the search, the result set for Table #1 is properly updated, but how do I also get Result Set iViews for Tables #2-6 to also react to the event from Text Search for Table #1 so that they are updated?
    i don't want to have to build 6 different text search iViews (one for each table).  i just want to use ONE text search iView for all the different result set tables.  but, in the documentation and iView properties, the text search iView doesn't have any eventing.
    if you have any suggestions, please help.
    many thanks in advance,
    mm

    hello Donna,
    that should not be a problem, since you are detailw with result sets and detail iviews because custom eventing can be defined for those iviews.
    Yes, it says "no records" found because an active search and record selection havent' been performed for it (only your main table does).
    So, yes, define a custom event, and pass the appropriate parameters and you should be fine.
    Creating a custom event between a Result Set iView and an Item Details iView is easy and works. I have done it.
    See page 35 of the Portal Content Development Guide for a step-by-step example, which is what I used.
    For my particular situation, the problem I'm having is that I want the Search Text iView's event (i.e., when the Submit button is pressed) to be published to multiple iViews, all with different tables.  Those tables all share some common fields, which is what the Search iView has, so I'd like to pass the search critera to all of the iViews.
    -mm

  • How can i use one SQL statement to solve problem?

    How can i use one SQL statement to solve the question below?
    For a Table named A, there is a column named F(char type).
    Now select all the records where F like '%00' and update their F value to '%01'
    Just one SQL statement.Do not use PL/SQL block.
    How to do that?
    Thanks.

    What is the data volume for this table?
    Do you expect lots of rows to have '%00' as their value?
    Following two statements come to mind. Other experts would be able to provide better alternatives:
    If you have index on SUBSTR(f, 2):
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) || '01'
    WHERE  substr(f,
                  -2) = '00';If most of the rows have pattern '%00':
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) ||
               DECODE(SUBSTR(f,
                             -2),
                      '00',
                      '01',
                      SUBSTR(f,
                             -2));

  • How can i use one iCloud Photostream on 2 devices?

    Due to a bug (or feature) on iOS 8 i can't use the same icloud id on 2 iphones:
    https://discussions.apple.com/thread/6536998
    So how can i use ONE iCloud Photostream then on 2 devices?
    Also, on OSX i can define only one Photostream.
    So, how do you import pictures from 2 streams into iPhoto?
    Familyshare is not usefull as the pictures are not in Original-Filesize!

    Hi ..
    Yes. " iPhone 6 or 6 Plus.  iPad Air 2  or  iPad mini 3"
    Set up and use Apple Pay

  • HT204053 Dear Support Team, every time i tried to logon Icloud its gives me wrong user name or password and at the end it show me error " This Apple ID is valid but is not an ICloud Account" then how can i use one account for same Apple ID and ICloud???

    Dear Support Team,
    Every time i tried to logon Icloud its gives me wrong user name or password and at the end it show me error " This Apple ID is valid but is not an ICloud Account" then how can i use one account for same Apple ID and ICloud?
    Thanks

    It is not possible to create a new iCloud account using a Windows machine. You must create the account using a Mac (10.7.5 or more) or an IOS device (iPhone etc). Once that is done you can sign into and use the account on your Windows machine.

  • How Do I Use One PC (Windows) To Run iCloud Photo Stream for Two Users?

    How Do I Use One PC (Windows) To Run iCloud Photo Stream for Two Users? I and my wife have two Iphones (iOS 6.1.4) and we want to have use 2 iCloud accounts for one PC.

    Disregard the question. The solution has nothing to do with any "Firefox bug". Turns out that my session wasn't being managed properly. Or rather, I was accidentally deleting other users' information when new users logged in. So if I had user 1 and user 2, and user 2 logged in after user 1, some of user 1's information would be deleted, resulting in the errors.
    Oops; sorry about the false alarm. :)
    (Was hoping to retract the question, but it looks like others have a similar problem.)

  • How do I use one of my photos as my wallpaper from the iPhoto app?

    Hi, As the heading says - How do I use one of my photos as my wallpaper whilst using the iPhoto app please.

    ziffos wrote:
    Yes - you assume correctly although I thought this would have been obvious seeing as we are in the iPad section of the forum.
    Obvious to you and me who are paying attention, but actually, if you look through the post topics, many people confuse iPhoto for iOS with iPhoto for the Mac. 

  • HT1660 how can I use one single library for all users on the same laptop?

    how can I use one single library for all users on the same laptop?

    You are most of the way there. Each user having access to hard drive is the key. If users are limited in file privileges this is harder.
    Any files you add to your library and any files she adds to her library are available to the other. Just not automatically. Each user must add the files to their own library using the add file or add folder option from menu bar.
    What I have done is set library location to a location outside of My Documents\My Music. On my network storage I have a folder names s:\itunes. Both accounts iTunes are set to use this location for the library.

  • 1. I have an iPod which has purchases synced with I tunes with an apple ID. I now have an iPad with a new ID for cloud. I have cloud storage capacity of 5gb which came with the iPad. How can I use one ID and store my existing music in cloud?

    1. I have an iPod which has purchases synced with I tunes with an apple ID. I now have an iPad with a new ID for cloud. I have cloud storage capacity of 5gb which came with the iPad. How can I use one ID and store my existing music in cloud?

    HI Frostyfrog
    CHeck out iTunes Match which has an annual fee of £21 or thereabouts. You can store a maximum of 25,000 songs there and they all become available on your other kit, iPhone, iPad and iPod. I know it works as I have over 23000 songs uploaded of which only a few we're bought through iTunes.
    it works by comparing your music to the whole iTunes music dadata base so you access the same tunes that you could get from iTunes. If you have obscure stuff, it uploads your own music to the cloud as a copy.
    I Find it incredible that on my iPhone with its 16gb memory I can view almost 200 gb of music (ie my 23000 songs) and play any of them. Anything I add to iTunes becomes available via the cloud fairly quickly from a few minutes or a little longer if adding a lot.
    The first time you use it it will take quite a while to match your music if you have a lot, but after that it is all automatic. Read the stuff on the apple site. Your PC needs to be at least running Vista. I recommend it and at less than 50p a week it's good value.
    Good luck

  • I have 2 apple id's. But i want my music on iTunes common on both id's. I use one ID on my iPad and the other on my family iMac.  how do i do it?

    I have 2 apple id's. But i want my music on iTunes common on both id's. I use one ID on my iPad and the other on my family iMac.  how do i do it?

    Settings>Store...tap the ID shown...sign out...now sign back in with the ID you want to use.

  • How do you use one managed session bean from another?

    Hello -
    I am a complete newbie to JSF coming from Struts 1. My question is how do you use one managed bean from the method of another one? I think this would be a common senario. For example I put a bean in session scope when a user logs in and in a different method within a different bean I want to get some of this user's information. What is the correct way to retireve one bean from a method in another with session scope?
    Also what would the code look like to retieve another bean from the method of a managed bean where the bean you want to retrieve has application scope?
    Thank you in advance.

    Sinplicity wrote:
    Could you be a bit more specific? If a bean is configured in the faces config file then all of it's properties are managed, correct?Not necessarily.
    What would the code look like to retireve the bean?You don't retrieve it, it has been injected.
    Can I retrieve the whole bean or just a property of the bean. I would be really interested in seeing how this is done in code? And would really love a bit more information on what it means to be a managed property?Time to consult a JSF tutorial.

  • How to refresh the list of select one choice which is inside a table?

    Hello I am using Jdeveloper Version 11.1.2.1.0.
    The table is a normal table that is made to look like a treeTable.
    For some rows are or can be parents with Parent_vo_group_id = null and other are children with parent_vo_group_id = vo_group_id of the parent...
    If a children changes its parent_vo_group_id to null it can become a parent as well.
    I am having a select one choice inside a table column. The list comes from the same table with column Name:
    <af:table value="#{bindings.VoGroupAdminView2.collectionModel}" var="row"
                                                      rows="#{bindings.VoGroupAdminView2.rangeSize}"
                                                      contentDelivery="immediate"
                                                      visible="#{bindings.VoGroupAdminView2Iterator.currentRow != null}"
                                                      fetchSize="#{bindings.VoGroupAdminView2.rangeSize}"
                                                      partialTriggers="::soc1" styleClass="AFStretchWidth"
                                                      rowBandingInterval="0" editingMode="clickToEdit"
                                                      binding="#{adminGroupManagementBean.groupTable}"
                                                      selectionListener="#{adminGroupManagementBean.groupSelectionListener}"
                                                      rowSelection="single" id="t5">
                                                <af:column sortProperty="#{bindings.VoGroupAdminView2.hints.Name.name}"
                                                           sortable="false" styleClass="columnData"
                                                           headerClass="tableHeader"
                                                           headerText="#{bindings.VoGroupAdminView2.hints.Name.label}"
                                                           id="c1">
                                                    <af:inputText value="#{row.bindings.Name.inputValue}"
                                                                  requiredMessageDetail="Please enter a group name"
                                                                  label="#{bindings.VoGroupAdminView2.hints.Name.label}"
                                                                  required="true" id="it7" immediate="true" autoSubmit="true"
                                                                  columns="#{bindings.VoGroupAdminView2.hints.Name.displayWidth}"
                                                                  maximumLength="#{bindings.VoGroupAdminView2.hints.Name.precision}"
                                                                  shortDesc="#{bindings.VoGroupAdminView2.hints.Name.tooltip}"
                                                                  contentStyle="#{row.ParentVoGroupId eq null? 'font-weight:bold' : 'padding-left:20px'}"
                                                                  valueChangeListener="#{adminGroupManagementBean.groupNameChangeListener}"
                                                                  partialTriggers="soc2">
                                                        <f:validator binding="#{row.bindings.Name.validator}"/>
                                                    </af:inputText>
                                                </af:column>                                   
                                                <af:column sortProperty="#{bindings.VoGroupAdminView2.hints.ParentVoGroupId.name}"
                                                           sortable="false" styleClass="columnData"
                                                           headerClass="tableHeader"
                                                           headerText="#{bindings.VoGroupAdminView2.hints.ParentVoGroupId.label}"
                                                           id="c4">
                                                    <af:selectOneChoice value="#{row.bindings.ParentVoGroupId.inputValue}"
                                                                        label="#{row.bindings.ParentVoGroupId.label}"
                                                                        simple="true" immediate="true"
                                                                        required="#{bindings.VoGroupAdminView2.hints.ParentVoGroupId.mandatory}"
                                                                        shortDesc="#{bindings.VoGroupAdminView2.hints.ParentVoGroupId.tooltip}"
                                                                        id="soc2" autoSubmit="true"
                                                                        unselectedLabel="&lt;null&gt;"
                                                                        valueChangeListener="#{adminGroupManagementBean.parentIdValueChangeListener}"
                                                                        visible="#{row.bindings.ChildrenCount.inputValue eq 0 ? true : false}">
                                                        <f:selectItems binding="#{adminGroupManagementBean.selectOneChoiceList}"
                                                                        value="#{row.bindings.ParentVoGroupId.items}"
                                                                       id="si2"/>
                                                    </af:selectOneChoice>
                                                </af:column>
                                            </af:table> My select one choice uses the same iterator as the table.
    <iterator Binds="VoGroupAdminView2" RangeSize="-1" DataControl="AppModuleDataControl"    id="VoGroupAdminView2Iterator"/>The table uses this view called VoGroupAdminView:
    Select t1.vo_Group_id,     
           t1.name,
           t1.Vehicle_Owner_Id,
           t1.Graphical_Symbol,
           t1.Lm_Comment,
           t1.Parent_Vo_Group_Id ,
           decode (t2.children_count, null, 0, t2.children_count) as children_count
           from
    (SELECT VoGroup.vo_Group_id,     
           VoGroup.name,
           VoGroup.Vehicle_Owner_Id,
           VoGroup.Graphical_Symbol,
           VoGroup.Lm_Comment,
           VoGroup.Parent_Vo_Group_Id
      FROM VO_GROUP VoGroup
    START WITH VoGroup.Parent_Vo_Group_Id IS NULL
    CONNECT BY VoGroup.Parent_Vo_Group_Id = PRIOR VoGroup.Vo_Group_Id
    order SIBLINGS by VoGroup.name) t1,
    (select parent_vo_group_id, count (parent_vo_group_id) as children_count from vo_group
    group by parent_vo_group_id) t2
    where t1.vo_group_id = t2.parent_vo_group_id (+)the ParentVoGroupId attribute has list of values from this view object called VoGroupAdminLov:
    SELECT
        VO_GROUP.NAME,
        VO_GROUP.VEHICLE_OWNER_ID,
        VO_GROUP.PARENT_VO_GROUP_ID,
        VO_GROUP.VO_GROUP_ID
    FROM
        VO_GROUP
    WHERE  VO_GROUP.PARENT_VO_GROUP_ID is null
    and VO_GROUP.VO_GROUP_ID <> ?
    order by  VO_GROUP.NAMEI want to refresh the list of values in the select one choice everytime when i add a new row in the table, delete row in the table or change the value of select one choice component.
    What I have tried:
        public void parentIdValueChangeListener(ValueChangeEvent valueChangeEvent) {
            this.setValueToEL("#{row.bindings.ParentVoGroupId.inputValue}", valueChangeEvent.getNewValue());
            BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding voGroupAdminIterator = (DCIteratorBinding)bc.get("VoGroupAdminView2Iterator");
            Key selectedGroupKey = voGroupAdminIterator.getCurrentRow().getKey();
            AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
            am.getTransaction().postChanges();
            am.getVoGroupAdminView2().executeQuery(); //refresh the table view object;
            am.getVoGroupAdminLov1().executeQuery(); //refresh the list of values view object
            voGroupAdminIterator.invalidateCache();  //remove the cache of the iterator
            voGroupAdminIterator.setCurrentRowWithKey(selectedGroupKey.toStringFormat(true)); // set the selected row again.
            RichSelectOneChoice soc =
                (RichSelectOneChoice)FacesContext.getCurrentInstance().getViewRoot().findComponent(":pt1:t5:soc2");
            AdfFacesContext.getCurrentInstance().addPartialTarget(soc);
            AdfFacesContext.getCurrentInstance().addPartialTarget(this.groupTable);    
        }When i am adding a new row to the table its select one choice list is refreshed but only for the new row. The rest rows have not updated list of values for their select one choice components.
        public String addGroupButtonAction() {
            AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
            ViewObjectImpl voGroupAdminView = am.getVoGroupAdminView2();
            Row newRow = voGroupAdminView.createRow();
             newRow.setNewRowState(Row.STATUS_INITIALIZED);
            voGroupAdminView.insertRowAtRangeIndex(0, newRow);
            am.getTransaction().postChanges();
            return "null";
        }Edited by: 897833 on Mar 19, 2012 9:07 AM

    I made a button to refresh the value of select one choice and it doesn't work yet.
    So I just move one of the
        public String refreshParentIdSOCButtonAction() {
            BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding voGroupAdminIterator = (DCIteratorBinding)bc.get("VoGroupAdminView2Iterator");
            Key selectedGroupKey = voGroupAdminIterator.getCurrentRow().getKey();
            AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
            am.getTransaction().postChanges();
            am.getVoGroupAdminView2().executeQuery();
            am.getVoGroupAdminLov1().executeQuery();
            voGroupAdminIterator.invalidateCache();
            voGroupAdminIterator.setCurrentRowWithKey(selectedGroupKey.toStringFormat(true));
            AdfFacesContext.getCurrentInstance().addPartialTarget(this.parentIdSelectOneChoice);  //refresh the binded SOC as you said
            AdfFacesContext.getCurrentInstance().addPartialTarget(this.parentIdSelectOneChoiceList); //refresh the binded list even
            AdfFacesContext.getCurrentInstance().addPartialTarget(this.groupTable); //refresh the table it is in;
            return null;
        }Edited by: 897833 on Mar 23, 2012 2:58 AM

Maybe you are looking for

  • Question about webservice and wsdl file

    Hi All. I have this scenario , the customer wants to send some information as they happen The customer wants to use a web service to our database(JDBC) I understand that from this requirement , I have to develop the Object in PI , and create the wsdl

  • Artifacts In DVD

    I have a I DVD (I DVD 6) project that i have burned to 2 different DVD's ( One Printable & 1 Non Printable- Both Verbatim DVD-R) and i keep getting Artifacts in the 5 same spots. I have checked the Original Mini DV tape and the I Movie project and th

  • Page Can't Be Displayed when trying to Clone PC's MAC?

    I'm running Road Runner High Speed Online on Windows XP, with a cable modem, WRT54G vers. 6, I upgraded the firmware recently to 1.01 and reset it. When I try to configure my router to work with dynamic IP addresses, on the setup page I click the Clo

  • Upgrade issue in ECC6.0 for include structure

    Hi All, I have the following issue while upgrading to ecc6.0. data:begin of it_cats,         include structure cosp,       end of it_cats. I am geeting syntax error as include structure is not allowed in ecc6.0.What is the replacement for this? Thank

  • How to crete Button through ABAP programming

    Hello Friends, I am creating 2 selection screens through ABAP code and using them in my Tabstrip control also created through ABAP programming. Can I also create button on the selection screen through abap programming. If yes then how, and how to ass