Apache-Jserv: Servlet doubles info

Discussion in 'Java' started by Loek Raemakers, Oct 21, 2004.

  1. Dear java-users,

    I made a program consisting out of 1 Applet and 2 Servlets.
    The program runs on Apache-Jserv ( Windows '98).
    The Applet sends info to the Servlet1, this Servlet puts the into in a .txt
    file. Servlet2 retrieves the info and presents it in a HTML-page, as a list .
    There are 10 different short-lists. The writing to the file is no problem.
    The retrieving of a choosen list is no problem. So far so fine.
    But when a user wants to put his name on a chosen list and directy controls if
    his name is on that list, the user's name is appended twice.!
    The rerieving-servlet; reads the file at the get-method, analyses the string (
    StringTokenizer), puts all the info ( long list) in a Vector, composes the
    desired short list, and makes HTML out of it. This is presented to the user.
    Some code:

    // For reading the file I use a BufferedReader.

    Vector tepresenterenlijst = new Vector();
    Vector dramaV = new Vector();

    // The calling;

    switch(lijstno)
    {
    case 1:
    lijstMakker(dramaV);
    naamGever("dramaV");
    groepsGrootte(16);
    break;
    ……

    // The making of the short-list ;

    protected void lijstMakker(Vector x)
    {
    tepresenterenlijst.removeAllElements(); // we beginnen met een lege
    lijst !
    int i = 0;
    int num = groepsGrootte(max);
    for ( i = 0; i < x.size(); i++) // geen min 1 !
    {
    String regel = x.elementAt(i).toString();
    String lijstregel = "<LI>" + regel + "</LI>";
    tepresenterenlijst.addElement(lijstregel);
    if (i + 1 == num)// = max aantal per groep !
    {
    lijstregel = "<BR><BR><B><FONT
    COLOR=\"red\">Wachtlijst:</FONT></B>";
    tepresenterenlijst.addElement(lijstregel);
    }
    else
    {
    lijstregel = lijstregel;
    }
    }

    }

    How to overcome the doubling in direct presentation of the info?
    Is it the number of threads of Apache?
    Is it the use of a Vector?
    Is it a stream (not) flushed() or closed()?
    Is it the Servlet - session itself that causes the problem?
    Please, give me a pointer in the good direction.
    Loek eR.
     
    Loek Raemakers, Oct 21, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ajit
    Replies:
    1
    Views:
    343
    Juha Laiho
    Aug 8, 2003
  2. pradeep gummi

    Migration from Jserv to Tomcat 4.0

    pradeep gummi, Sep 4, 2003, in forum: Java
    Replies:
    0
    Views:
    452
    pradeep gummi
    Sep 4, 2003
  3. circuit_breaker
    Replies:
    2
    Views:
    2,095
    Jack Jia
    Apr 4, 2004
  4. Replies:
    0
    Views:
    1,000
  5. dan
    Replies:
    1
    Views:
    2,364
    Jack Klein
    Nov 26, 2003
Loading...

Share This Page