How can I display a list of records from a JSP to my Midlet ??

Hi there !
I'm new in J2ME. I have been strugling with this problem for weeks now. All I find on the net is some theory and is not helping me much. Here the deal
I have created a Midlet that shoud display a certain list which is from the remote database. The list comes from a JSP file in the server. When I use the browser I can see the list.
The problem comes when I have to take the same list and output it in my midlet file. Then finding the selected index of the selecte item of the same list and using it somewhere else.
I would appreciate it if somone could help me !!
My head is speaning now !!! If you want me to post my code so one could identidy the proble, I don't mind !! Help please !!

Here is my Code !!
             String url = "http://10.2.25.3:8080/CreateAppointment/doctorsList.jsp";
    String dateUrl = "http://10.2.25.3:8080/CreateAppointment/date.jsp";
   String myUsername,myPassword;
   // Custom declaration code starts here
   public CreateAppointment_GUI()
            //Creating a login Form
            loginScreen = new Form("Login");
            //Login form Textfields
            username = new TextField("Username:", null, 200, TextField.ANY);
            password = new TextField("Password:", "Initial text", 200, TextField.ANY|     TextField.PASSWORD);
            loginScreen.append(username);
            loginScreen.append(password);
            //Adding the commands
            loginScreen.addCommand(loginCommand);
            loginScreen.addCommand(cancelCommand);
            loginScreen.setCommandListener(this);
            loginScreen.setItemStateListener(this);
            // Creating my selection list
            String[] selectionList = { "1.Appointments", "2.Add New Patient", "3.Patient Details" };
            listSelectAction = new List("Select Action", List.IMPLICIT, selectionList, images);
            listSelectAction.addCommand(backCommand);
            listSelectAction.addCommand(nextCommand);
            listSelectAction.setCommandListener(this);
         public void startApp() throws MIDletStateChangeException
           display = Display.getDisplay(this);
           display.setCurrent(loginScreen);
        public void pauseApp()
        public void destroyApp(boolean unconditional) throws MIDletStateChangeException
             notifyDestroyed();
        public void itemStateChanged(Item item)
   void getDoctors(String url) throws IOException {
                HttpConnection connection = null;
        InputStream is = null;
        OutputStream os = null;
        StringBuffer stringBuffer = new StringBuffer();
        TextBox textBox = null;
        String newStr =null;
        String newStr2=null;
        Vector v = new Vector();
       try {
          connection = (HttpConnection)Connector.open(url);
          connection.setRequestMethod(HttpConnection.POST);
          //connection.setRequestProperty(String key, String value)
          connection.setRequestProperty("IF-Modified-Since","20 Jan 2001 16:19:14 GMT");
          connection.setRequestProperty("User-Agent","Profile/MIDP-2.0 Confirguration/CLDC-1.0");
          connection.setRequestProperty("Content-Language", "en-CA");
          connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
          os = connection.openOutputStream();
          is = connection.openInputStream();
          int ch;
          while ((ch = is.read()) != -1) {
            stringBuffer.append((char) ch);
            System.out.print((char)ch);
               }//while
          newStr = stringBuffer.toString();
                newStr2=newStr.trim();
                int start = 0;
                position = newStr2.indexOf("%", 0);
                while ((position = newStr2.indexOf("%",start)) > -1) {
                  String aName = newStr2.substring(start,position);
                  v.addElement(aName); // store the substring
                  start = position + 1; // so the next time we start checking following the space
          String[] theNames = new String[v.size()]; // create an array big enough to store the strings
          v.copyInto(theNames); // Now theNames is a String array with the list of names
           // now we can create a List using this array:
           listDoctors = new List("Select Doctor", List.IMPLICIT, theNames,null);
           listDoctors.addCommand(backCommand);
           listDoctors.addCommand(nextCommand);
           listDoctors.setCommandListener(this);
      } //try
       finally {
           if(is!= null) {
              is.close();
           } //if
           if(os != null) {
              os.close();
           }//if
           if(connection != null) {
              connection.close();
           }//if
        }//final
     display.setCurrent(listDoctors);
    } //invoke
public void commandAction(Command c, Displayable d)
                 if (c == loginCommand)
                  myUsername = username.getString();
                  myPassword = password.getString();
                     Thread thread = new Thread() {
                           public void run() {
                               try {
                                  getDoctors(url);
                                  display.setCurrent(listSelectAction);
                               }// Try
                               catch (IOException ioe) {
                                  ioe.printStackTrace();
                               }// catch
                           }// Public void
                     };//Thread
                      thread.start();
                 else if (c == cancelCommand && d == listSelectAction)
                 else if (c == nextCommand && d == listSelectAction)
                    int selectedAction = listSelectAction.getSelectedIndex();
                        Alert displayNewText =
                        new Alert("Selected","Screens are still being developed", null, AlertType.INFO);
                            displayNewText.setTimeout(1000);
                     if (selectedAction == 0)
                         Thread thread = new Thread() {
                           public void run() {
                               try {
                                  getDoctors(url);
                                  display.setCurrent(listSelectAction);
                               }// Try
                               catch (IOException ioe) {
                                  ioe.printStackTrace();
                               }// catch
                           }// Public void
                     };//Thread
                      thread.start();
                     if (selectedAction == 1)
                           display.setCurrent(displayNewText);
                     if (selectedAction == 2)
                           display.setCurrent(displayNewText);
                 }//Else
                 else if (c == backCommand && d == listDoctors)
                      display.setCurrent(listSelectAction);
                 else if (c == nextCommand && d == listDoctors)
                         Thread thread1 = new Thread() {
                           public void run() {
                               try {
                                  getDate(dateUrl);
                                  display.setCurrent(listDate);
                               }// Try
                               catch (IOException ioe) {
                                  ioe.printStackTrace();
                               }// catch
                           }// Public void
                     };//Thread
                      thread1.start();
                 else if (c == backCommand && d == listDate)
                      display.setCurrent(listDoctors);
}That is my midlet !! Now here is the code for my JSP !!
                    <%@ page import="java.sql.*" %>
