How do I use setString() method with multiple bind variables

I have two setString() statements and a select union statement. My class compiles but only displays the data for the first table ignoring the second setString() statement. But When I replace the "where id=?" with "where id=12 or someid", it works and displays all data found in both tables.
Am I not properly using the setString() method?
public class LdData{
private String id;
public LdData(){
public void setId(String id)
    this.id = id;
  public String getId()
    return id;
public Collection getLdData() throws Exception{
                List rows = new ArrayList();
//connection statement
String sql_query="SELECT a,b FROM table1 WHERE id = ? " + " UNION " + "SELECT a,b FROM table2 WHERE id= ?";
try {
                        conn = ds.getConnection();
pstmt = conn.prepareStatement( sql_query );
pstmt.setString(1, this.id);
pstmt.setString(2, this.id);
rst = pstmt.executeQuery();
while (rst.next()) {
//dataEntry.java - contains my getter and setter
dataEntry info = new dataEntry(rst.getString("a"), rst.getString("b"), this.id);
rows.add(info);
//catch all SQLexceptions, NamingExceptions
//close all connection
return rows;
//dataEntry.java - dataEntry class
private String a;
private String b;
private String id;
public dataEntry(String a, String b, String id){
seta(a);
setb(b);
setbdate(bcode);
this.a = a;
this.b = b;
this.id = id;
public String getA(){
return a;
public String getB(){
return b;
public String getId(){
return id;
public void setA(String a){
this.a = a;
public void setB(String b){
this.b = b;
public void setId(String id){
this.id = id;
//index.jsp - displays data
<jsp:useBean id="test" class="lddata" scope="request">
<jsp:setProperty name="test" property="id" param="id"/>
</jsp:useBean>
<display:table name="${test.lddata}"/>

This just doesnt make sense to me at all. :( Could it be a naming issue? I mean both tables have the same field names but different data information
so the union will never sort and choose. And the weirdest thing is that
//this works -
->String sql_query="SELECT a,b FROM table1 WHERE id = TU234 " + " UNION ALL" + "SELECT a,b FROM table2 WHERE id= TU234";
//I also tried this, but the second statement doesnt work
->pstmt.setString(1, "TU234"); //this works.
->pstmt.setString(2, "TU234"); //this doesnt
//It also tried this, it worked for both set statements, but I need it in an list or so.
while (rst.next()) {
String a = rst.getString(a);
String b = rst.getString(b);
String id = rst.getString(id);
System.out.println(a+""+b+""+id);
}Is there anyother way I can collect the data into a jsp page without using javabean?

Similar Messages

  • How do I use your iPhone with multiple iTunes libraries

    Hi, I have my music spread out between 3 seperate Itunes libraries on 3 different profiles on my computer. I have the newest generation Ipod Nano, Ipod Shuffle, and Iphone 4s. My Ipod's are both full, so I've decided to start putting music onto my phone. With my Ipod's, I can plug them into one profile on the computer, download the music on the Itunes library that exists on that profile, then do the same with the other profiles with no issue. However when I try to do this with my phone, It asks me to erase the music I have gotten from one Itunes library and sync with the current library, as soon as I plug it in to a different Itunes on one of the other profiles. I have my Iphone configured with the Manually manage music option, and I still haven't found a way to use my Iphone with multiple music libraries. PLEASE HELP

    http://support.apple.com/kb/PH12113 - If you use manual syncing, you can sync items from more than one iTunes library to your iPod. (You can sync iPod touch, iPhone, and iPad with only one iTunes library.)
    http://support.apple.com/kb/HT1202 - When manually managing content, you can add content from multiple libraries to your iPod or iPad. Even when manually managing music, some content may be available from only one library at time. This includes all content on iPhone and video content on iPod and iPad.
    They seem inconsistent as far as the iPad is concerned but in both articles the iPhone appears to only be able to sync to one library at a time.
    Troubleshooting Home Sharing - http://support.apple.com/kb/TS2972

  • How do I refresh a table with a bind variable using a return listener?

    JDev 11.1.2.1.0.
    I am trying to refresh a table with a bind variable after a record is added.
    The main page has a button which, on click, calls a task flow as an inline document. This popup task flow allows the user to insert a record. It has its own transaction and does not share data controls.
    Upon task flow return, the calling button's return dialog listener is invoked which should allow the user to see the newly created item in the table. The returnListener code:
        // retrieve the bind variable and clear it of any values used to filter the table results
        BindingContainer bindings = ADFUtils.getBindings();
        AttributeBinding attr = (AttributeBinding)bindings.getControlBinding("pBpKey");
        attr.setInputValue("");
        // execute the table so it returns all rows
        OperationBinding operationBinding = bindings.getOperationBinding("ExecuteWithParams");
        operationBinding.execute();
        // set the table's iterator to the newly created row
        DCIteratorBinding iter = (DCIteratorBinding) bindings.get("AllCustomersIterator");
        Object customerId = AdfFacesContext.getCurrentInstance().getPageFlowScope().get("newCustomerId");
        iter.setCurrentRowWithKeyValue((String)customerId);
        // refresh the page
        AdfFacesContext.getCurrentInstance().addPartialTarget(this.getFilterText());
        AdfFacesContext.getCurrentInstance().addPartialTarget(this.getCustomerTable());But the table does not refresh ... The bind variable's inputText component is empty. The table flickers as if it updates. But no new values are displayed, just the ones that were previously filtered or shown.
    I can do the EXACT SAME code in a button's actionListener that I click manually and the table will refresh fine. I'm really confused and have spent almost all day on this problem.
    Will

    Both options invoke the create new record task flow. The first method runs the "reset" code shown above through the calling button's returnListener once the task flow is complete. The second method is simply a button which, after the new record is added and the task flow returns, runs the "reset" code by my clicking it manually.
    I'm thinking that the returnListener code runs before some kind of automatic ppr happens on the table. I think this because the table contents flicker to show all customers (like I intend) but then goes back to displaying the restricted contents a split second later.
    Yes, the table is in the page that invokes the taskflow.
    Here are some pictures:
    http://williverstravels.com/JDev/Forums/Threads/2337410/Step1.jpg
    http://williverstravels.com/JDev/Forums/Threads/2337410/Step2.jpg
    http://williverstravels.com/JDev/Forums/Threads/2337410/Step3.jpg
    Step1 - invoke new record task flow
    Step2 - enter data and click Finish
    Step3 - bind parameter / table filter cleared. Table flickers with all values. Table reverts to previously filterd values.

  • How do I use a CNiDAQmxTask with multiple channels?

    My last project from three years ago utilized Visual Studio 6.0.  I am now using VS 2005.and created a "NI MFC DAQmx  DLL".
    I used the wizard to create a CNiDAQmxTask class called CDAQmx1124VOutTask  for the 1124 card.  The class now contains six different voltage channels in the Configure function.  How do I write to a single channel? 
    Boy, C++ examples for solutions using the DAQmx Assistent are non-existent.  All I find are C# examples, or native DAQmx funtions.
    The best I have been able to come up with is this that will compile.
    CDAQmx1124VOutTask   m_1124VOut;
    m_1124VOut.Start();
    CNiDAQmxAnalogSingleChannelWriter* writer = new CNiDAQmxAnalogSingleChannelWriter(m_1124VOut.Stream);
    writer->WriteSingleSample(TRUE, 12.);
    delete writer;
    Which output on the card will end up writing the 12 volts?  Do I need to have the DAQmx Assistant create a new  CNiDAQmxTask
    for each output on the card?  Any help or example links would be greatly appreciated.
    TIA
    Eric 

    Hello Eric,
    The question of which output on the 1124 card will write the 12 volts depends on how you configured the DAQmx Task.  If you specified all six channels, then you would need to create an array of data that is 6 elements in length.  The first element in that array would be written to AO channel 0. The second element in the data array would be written to AO channel 1, and so on. So this answers the question about needing to create separate tasks for each individual channel.  It would suffice to specify all of the physical channels in one task, and then specify the voltage updates to each channel based on the entries in the array. You can find examples by going to the following (or a similar) location in the directory structure of your computer (Windows OS assumed).
    C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\MStudioVC2005\Analog Out\Generate Voltage
    Best wishes,
    Wallace F.
    National Instruments
    Applications Engineer

  • How do I use AI Temperature with multiple thermocouple types?

    Hi,
    I am trying to read temperatures from thermocouples. I have the PXI-1112 module. I have 3 thermocouple types. Is there a way to use the AI temperature VI to process all thermocouples with a single wire connection? The VI has an input for thermocouple type, but does not accept arrays. How can I assign a different thermocouple type to each channel?
    Thanks

    Hello Villalro,
    Are you using the DAQmx Create Virtual Channel.vi in your
    application?  Below is a great example of
    how to measure three different types of thermocouples all in the same task.  If you are still not able to create the task
    correctly, you might try building it in a DAQ Assistant.  Once you are able to create the task
    correctly in the DAQ Assistant, you can convert it into DAQmx code.  Right-click on the DAQ Assistant and then select
    Generate NI-DAQmx Code.
    Message Edited by Robert F on 08-08-2007 09:40 PM
    Respectfully,
    Rob F
    Test Engineer
    Condition Measurements
    National Instruments
    Attachments:
    temp_forums.JPG ‏65 KB

  • How do I use Aggregate formulas with multiple measures from different tables?

    I have three measures:
    Cash - this sums the £ column in my 'Cash' table.
    Online - this sums the £ column in my 'Online'
    table
    Phone - this sums the £ column in my 'Phone'
    table
    How do I now do aggregate formulas that combine this three measures, for example:
    Find the MIN or MAX of the three measures
    Average the three measures
    I have worked out how to use simple aggregation like add, subtract etc through the CALCULATION formula, but doing the average or MIN/MAX does not work.
    Thanks.

    Hi, thanks for the suggestions.
    Re: Julian
    I had thought about this method, unfortunately it is not always three measures so this doesn't work.
    Re: Tim
    I was not aware of the APPEND formula however I will definitely give it a try and report back - I can see this one working.
    Re: Michael
    Apologies, I have never found a an easy way of simulating some of my issues since it would mean creating a new power model and establishing quite a number of relationships. I definitely see the benefit when posting on the forum since it makes my issue far more
    accessible, unfortunately when I've posted before I've generally been racing against time and not had time to prepare this anonymised data. Is there a quick way of  doing it?

  • How do I use the cloud with multiple iPhones?

    I just got an iphone through work and I accidently added my 'personal' Apple ID on the account.  How do I remove it?  If I choose delete account will it effect my use of icloud for my personal phone?
    thanks

    Settings>iCloud, scroll to bottom of screen and tap Delete Account.  This will only disconnect the device from the account, it won't delete any data on icloud.  Then you can enter a different account ID if you want.

  • How can I use a KeyListener with multiple JTextFields?

    I am creating a program in which i need to read from whichever textfield the user chooses to enter into. reading from these textfields i can tell when enter is pressed i just cant tell where it is pressed. can anybody help me out so i can find out where enter is pressed?

    please, somebody help.

  • How do I use a switch with a null variable?

    Here is my current situation...
    I have a form that will take the inputted information in the field "LEDIR" and divide it by the information in field "AMMO".  I get errors when the form is first loaded because the field "AMMO" is blank and causes a "Divide by 0" problem.   I tried to solve the problem with a switch, but an not sure how to create a "null" switch case.  Here is what I have.. any ideas as to how I can set the second case so it returns a "0" for a null AMMO field?
    var InvR = this.getField("LEDIR").valueAsString;
    var AmmoPk = this.getField("AMMO").valueAsString;
    switch (Ammo)
    case "0":
       event.value = 0;
       break;
    case "[what do i put here?] ":
       event.value = 0;
       break;
    default:
       event.value = (Math.floor(InvR/AmmoPk))
    any ideas as to how I can set the second case so it returns a "0" when the AMMO field is empty?

    You can even stack the 'case' to create and 'OR' type of selection:
    var InvR = this.getField("LEDIR").valueAsString;
    var AmmoPk = this.getField("AMMO").valueAsString;
    switch (Ammo) {
    case "0":
    case "":
       event.value = 0;
       break;
    default:
       event.value = (Math.floor(InvR/AmmoPk))
    But it is just as easy to use:
    var InvR = Number(this.getField("LEDIR").value);
    var AmmoPk = Number(this.getField("AMMO").value);
    event.value = "";
    if(AmmoPk != 0) {
      event.value = (Math.floor(InvR/AmmoPk))

  • How can i create  excel sheet with multiple tabs using utl file?

    how can i create excel sheet with multiple tabs using utl file?
    any one help me?

    Jaggy,
    I gave you the most suitable answer on your own thread yesterday
    Re: How to Generating Excel workbook with multiple worksheets

  • How to use an Applet with multiple-jars

    Hi everybody,
    I would like to use an applet with multiple-jars.
    ex:
    <applet codebase="." archive="main.jar,Addon1.jar,Addon2.jar" code="Appl.class" id="MyTest" width="600" height="30">
         <param name = "MyParam" value = "1;2">
    </applet>
    An applet with :
    -> 1 Main JAR
    -> X Addon JARs (X : a parameter "PRM")
    My main part knows the parameter "PRM" -> knows which addon to use
    My question is, how do I use classes from addons, inside the main part (and vise-versa if possible) ?
    Thanks in advance
    Best regards

    I try what you say :
    === HTML ===
    <applet codebase="." archive="Main.jar,Addon1.jar" code="Test.Appli.class" id="MyTest"  width="600" height="30">
         <param name = "myPrm1" value = "1;2">
    </applet>=== MAIN JAR ===
    package retest;
    interface InterfAddOn1 {
        public void AfficheTest1(String sStrTest);
    public class Ctest {
        public Ctest() {}
        public void unTest(String sClassNameR) {
          String sClassName = "PackTestAddon.TestClass1";
          try {
              Object oObj = Class.forName(sClassName).newInstance();
              ((InterfAddOn1) oObj).AfficheTest1(" Hello World ");
          } catch (ClassNotFoundException ex1) {
              System.out.println("ERR Class not found");
          } catch (IllegalAccessException ex1) {
              System.out.println("ERR Illegal Access");
          } catch (InstantiationException ex1) {
              System.out.println("ERR Instantiation Exception");
    }=== ADDON JAR ===
    package PackTestAddon;
    public interface InterfAddOn1 {
        public void AfficheTest1(String sStrTest);
    package PackTestAddon;
    public class TestClass1 implements InterfAddOn1 {
        public TestClass1() {}
        public void AfficheTest1(String sStrTest) {
          System.out.println("Test :"+sStrTest);
    }I have this error :
    Exception in thread "AWT-EventQueue-2" java.lang.ClassCastException: PackTestAddon.TestClass1
         at retest.Ctest.unTest(Ctest.java:58)
         at retest.Appli.actionPerformed(Appli.java:442)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    I don't really know why ... =;o(
    Helppppp ... Thanks in advance.

  • How can I use an iPad with two itunes accounts?

    How can I use an iPad with two itunes accounts?
    Hi there
    My partner has a works iPad, which has her works Apps on (ones that are specifically made by her company and are NOT available in the App store).
    What I want to be able to do is to ALSO have my itunes account on there so that I can put all the apps I have purchased previously from my iPhone on it.
    This is so I can put on VLC player (thats already in my itunes account) so I can add videos to the iPad.
    How do I do this please?
    I tried it before by connecting it to my mac, but it wiped everything off the iPad completely and also deleted the data settings for using 3G.
    So I want to avoid this happening again the future as it had to be sent back to her head office to be sorted again.
    Any advise please?
    Thanks

    You can't. The iPad is desgined to be a 'one user' device and only really works with one apple ID at a time.
    The only way would be if she, at work and with her work apple id, downloaded your apps (repurchasing them of course).
    It's not meant to be a multiple user/multiple ID device.

  • How do you get a line with MULTIPLE fields to WRAP ?

    How do you get a line with MULTIPLE fields to WRAP ?
    Good afternoon everyone...
    THE PROBLEM: Why doesn’t a line with multiple fields WRAP?
    HYPOTHETICAL EXAMPLE/WHAT I”D LIKE TO SEE
    If I have 2 fields on a line (this is now a hypothetical example and nothing to do with my actual report)….let’s call them field A and field B. And if field A has values of all ‘X’ and field B has values of all ‘Y’…then….the normal case would be (ignore dots – only for spacing):
    A……………………… B
    XXXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYY
    But what if A is too long? I would want to see B wrap onto the next line like this:
    A……………………………………………………B
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX YYYYYY
    YYYYYYYYYYYYY
    And similarly….if B is extra long, can the line print as:
    A………………………. B
    XXXXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYYYYYYY
    YYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
    I don’t want the case where B is long and I get:
    A………………… …B…
    XXXXXXXXXXXXXXXXX YYYYYYYYYYYYYYYYYYYYYY
    ………………………..YYYYYYYYYYYYYYYYYYYYY
    I can see how you can wrap an individual field like that…but how can you WRAP a line of[b] fields within the frame so it wraps to the BEGINNING of the frame on next line?
    My SPECIFIC CASE
    I have a report that I have stripped down to a simple structure for the purposes of this explanation.
    My DATA MODEL has the main QUERY (for plant family and species data). The columns of the query are divided into 2 groups. The 1st GROUP contains the family data. Below that is the rest of the species data in a 2nd GROUP.
    Linking from the 2nd species group (above) is a new QUERY to extract REGION data based on the common key field. Under this 2nd query is another group with all the REGION columns.
    The LAYOUT MODEL has a group frame (the main , base one)
    On top of this is a repeating frame based on the 1st group (family data).
    On top of this is another repeating frame for the 2nd group (species data).
    On top of this is 2 Frames on the same line line. The 1st frame contains columns from the species group .
    The 2nd frame on this line is a repeating frame. The PRINT DIRECTION for this frame is ACROSS/DOWN. It repeats details of the REGION where the species is found. These columns come from this group come from the REGION QUERY and GROUP.
    All fields on the report line have variable horizontal elasticity.
    The problem is that when there is too much data on the line, it does NOT WRAP to the 2nd line.. It TRUNCATES.
    Can the line be made to WRAP????..
    In my current report, 1 of 2 things is happening:
    1) All fields print on the line until it hits the page boundary and then it just stops. Truncated!
    2) All fields print on the current line, then Oracle Reports throws a new page to print the REMAINDER of the long, input line
    But I would like a LONG line to continue printing onto the following line of the same page.
    I have tried all combinations of the elasticity fields and the ‘ADVANCED LAYOUT’ properties.
    I have been focussing my attention with this problem on the frames .
    We are using REPORT BUILDER V 6.0.8.26.0
    Thankyou to anyone who may offer assistance.
    Tony Calabrese.

    Steve,
    you gain 1 thing, but you lose something else!
    This thing is SO frustrating!
    Hey Steve! Good afternoon.
    I've done as you suggested....I have a long text boilerplate item - the only 1 on the line...and it has all the column in it.
    So it looks like:
    &col1 &col2 &col3 &col4 &col5 etc etc etc
    And the line expands nicely to each field's requirements.
    And when it gets to the right page boundary...it WRAPS to the next line! Beautiful!!!
    The only thing is that...when I had individual fields across the line I was able to create format triggers for those fields. And in doing so I was able to reduce the font and change the justification. I had to do that because some of the fields had to appear superscripted.
    So I wanted something like (ignore the dots):
    ...................................ppppp
    AAAA BBBB CCCCC DDDD EEEE FFFFFF
    So the field of 'ppppp' appeared slightly higher on the line than the other fields...
    I can't see how I can do this with a single TEXT field containing all the &COL values.
    Have you ever come across anything like this?
    Thankyou again,
    Tony Calabrese 12/4/2007

  • How do i use itunes server with itunes match?

    Hi all,
    I am using itunes server on my synology NAS. On my desktop i've always used itunes with match. How can I combine the two? In other words, how can i use itunes match with itunes server?
    thanx

    I don't know if you've already solved it yourself, but I had this problem too. Try signing out of iTunes Store under 'Settings', then signing back in with JUST your iTunes user name, with no '.mac' or '.me' suffix. If, for example, your usual sign-in method is '[email protected]' try using 'joebloggs'.
    Worked for me.

  • Can bookmarks be protable for multiple computers? Is it an option to log on and use my bookmarks with multiple computers and locations? Thanks

    Can bookmarks be protable for multiple computers? Is it an option to log on and use my bookmarks with multiple computers and locations? Thanks

    Profile is a folder which store all your personal data in a safe place
    * https://support.mozilla.com/en-US/kb/Profiles
    You can use this button to go to the current Firefox profile folder:
    * Help > Troubleshooting Information > Profile Directory: Open Containing Folder
    here explain how to backup profile
    * https://support.mozilla.com/en-US/kb/Backing%20up%20your%20information
    Here explain how to restore it
    *https://support.mozilla.com/en-US/kb/Recovering%20important%20data%20from%20an%20old%20profile

Maybe you are looking for

  • Parked invoices

    Please let me know the query/transaction/report for parked invoices with input as vendor and plant combination. Thanks.

  • Is Flash the solution for my problem?

    Hello All: This is a question about hyperlinks in Flash, but it is not a "how to" question, because I know that hyperlinks can be created in Flash.  More, my question is whether Flash is the right tool for what I'm interested in doing. Basically, I'm

  • Gnome login fails at first attempt

    Hi guys, I'm having a strange problem here. When I boot my notebook and try to login into Gnome, it constantly fails at the first attempt. So I click on my username, enter the (correct) password and nothing happens. I cancle it with 'esc', click on t

  • Confusion on Logical System (Idoc)

    Hi Guru's Please help me out I have two SAP System  : ex SAP A client 100 and SAP B clint 200. My Sender system is SAP A(100) and Reciver SAP B(200) I have to do ALE configuration. I got stuck in SALE Transaction is Client assignment. As i have to de

  • Implementing interface with static method?

    Hi, I need to implement an interface with a static method. I tried to do it both with the interface method static and non-static, but it don't seam to work! Does it work? How can I make a work around? Thanks!