JSP -- default list selection

I am working on an application that is using something like this
<option value="0" <%if(selected_in.equals("0")) %><%="selected"%><%;%>>12:00am</option> to populate a list. I need to have a default value assigned to this based on username that is being passed in from the database. How do I assign a default value to a list in JSP when the value has to be a variable that is pulled in from a database?

I am working on an application that is using
something like this
<option value="0" <%if(selected_in.equals("0"))
%><%="selected"%><%;%>>12:00am</option> to populate
a list. I need to have a default value assigned to
this based on username that is being passed in from
the database. How do I assign a default value to a
list in JSP when the value has to be a variable that
is pulled in from a database?<option value="0" <%= selected_in.equals("0") ? "selected" : ""%>>
Tien-Chih Wang

Similar Messages

  • Disable Spark List selection indicator

    How do I get rid of the Spark List selection indicator entirely?  I don't want the rectangular indicator when the mouse hovers over an item, and I don't want the color to change when the mouse is clicked.

    You'll have to extend default item renderer (ItemRenderer for instance) and set autoDrawBackground to false. And then use your item renderer in a list.
    See this document for more information on spark item renderers.

  • Creating a databound JSP pop-list (with dependent values)

    I was able to create a databound JSP pop-list from the "How To Create a Databound Pop-list with Oracle JDeveloper 10g" article. Where would I have to modify the code so that I can define a WHERE clause to the DepartmentView object so that only a subset of values are displayed? My goal is to try to create pop-lists so that the values of pop-list #2 is dependent on the current value in pop-list #1.

    You can create both static values and also
    values based on record group .
    I think you know how to create static values.
    (for static just give the values in "Element List" property of list item)
    Using Record group. see this example.
    Declare
    Rg_Id RecordGroup;
    Rg_Name varchar2(20) := 'Type';
    List_Id Item;
    Temp Number;
    Rowcount Number;
    Begin
    Rg_Id := Find_Group('Type');
    If Not Id_Null(Rg_Id) Then
    Delete_Group(Rg_Id);
    End If;
    Rg_Id := Create_Group_From_Query('Type','select empno,'
    &#0124; &#0124;'empno'
    &#0124; &#0124;' from emp ');
    List_Id := Find_Item('CTRL_BLOCK.IT_LIST');
    Temp := populate_Group(Rg_Id);
    Populate_List(List_Id,Rg_Id);
    End;
    In the selection you must give two columns one for label and another one for value.
    Try this and let me know if you have any problem.
    Regards,
    viji.
    null

  • New currency code in default list in shopping cart

    Hi Gurus
      We are using SRM 4.0. When you create a shopping cart, you get a list of currencies to choose from. how does that default list gets populated. How can I get a new currency code to be populated in that default selection list.
    thanks
    Edited by: gary022 on Jun 12, 2011 6:34 AM
    Edited by: gary022 on Jun 12, 2011 6:35 AM

    Hi Ricardo,
    Thanks for your response. Just to make it clear so values will appear as per what user has been using previously. Could you please tell me if there is way I can update these user favourites.
    This is a new currency. And in shopping cart there is no option to enter it or search for it. I dont know how to get it to the shopping cart list so that user can create a shopping cart.
    Thanks
    Gary

  • Setting a custom default List View-

    When in List View I have created by own "custom" list by sliding the items (Name, Time, Artist, Rating, Year, etc) left and right in the order I want....
    But I have to do this for every new Playlist I create.
    Is there way to set your own "default" list view, or copy an existing view?
    I'm using iTunes 9.

    The view for all new playlists will be copied from your Library - Music view.
    To update playlists to match your current library view see this -> Assimilate View Options v2.2
    "This script re-creates a selected playlist (excepting playlists within folders and the "special" playlists Purchased, Podcasts, iTunes DJ (Party Shuffle), Audibooks, TV Shows, and Movies) so its View Options are the same as the main Music library (taking advantage of the fact that new playlists acquire the Music library's View Options)."

  • How can i clear the textfield and the list selections?

    How can i clear the textfield and the list selections?
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    <applet code="ListDemo" width=300 height=400>
    </applet>
    public class ListDemo extends Applet implements ActionListener {
    List os, browser;
    String msg = "";
    String text;
    String named = "";
    TextField name;
    Button Ok, reset;
    public void init() {
    Ok = new Button("Ok");
    reset = new Button("reset");
    add(reset);
    add(Ok);
    reset.addActionListener(this);
    Ok.addActionListener(this);
    Label namep = new Label("Name: ", Label.RIGHT);
    name = new TextField(12);
    add(namep);
    add(name);
    name.addActionListener(this);
    os = new List(4, false);
    browser = new List(4, false);
    os.add("default");
    os.add("BMW");
    os.add("BENZ");
    os.add("Lexus");
    os.add("Acura");
    browser.add("default");
    browser.add("Red");
    browser.add("Black");
    browser.add("Silver");
    browser.add("Blue");
    browser.add("Yellow");
    browser.add("Pink");
    browser.add("Grey");
    browser.add("Blue/Black");
    os.select(0);
    browser.select(0);
    add(os);
    add(browser);
    os.addActionListener(this);
    browser.addActionListener(this);
    public void actionPerformed(ActionEvent ae) {
    String str = ae.getActionCommand();
    if(str.equals("Ok")){
    text = "You pressed Ok";
    else
    if(str.equals("reset")){
    browser.select(0);
    os.select(0);
    text = "";
    repaint();
    public void paint(Graphics g) {
    g.drawString("Name: " + name.getText(), 6, 120);
    int idx[];
    msg = "Current Car: ";
    idx = os.getSelectedIndexes();
    for(int i=0; i<idx.length; i++)
    msg += os.getItem(idx) + " ";
    g.drawString(msg, 6, 140);
    msg = "Current Color: ";
    msg += browser.getSelectedItem();
    g.drawString(msg, 6, 160);
    g.drawString(text, 6, 200);

    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    <applet code="ListDemo" width=300 height=400>
    </applet>
    public class ListDemo extends Applet implements ActionListener {
    List os, browser;
    String msg = "";
    String text;
    String named = "";
    TextField name;
    Button Ok, reset;
    public void init() {
    Ok = new Button("Ok");
    reset = new Button("reset");
    add(reset);
    add(Ok);
    reset.addActionListener(this);
    Ok.addActionListener(this);
    Label namep = new Label("Name: ", Label.RIGHT);
    name = new TextField(12);
    add(namep);
    add(name);
    name.addActionListener(this);
    os = new List(4, false);
    browser = new List(4, false);
    os.add("default");
    os.add("BMW");
    os.add("BENZ");
    os.add("Lexus");
    os.add("Acura");
    browser.add("default");
    browser.add("Red");
    browser.add("Black");
    browser.add("Silver");
    browser.add("Blue");
    browser.add("Yellow");
    browser.add("Pink");
    browser.add("Grey");
    browser.add("Blue/Black");
    os.select(0);
    browser.select(0);
    add(os);
    add(browser);
    os.addActionListener(this);
    browser.addActionListener(this);
    public void actionPerformed(ActionEvent ae) {
    String str = ae.getActionCommand();
    if(str.equals("Ok")){
    text = "You pressed Ok";
    else
    if(str.equals("reset")){
    browser.select(0);
    os.select(0);
    text = "";
    name.setText("");
    repaint();
    public void paint(Graphics g) {
    g.drawString("Name: " + name.getText(), 6, 120);
    int idx[];
    msg = "Current Car: ";
    idx = os.getSelectedIndexes();
    for(int i=0; i<idx.length; i++)
    msg += os.getItem(idx) + " ";
    g.drawString(msg, 6, 140);
    msg = "Current Color: ";
    msg += browser.getSelectedItem();
    g.drawString(msg, 6, 160);
    g.drawString(text, 6, 200);

  • How can I get a drop-down list selection also be selected in another field with the same list but a different name?

    I have a street address and a billing address. A question is posed with a checkbox — "Is the billing address the same as the street address?" If Yes is checked, the street address automatically fills the billing fields. If No is checked, the user must fill in new information. In both the street address and billing addres, the State field is a drop-down list. How can I get the drop-down list selection in the street address State also be selected in drop-down list for the billing address State?

    Has anyone done this?

  • USB shared printer not showing up in 10.5.8 default list

    Ugh - so I've spent half a day Googling and reading stuff but so far - no joy. I'm trying to print to a Brother HL-5240 printer connected via USB to a G4 Power Mac running 10.5.8 (I could print from all my machines when everything was running 10.4.11 - this is why I put off upgrading ... ) - and here's the rub:
    - printer sharing is turned 'on' on that host G4 server that the printer is directly connected to via USB
    - a 2.1GHz G5 iMac running 10.5.8 on my network (LAN) sees the printer when I go to add a printer from sys prefs and it shows up in the default list - I can print to it
    - a G4 1.5GHz PB (wi-fi), a G5 2.0GHz DP Power Mac (LAN) and an Intel Mac Mini (LAN) all running 10.5.8 cannot see the printer - it doesn't show up in the default list on any of those machines
    - I have installed the drivers (both CUPS and PostScript) directly from Brother's site, along w/ an update also from Brother's site on all machines
    - I tried to run the firmware update from Brother's site but it informed me my HL-5240 has the most up-to-date firmware so it was not needed
    - when I plug the printer into USB on my G4 PB mentioned above to test, the G4 Power Mac host server can see it - but not the other way around (???)
    I am frustrated out of my mind and totally stumped. If it didn't work at all, that'd be one thing - but that a G5 iMac can see and print to it perfectly, but none of my other machines (G4, G5 and Intel) can is *%$&#^$ messed up (that and how it worked plugged in to my PB but not the other way around) - so it's clearly being shared OK by the G4 Power Mac server. But why can only one of four machines see and print to it?
    Any suggestions would be über-awesome - Terminal commands, whatever. I just want to be able to print - blasted 10.5 ...
    cheers

    What happens when you click onto "Finder" at the top left corner of the screen and choose "Preferences"? Do you see servers connected to? anything missing there? maybe fiddle around with those general settings?
    You can also just ctrl-click on the shared folder in finder and make an alias. That's the way i'd do it.

  • UI - How to make Columns in a Drop Down List Selection?

    I am altering a code from Peter Kahrel "Beginning Script UI". I am trying to make a searchable drop down list that will have 4 columns. So far, the search works and I have headings in the search, but I cannot seem to make the columns for the actual data. I believe I need to change the type_ahead since the array is looking at this data. I'm stuck in the water. Can someone tell me what I need to do to get the list to show up as columns? How do I turn the picked = type_ahead data into four columns? Code and Screenshot below:
    picked = type_ahead (["bat", "bear", "beaver", "bee", "cat", "cats_and_dogs",
    "dog", "maggot", "moose", "moth", "mouse"]);
    function type_ahead (array)
    var w = new Window ("dialog", "Quick select");
    var entry = w.add ("edittext", [0, 0, 800, 22]);
    entry.active = true;
    var list = w.add ("listbox",  [0, 0,800, 500], "",
    {numberOfColumns: 4, showHeaders: true,
    columnTitles: ["Non-Approved Word", "Approved Alternative", "Approved Use", "Non-Approved Use"], columnWidths: [200,200,200,200]});
    list.selection = 0;
    entry.onChanging = function ()
    var temp = this.text;
    list.removeAll ();
    for (var i = 0; i < array.length; i++)
    if (array[i].toLowerCase().indexOf (temp) == 0)
    list.add ("item", array[i]);
    if (list.items.length > 0)
    list.selection = 0;
    entry.onChange = function () {w.close (1)}
    if (w.show () != 2)
    return list.selection.text;
    else
    w.close ();

    Hi Peter,
    This is one of those developments that push the limits of my knowledge-base and when things do that, I lose sleep until I figure it out. With that said :-) here is where I have ended up.
    Basically I made a new array for the table data.  I then use an array lookup to sort the array in the listbox based on the 0 array item. See the code below. Once it is loaded type in "b" and the list will start to sort.
    I need to try to get this to work as a pallete instead of a dialog box. Do palletes support this type of functionality?
    var newarray = new Array(
    new Array('Butterfly ','has wings','can fly'),
    new Array('bohemith moth','has wings','cannot fly very good'),
    new Array('word 3','replacement word','use case'));
    picked = type_ahead (newarray);
    function type_ahead (array)
    var w = new Window ("dialog", "STE Checker");
    var entry = w.add ("edittext", [0, 0, 800, 22]);
    entry.active = true;
    var list = w.add ("listbox",  [0, 0,800, 500], "",
    {numberOfColumns: 3, showHeaders: true,
    columnTitles: ["Column 1",  "Column 2", "Column 3" ], columnWidths: [200,200,400]});
    list.selection = 0;
    entry.onChanging = function ()
    var temp = this.text;
    list.removeAll ();
    for (var i = 0; i < array.length; i++)
    if (array[i][0].toLowerCase().indexOf (temp) == 0)
    with (list.add ("item", array[i][0]))
    subItems[0].text = array[i][1];
    subItems[1].text = array[i][2];
    if (list.items.length > 0)
    list.selection = 0;
    entry.onChange = function () {}
    if (w.show () != 2)
    return list.selection.text;
    else
    w.close ();

  • Gnome: mime types, file associations and defaults.list

    I installed the new Gnome 2.8 during the weekend and now my file type associations is completely bloated. The mime system is intact - Nautilus recognises files properly. However, Nautilus doesn't know which applications to open a specific file with. I have read other posts and found useful information, but not the solution.
    This post in FedoraForum gave me a hint to what's causing the problem:
    http://fedoraforum.org/forum/showthread … post127530
    It seems that the file defaults.list is missing from /usr/share/mime/applications. Apparently this file contains the associations  between applications and mime types. I have not be able to find out which package should provide this file or how to recreate it. Can anyone help - maybe provide the name of the package that provides this file?
    Thanks,

    Yeah, I got tired of Evolution not knowing about opening *.docs in openoffice.  After several hours of research, the key is the /usr/share/applications/mimeinfo.cache,  /opt/gnome/share/applications/mimeinfo.cache, and the MimeType fields in the *.desktop files.  The mimeinfo.cache in /usr was empty and the /opt one had gthumb and other apps but no OO:
    [MIME Cache]
    application/x-gnome-stones=gnome-stones.desktop
    image/jpeg=gthumb.desktop
    application/postscript=ggv.desktop
    ...snip...
    That's a lot of blather to say that the fix for Evolution/OpenOffice was to add the proper MimeType entry to /usr/share/applications/ooo645writer.desktop:
    MimeType=application/vnd.ms-word;application/msword
    and then run "update-desktop-database".  Problem solved.
    Another problem is that within Evolution it says an attached doc is a "application/msword" and not a "Microsoft Word Document".  Unfortunately this is because freedesktop.org decided to use application/vnd.ms-word instead of application/msword like the rest of the world.  If you check the vnd.ms-word entry in /usr/share/mime/packages/freedesktop.org.xml it defines an alias msword but the new mime system doesn't appear to recognize aliases yet.  The solution I used was to rename the entry to msword.  Another possible solution might be to remove the msword alias from the vnd.ms-word entry and create a new msword entry based on the vnd.ms-word one.  Then run "update-mime-database /usr/share/mime".  Hope that made sense.
    I think the defaults.list is part of the previous GNOME MIME setup cause I don't have one and I'm not experiencing any problems.  For other apps check for the associations in the mimeinfo.cache's and if missing add the MimeType's to the app's *.desktop.

  • Query Report - To display additional column in list selection box.

    Hi,
    There is query report where i want to display the additional column in list selection.
    Below is the system query report, where parameter passed is card code.
    When the cardcode - list selection is clicked system displays 2 columns i.e. Customer Code & No. of Records.
    Now in the same list selection; is it possible to display the customer name along with cardcode only for reference.
    SELECT T0.DocDate, T1.SlpName, T2.Name, T0.DocDueDate, T0.DocNum,    (CASE WHEN T0.DocStatus = 'O' THEN 'Open' ELSE 'Closed' END) AS Status,    T0.DocTotal FROM OQUT T0 LEFT JOIN OSLP T1    ON T0.SlpCode = T1.SlpCode LEFT JOIN OCPR T2 ON T0.CntctCode = T2.CntctCode WHERE T0.CardCode = N'[%0]'    ORDER BY T0.DocNum DESC
    Kindly let me know the details.
    Thanks & Regards,
    Yogesh Jadav

    Hi Yogesh Jadav,
    The answer is NO.  You may only display either code or name but not both.
    Thanks,
    Gordon

  • How do I get a longer list of items in the history window - and not have to click "Show All History"? The default list is too short.

    How do I get a longer list of items in the history window - and not have to click "Show All History"? The default list is too short.

    Well I figured it out… all you do say show commands :-/

  • List selection bean

    Does anyone know where I could grab a "list selection bean" of some sort...I'm thinking the kind of widget that shows two lists. The list on the left is all available options while the list on the right can have 0 to n entries. The user selects items from the left list and puts them in the right, or removes items from the right list putting them back in the left list by pushing buttons with right/left facing arrows (or whatever) located in the center of the dialog between the two lists. Buttons on the bottom include the typical "OK", "Cancel". I'm writing some displays that require this sort of dialog to gather info from a user and am hoping I don't have to re-write the bean as I imagine several people have already accomplished this!
    Thanks!
    Dove

    It is actually not too hard to write. Create a JPanel with a TableLayout or a BorderLayout. Insert a JScrollPane each with a JList on the left and right. Grab both JList model's so you can insert/remove directly to the model. Now, in the event handler of --> you do something like:
    Object o[] = leftList.getSelectedValues();
    for (int cntr = 0; cntr < o.length; cntr++)
    rightListModel.addElement(o[cntr]);
    leftListModel.removeElement(o[cntr]);
    This would get any selected items on the left, move them to the right and remove them from the left. You would probably have to add:
    rightList.updateUI();
    leftList.updateUI();
    just to be sure both repain themselves.
    I believe that is all I used. Works great. Then, when you are ready, you get the selectedValues() from the rightList object and you are set to do what you need. Moving one or many is the same code, and the reverse is done just as easily. Removing all from either side is just as easy as well.

  • Tile List selection after pressing embedded Image button

    Hi;
    I am working on SAP Work Manager 6.0 customizing using Agentry 6.1.3. I have this tile list that contains items. At the bottom of this tile list, I have a button that targets the selected item on the tile list. This button has an action which changes the icon  of the selected item when pressed and also executes an edit transaction that prints/changes the selected item property values based on rules. After selecting a particular item from the tile list and clicking on this button, the selected item's image changes to the image that I want, but the selection highlighter toggles and always moves to the first item on the tile list. I have tried implementing a list selection but it somehow always ignores this and always toggles back to the first item on the tile list. I would like it to stay on the selected item, whose image has just been changed. How would I go about having the selection highlighter stay on the same item before and after pressing the button?
    Your help is greatly appreciated!
    Thanks in advance!
    Sizo Ndlovu

    Hi Jason;
    Thank you for the prompt response.I'm using the .NET client to test on the development machine and the application is deployed onto an Android 4.0.4 device. I have tried implementing this as shown below:
    The action steps:
    The Navigation step:
    The List Selection step:
    The List Selection rule:
    I have also tried implementing this using the navigation only or the list selection only, with no success.
    Thanks and Regards;
    Sizo Ndlovu

  • Alert is not working for mutiple times for list "select" function in sapui5 XML view

    Hello All,
    I am trying to open an alert for multiple times for list "select" function. But it's opening for only one time .
    Please find code below.
    View Part
    <List id="contactedit" select="somefunction">
        <CustomListItem id="custom1" type="Inactive" >
    <content>
    <Label text="this is label" />
    </content>
    </CustomListItem>
    </List>
    Controller Part
    somefunction: function(oEvent){
    alert("this is an alert");
    Thanks in Advance
    D.Mohanbabu

    I think I saw this question in stack overflow. And I answered it :-)
    I believe that it is because you can only one item in the list and once the item is selected, re-selecting it will not fire the event.
    Try adding more items to the list and select different items.
    Thanks
    -D

Maybe you are looking for

  • How to replace a qualified table with Tuple

    Hi Experts! I have a Qualified table woth 2 non qualifiers,which refer to 2 lookup flat table and one text field which is Qualifier. Now I want to replace this design with tuple.Please give me steps to do so and also how is the linking of field relat

  • Newbie -- HTTP Status 500 - Internal Server Error ??

    Hello I am a php guy moving into the world of jsp. I am getting an error on my page that I do not understand. I am trying to do my first jsp page, a hello world sort of test page. here is the content of my page <%@ page contentType="text/html" %> <%@

  • MacBook Pro attempts to power up with the lid shut

    My MacBook Pro attempts to start up with the lid shut. The apple on the lid lights up and I can hear the hard drive attempt to boot up. I have recently had the logic board replaced. I have tried to put the computer to sleep before closing the lid but

  • TS3367 audio breaks while using FaceTime video

    Since installing IOS7, the audio breaks up on my FaceTime video calls to my grandchildren. They have no trouble hearing me but have not 'upgraded' to IOS 7.  The problem is not my wifi-coincidentally I had FaceTimed in the am, updated to IOS 7, and t

  • Convert document into string with unicode

    I want to convert my document into string with all <,>,& to be converted into <, >, and &. When I am doing transformation, I am getting <,> etc. Can anybody suggest me how to do that. regards, Ranjan