<%@page import="java.util.*,java.text.*" %>
<%
String name="";
String id = "";
String connectionURL = "jdbc:microsoft:sqlserver://10.2.25.223;DatabaseName=NDOH_PAAB";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>
<%
try
                        Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
                catch (Exception ex)
                        out.println(ex.toString());
                        connection = DriverManager.getConnection(connectionURL,"remotepaab_user","mohwiti2004");
                        statement = connection.createStatement();
                        String mysql ="SELECT * from physicians";
                        //out.println(mysql);
                        rs = statement.executeQuery(mysql);
%>
<%
      while (rs.next()) {
             name= rs.getString("name");
             id = rs.getString("id");
             out.print(name + "%");
             out.print(id + "%");
%>
<%
%>
<% rs.close(); %>In the JSP the name variable is the one that has my List. The problem is how do I say in my Midlet = display the list contained in name. Or in id. I need to use both of them "name + id". the id I will use to find out which name a user ha selected !! Not sure how !!!
Any help would be appreciated !! Thanks !!

Similar Messages

  • How can we display the list of Report Names in Dashboard Prompt?

    How can we display the list of Report Names in Dashboard Prompt?

    Hi,
    No its not possible to display list of reports in dashboard prompts.
    Can do this using SQl results in prompt(we write query checking out report names manualy),but its not easy thing if you are having many report names to be displayed.
    Assign points and close your threads if answered.
    Refer : http://forums.oracle.com/forums/ann.jspa?annID=939
    Regards,
    Srikanth

  • How can i disable running status of recording from lock screen of iphone 5?

    How can i disable running status of recording from lock screen of iphone 5?

    You need to stop the recording. Is it reading Recording Paused? If so, instead of tapping the red button to stop it, tap the word DONE. That is what actually stops the recording. Tapping the red button just pauses it.

  • How can i display a list of all the names stored in the Mail app?

    When sending an email, the program shows a list of names according to the first and subsequent letters that I type into the To: field. There are times I cannot recall someone's email user name. How can I display a complete list of all the names Mail has stored? I know that I can go to the To: field then type in the letter A, then write down all listings under A, and then repeat for each letter of the alphabet, but there should be an easier method.
    I have perhaps dozens of names in Mail, but only five names in Address Book, so the latter does me no good.

    On the menubar, Mail > Window > Previous Recipients
    Regards,
    Captfred

  • How can I display & split the audio & video from the same digitized clip?

    I digitized a scene into iMovie that I edited on a professional system which I don't have access to anymore. The whole scene is 1 clip. Now I see a few tweaks that I want to make, so I was hoping to do them in iMovie.
    I want to "pull up" the audio in one section - meaning I want to take cut about 20 frames of audio from the end of a shot, and then move all the other audio up to fill the hole. To compensate for the missing 20 frames, I'll cut video off the head of the next shot. Some call this prelapping. Some call it an L-cut. Some call it asymmetrical trimming. Either way, I can't figure out how to do it in iMovie.
    My clip appears in the timeline as one track - a single track that contains the video and 2 audio tracks. How can I display the audio that's tied to the video on its own track? Then I think I could split audio & video wherever I wanted and trim things up - but I can't figure out how to do it.
    Am I asking too much of this software?
    BTW, I never see the option to "Split audio clip at playhead". I'm not displaying clip volume or waveforms. Choosing to display waveforms doesn't show me anything. Maybe iMovie thinks I'd only want to see waveforms of audio that isn't tied to my video-and-audio clips?
    Thanks in advance for any help...

    Jordon,
    "Am I asking too much of this software?"
    No, you're not.
    You first want to select your clip(s) and choose Advanced>Extract Audio.
    This will copy the audio from the video clip and place it on one of the two separate audio tracks while lowering the audio level to zero in the original video track.
    You can now edit and move the audio independently of the video.
    With the audio clip selected, you'll find you now have access to Edit>Split Selected Audio Clip at Playhead.
    Matt

  • In alv , how can i  display message like 'NO records in the table'in spool

    When there are no any records , i have to display a message in spool like 'No records exist'.
    how can i do this?/
    Thanks,
    Suresh.

    hi check this..
    if the final internal table is empty then you will show like this..
    if not it_final[] is initial.
    call function reuse_alv_list_display.
    elseif.
    message s000 with 'no data available for the selection'.
    endif..
    regards,
    venkat

  • How can I create a list of addresses from the Junk folder?

    I am using TB 24.7 and I have a long list of e-mail addresses in my junk folder. I need to harvest those to add them to my server's black list.
    How can that be done?
    Thanks.

    Trying to filter junk messages based on sender email is hopeless. The sender email changes all the time.

  • How can I get the list of tabs from history (URLs) which Mozilla opened using "restore session"

    Hi
    I'm using Mozilla 7.0.1
    Today I got Mozilla crashed, and during the reopening, it crashed the second time. After reopening it second time, it showed me only "about:home" tab.
    At last, I lost my previous session - about 50 tabs.
    History -> "Restore Previous session" command is disabled, also "recently closed tabs" and "recently closed windows" are disabled too.
    History is on, so I can see all history of my Mozilla usage.
    Every day I'm closing my Mozilla with that 50 tabs, and then the next day I'm reopening it. It loads all the tabs.
    Today, before the crash, I opened my Mozilla as usually and it loaded that 50 tabs, so logically he have to write about it in history, or logs, or somewhere else. How can I filter my history to find only that tabs?
    How can I find all 50 tabs, which Mozilla loaded today morning? Is it possible?
    Thanks in advance
    Zorayr

    Upgrade your browser to Firefox 8 and check
    * getfirefox.com

  • How can you retieve a list of classes from the Library

    Is it possible to retrieve a list of the Linkage or Export
    Classes from a swf library dynamically?
    I am building an application where I allow the user to load
    an asset swf at runtime, then they can choose to load any Exported
    class from the library of the swf. Currently it works if you know
    the name of the asset, that you want to load, but I would like to
    be able to bring up a chooser list of the assets, rather than
    having to type the Class names.
    So far I have only seen examples where "if you know the class
    name you can load it", but nothing concerning pulling the list.
    There must be a list somewhere in flash, I just want to tap into
    that.

    I saw this before and did not have a chance to go through it
    completely.
    As I was reading it, though it did not seem to be giving me
    the answer, as they seem to extend the Export clips in the library
    by extending the class.
    I'll run through that and see.
    It does give me another idea though.
    (crazy) Idea:
    What if I extend the loader class and add a method, kind of
    like what they are doing on the document class of the loaded swf,
    to pull the class names. They hard code in the class names into the
    array though.... so that is the crux of the issue.
    Somehow I think this concept is doomed to fail but, I will
    also see if that is possible.
    I suppose for the application, I could require that any user
    would use a swf with a document class that has the getAssets()
    method.... also has some problems .... namely dealing with the
    issue of "what if they do not extend" and having it fail
    gracefully.
    oh well, food for thought... I will leave this open for now
    and perhaps I will post some answer.

  • How can Maximum Display Time in Chart Recorder be increased to hours/days?

    Error message displayed when Recorder Display Time (X-Axis) is increased beyond ~0.25 hours, saying maximum display time has been reached.  MUST be able to display time in range of days - although since data display rate (not Dasylab sampling rate, display rate separately controlled through pulse generator) is very slow (i.e. 1 sample/5 minutes, 0.0033Hz) total data quantity is not large.
    Please help..there must be a way around this!! Thanks

    The maximum display time in the Chart Recorder is based on a computation of how much memory is available to be allocated. The computation includes the block size, sample rate, as well as the amount of memory on the computer.
    To display more time, you must reduce the amount of data to reduce the effective sampling rate being charted. You can use the Average Module or the Separate module to accomplish this.
    There are some conditions where the actual sampling rate and the channel sampling rate are not the same - triggered data is an example of this, and data from the RS232 Input and ICOMS Input may be labeled in a way that leads the Chart Recorder to believe that the data channel has more data than it does.
    Please provide more information about your application - what is the data source of the data that you are displaying, what is the sampling rate and block size? How much memory does your computer have?
    --cj
    - cj
    Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.

  • How can I display more than one record with result set meta data?

    Hi,
    My code:
        ArrayList<String> resultList = new ArrayList<String>();
        rs=ps.executeQuery();      
        ResultSetMetaData rsmd = rs.getMetaData();      
        while(rs.next()){      
         for(int k=1;k<=rsmd.getColumnCount();k++){            
            resultList.add(rs.getString(k)); 
        ps.close();       
        }catch(Exception e){                                 
        e.printStackTrace();      
        return resultList;
        public String test(ArrayList result)throws Exception{ 
        String data=         
            "<tr>"+ 
            "<td class=normalFont>"+result.get(0)+"</td>"+ 
            "<td class=normalFont>"+result.get(1)+"</td>"+ 
            "</tr>"; 
        return data; 
        }  All the things are wroking but the problem is that ArrayList is displaying just one record whereas I have more than 20 records to display. I tried with loop like: i<result.size(); and result.get(i) then its throwing exception
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 I stuck here for the last more than 2 days. Please help me
    Best regards

    Raakh wrote:
    Still waiting .....I would have answered much earlier, but when I saw this little bit of impatience, I decided to delay answering for a while.
    ArrayList<String> list = new ArrayList<String>();
    list.add("abc");
    list.add("def");
    list.add("ghi");
    System.out.println(list.get(0));
    abc
    System.out.println(list.get(1));
    def
    System.out.printnln(list);
    [abc, def, ghi]That list has 3 items. Each one is a String.
    But here is what you appear to be doing:
    select * from person
    +-----+-------------+-------------+--------+
    | id  |  first name |  last name  | height |
    +-----+-------------+-------------+--------+
    |   1 | Joe         | Smith       | 180    |
    +-----+-------------+-------------+--------+
    |   2 | Mary        | Jones       | 144    |
    +-----+-------------+-------------+--------+
    for each row in ResultSet {
      for each column in ResultSet {
        list.add(that element);
    // which becomes
    list.add(1);
    list.add("Joe");
    list.add("Smith");
    list.add(180);
    list.add(2);
    list.add("Mary");
    list.add("Jones");
    list.add(144);
    System.out.println(list.get(0));
    1
    System.out.println(list.get(1));
    Joe
    System.out.printlN(list);
    [1, Joe, Smith, 180, 2, Mary, Jones, 144]That list has 8 items. Some of them are Strings and some of them are Integers. I would assume that, for this sample case, you would want a list with 2 items, both of which are Person objects. However, it really isn't clear from your posts what you are trying to do or what difficulty you're having, so I'm just guessing.

  • How can I display the photos and videos from the Nano to Altec's iMV712

    I am trying to display photos and videos from a 3G Nano to larger display on Altec Lansings iMV712
    While I know I can view it from the cradle, I was wondering if a TV Out would work?
    Has anyone managed to get this to work?

    Jim VanLeeuwen has already given you the answer, but (for your future reference), when I saw your comment -- on an RSS feed -- that "The Apple help site is useless" I went to the Support pages and in the search box at the top, entered, "transfer photos from iPhone to Mac".  The top result was the one Jim VanLeeuwen offers.

  • How can I create a list of albums from my iTunes library?

    I want to share some of my albums with a friend, so she asked for a list of the albums that I have in my iTunes Library. I know that I can "copy and paste" (or export and import) my entire list of songs into Excel and then start deleting rows, but that method is taking me forever! With all of the radom songs I have, plus the fact that each album has multiple songs, trying to end up with a list where there is only one entry for each album has become a real chore.
    Is there any 3rd party software that would do this for me, or is there a relatively easy workaround that anyone knows of? I'd really appreciate any assistance...
    Thanks.

    all I put in that "Scripts" folder, was a file called "Album-Artist to Text File" -- should I be putting other files in there as well?
    No, that's the only file necessary.
    Double-check that you put the folder in the correct place and that it's named correctly. The folder must be in the iTunes folder in your user Library folder, and must be named Scripts - no varations (case, extra space at the end, etc.) allowed.
    Other than that, all I can suggest further is, if you are indeed on 10.4.2 as your profile suggests, you try updating to the latest version, 10.4.8. Perhaps that will get it working.
    Good luck.

  • How can I display the date and time from the playhead info as a subtitle ?

    Is there any way it is possible to display the video capture data and time during playback. I have seen some discussion on creating subtitles to do this, it would be nice if one could simply add a Title template with display fields for playhead information so that it automatically gets created during rendering.
    In case you are wondering why on earth anyone would want this, I would like to use this for display on multisport racing videos.
    Thanks

    There is a Date/Time title in the titles browser, does just what it says...

  • How can i display data on tha same page in jsp/servlet

    Hello friend,
    I am storing 50 items in a dataBase. i ve two buttons/links name previous and next. i ve to display 10 items each time in the same page when i click next button and the revrese for previous. through JSP/Servlet.
    Any suggestions will be appreciated.
    chintan anand

    I'm not sure this is the best practice... try to add the item in the arraylist, then when u click next button, add 10 to the counter. subtract if it is a previous button. thats it!
    ex..
    for(int x=counter;x<=arraylist.lenght();x++)
    ....print item here......
    }

Maybe you are looking for

  • Is there a way to apply LUT's to a photo in Lightroom?  Such as .cube, Vision Color, etc.

    Is there a way to apply LUT's to a photo in Lightroom?  Such as .cube, Vision Color, etc.  I have some film stock and Osiris LUTs I like to use for video that I'd love to apply to RAW still photos in Lightroom.  I know it's possible in Photoshop CC b

  • Separate line item for each invoice in payment document

    Dear Experts, while making payment for a vendor through F-58 for multiple invoices, the system grouping the invoices on Business Area basis and giving the line items. For example there are 2 invoices for 5000 and 6000 in one BA and another 2 for 4000

  • Adaptative web service or EJB ?

    Hi everybody, I want consume a web service from  a system SAP R/3. Apparently, we can consume with component EJB ... What is the difference between a adaptative web service and EJB ? More security with EJB ? Thanks Rodolphe.

  • MBP 13-inch 2010 overheats and fan spins continuously under Lion

    Hi, I have a MBP 13-inch 2010 laptop, recently updated with Lion 10.7.1. I noticed tonight, under normal condition with Safari (with two tabs running, no Flash) and iTunes running, the laptop overheats and the fan spins continuously. This is a video

  • Can anyone send me the programme for annexure 10

    I am working on a report 57AE-India which is in SAP but i facing some problems in developing the report further, i need some clarity like what is source of data wht are the additional column i have to develop for annexure 10 India