Servlet trigger problem

i want to write a servlet which will notify the client if there is a change in the database.
kindly help

Servlets can't notify (ie send un-requested information). The best you can do is have the a Servlet check on each request if changes were made since the last request, then add info to the normal response. But if the user doesn't make a request, they will never know.
One thing you could do is cut your page into frames, one of which has a constant META refresh that posts to the Servlet asking if changes have occured... when one does, it redirects to a new page or pops up a message. Does this sound like something you would like to occur?

Similar Messages

  • Servlet Compilation Problem !

    Hi,
    I am just starting to learn servlets and I got problem in compiling them. I got compilation error in
    import javax.servlet.*;statement. Seems that the compiler cannot find the servlet package. I got J2EE 1.4 beta installed on my machine but there is no servlet.jar package. I am using J2SDK 1.4.1_02, J2EE 1.4 beta and Tomcat 4.1.24.
    Can anyone help me with my servlet compilation problem?
    Thanks in advance!
    Josh

    servlet.jar is here :
    <tomcatdir>\common\lib
    add it to your compiler classpath

  • Servlet chaining problem..

    import java.io.*;
        import javax.servlet.*;
        import javax.servlet.http.*;
        public class Deblink extends HttpServlet {
          public void doGet(HttpServletRequest req, HttpServletResponse res)
                                       throws ServletException, IOException {
            String contentType = req.getContentType();  // get the incoming type
            if (contentType == null) return;  // nothing incoming, nothing to do
            res.setContentType(contentType);  // set outgoing type to be incoming type
            PrintWriter out = res.getWriter();
            BufferedReader in = req.getReader();
            String line = null;
            while ((line = in.readLine()) != null) {
              line = replace(line, "<BLINK>", "");
              line = replace(line, "</BLINK>", "");
              out.println(line);
          public void doPost(HttpServletRequest req, HttpServletResponse res)
                                        throws ServletException, IOException {
            doGet(req, res);
          private String replace(String line, String oldString, String newString) {
            int index = 0;
            while ((index = line.indexOf(oldString, index)) >= 0) {
              // Replace the old string with the new string (inefficiently)
              line = line.substring(0, index) +
                     newString +
                     line.substring(index + oldString.length());
              index += newString.length();
            return line;
    What is pre request fo above code to work.
    I had tried this many time but it is not working, what will be calling servlet look like

    And can you explain why your title is "Servlet chaining problem"?

  • How to activate JDBC debugging for SPRING 3.1? Oracle trigger problems ...

    Hi,
    I have some trigger problems. I created a trigger to update a certain column each time a new record is inserted or an existent record is updated. I use Oracle 10g. If I create the trigger and execute an insert query via the XE client everything works fine. However, when I use a spring 3.1 setup with Hibernate and OJDBC driver, I get an
    java.sql.SQLException: ORA-04098: trigger 'LOCALUSER_PROP_TRIG' is invalid and failed re-validation
    And if I execute a show error trigger query I get an invalid SQL query error.
    I can easily activate Hibernate debugging and I can see that the prepared statement by Hibernate is just fine, but I was wondering if I could see the full sql sent by the JDBC driver to the server. Maybe seeing the actual query sent to the server would provide new insight of what could be wrong in the Hibernate setup. Does any one what could be wrong and eventually how could setup jdbc to output debug info? Thanks a lot,
    Cristian

    Which platform is the database running on ??
    Other things you should check -
    when debugging the EJB, JDev
    3.1 looks through your IIOP connections to find the one to use.
    Make sure that the IIOP connection that JDev is using for the debugging matches the IIOP connection that the EJB client application is using.
    raghu
    null

  • Mutating DB Trigger Problem

    Hello all, i have a ' Mutating DB Trigger Problem' for the following Trigger :
    =============================================
    CREATE OR REPLACE TRIGGER ASSIUT.EMP_ATTENDANCEE_MONA
    AFTER INSERT
    ON ASSIUT.ACCESSLOG
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    V_COUNT CHAR(2);
    --V_COUNT_OUT CHAR(2);
    BEGIN
    IF :NEW.INOUT = 'IN' THEN
        INSERT INTO EMP_ATTENDANCEE (EMP_ID, DATE_IN ,DATE_OUT ,TIME_IN ,TIME_OUT)
         VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
                 TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
                 NULL,
                 TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),      -- TIME_IN
                 NULL );      -- TIME_OUT
                     SELECT COUNT(employeeid )
                     INTO V_COUNT
                    FROM ACCESSLOG
                    WHERE employeeid =:NEW.employeeid
                    AND LOGDATE =:NEW.LOGDATE
                    AND  LOGTIME  =:NEW.LOGTIME
                    AND INOUT ='IN';
                    IF V_COUNT > 0 THEN
         INSERT INTO ATT_INCOMPLETE  (  EMP_ID , ATT_DATE , ATT_TIME ,  ATT_FLAG)
         VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
                 TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
          TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),        -- TIME_IN
          1); -- check in
          END IF;
    ELSIF :NEW.INOUT = 'OUT' THEN
        UPDATE  EMP_ATTENDANCEE
        SET           DATE_OUT   =  TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'), -- DATE_OUT,
                      TIME_OUT   =   TO_DATE(:NEW.LOGTIME,'HH24:MI:SS') -- TIME_OUT
        WHERE   EMP_ID           =   TO_NUMBER(TO_CHAR(:NEW.employeeid,99999))
        AND DATE_IN =  (SELECT MAX (DATE_IN )
                        FROM EMP_ATTENDANCEE
                        WHERE EMP_ID = EMP_ID
                        AND   DATE_OUT IS NULL
                        AND   TIME_OUT IS NULL ) ;
                  SELECT COUNT(employeeid )
                     INTO V_COUNT
                    FROM ACCESSLOG
                    WHERE employeeid =:NEW.employeeid
                    AND LOGDATE =:NEW.LOGDATE
                    AND  LOGTIME  =:NEW.LOGTIME
                    AND INOUT ='OUT';
                    IF V_COUNT > 0 THEN
    INSERT INTO ATT_INCOMPLETE  (  EMP_ID , ATT_DATE , ATT_TIME ,  ATT_FLAG)
         VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
                 TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
          TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),        -- TIME_IN
         0); -- check in
    END IF;
    END IF;
      EXCEPTION
       WHEN OTHERS  THEN RAISE;
    END EMP_ATTENDANCEE_MONA ;The above Trigger generates the following error:
    ORA-04091: table ASSIUT.ACCESSLOG is mutating, trigger/function may not see it
    ORA-06512: at "ASSIUT.EMP_ATTENDANCEE_MONA'", line 65
    ORA-04088: error during execution of trigger 'ASSIUT.EMP_ATTENDANCEE_MONA'i want an easy and a straight forward solution to this problem which occured on selecting or manipulating from the same table i triggered it.
    Best regards,
    Abdetu..

    Create a package
    CREATE OR REPLACE PACKAGE PK_TRIGGER IS
      PROCEDURE PR_BS;
      PROCEDURE PR_ARIU(i_vcType IN TABLE.COLUM%TYPE, i_nEmpId TABLE.COLUM%TYPE, i_vcLogDate IN TABLE.COLUMN%TYPE, i_vcLogTime IN TABLE.COLUMN%TYPE);
      PROCEDURE PR_AS;
    END;
    CREATE OR REPLACE PACKAGE BODY IS
      TYPE tData IS RECORD (
        vcType     TABLE.COLUMN%TYPE,
        nEmpid     TABLE.COLUMN%TYPE,
        vcLogDate TABLE.COLUMN%TYPE,
        vcLogTime TABLE.COLUMN%TYPE
      TYPE tDataList IS TABLE OF tData INDEX BY BINARY_INTEGER;
      lData tData;
      PROCEDURE PR_BS IS
      BEGIN
        lData.DELETE;
      END;
      PROCEDURE PR_ARIU(i_vcType IN TABLE.COLUM%TYPE, i_nEmpId TABLE.COLUM%TYPE, i_vcLogDate IN TABLE.COLUMN%TYPE, i_vcLogTime IN TABLE.COLUMN%TYPE) IS
        iPos PLS_INTEGER:=lData.COUNT+1;
      BEGIN
        lData(iPos).vcType:=i_vcType;
        lData(iPos).nEmpId:=i_nEmpId;
        lData(iPos).vcLogDate:=i_vcLogDate;
        lData(iPos).vcLogTime:=i_vcLogTime;
      END;
      PROCEDURE PR_AS IS
        CURSOR crCheck(i_nIdentnum IN NUMBER) IS
          SELECT 1
            FROM <YOURTABLE> A,
                 <YOURTABLE> B
           WHERE A.IDEN_NUM=B.IDENT_NUM
             AND (   A.BEGIN_DATE BETWEEN B.BEGIN_DATE AND B.END_DATE
                  OR A.END_DATE BETWEEN B.BEGIN_DATE AND B.END_DATE
        iPos PLS_INTEGER;
        nDummy NUMBER;
      BEGIN
        iPos:=lData.FIRST;
        LOOP
          EXIT WHEN iPos IS NULL;
          -- Do whatever you want with the data in the record
          -- Process next record
          iPos:=lIds.NEXT(iPos);
        END LOOP;
        lIds.DELETE;
      END;
    END;replace TABLE.COLUM%TYPE with appropiate table and column
    Now create a
    - Before Statement trigger on your table calling PK_TRIGGER.PR_BS;
    - After Insert on Update for each row Trigger calling PK_TRIGGER.PR_ARIU(...values...);
    - After Statement trigger on your table calling PK_TRIGGER.PR_AS;
    Hope the code compiles for i have no database at hand.
    Andreas

  • Post query trigger problem in master detail oracle forms

    Hello experts,
                        I am new in oracle forms n using Fission middleware 10g with oracle forms 11g at windows 7 platform.
    I have made a master detail form using a tab canvas.There is a database column STUDENTID and it is in my student tab with a TBL_STUDENTENTRY data block.Now I Have an another tab named previous_education with TBL_STUDENT_PREVIOU_EDU datablock here there is also a database column STUDENTID and corresponding field in my  previous_education TAB under TBL_STUDENT_PREVIOU_EDU  datablock.Now i want to add a display item to show  student name corresponding to STUDENTID.For this I have tried to make a select query in TBL_STUDENT_PREVIOU_EDU data block POPST_QUERY TRIGGER.
    begin
    select STUDENTNAME into :TBL_STUDENT_PREVIOU_EDU.STD_NM   from TBL_STUDENTENTRY where STUDENTID=:TBL_STUDENTENTRY.STUDENTID;
    end;
    But, This trigger is not fired at runtime,Please suggest me what is going wrong and give me the solution.
    Thank You
    AADITYA.

    http://www.club-oracle.com/forums/post_query-problem-in-oracle-forms-t9751/#post23794 ,  This is the link at where  I have tried to show my problem with the help of an image,Please get the link:
    thanx
    regards Aaditya.

  • Tomcat Servlet Security Problem? : Start Excel with NJAWIN - COMObjects

    I get an exception when I start my programm as servlet , as application it works just fine (when I start it as Servlet in the internal Tomcat from JBuilder it also works fine).
    Application app = new Application(Application.progID); // interfaces built with java2com for Excel
    com.develop.jawin.COMException: 8000ffff: CoCreateInstance for "{024500-00-0000-c000-000000000046}" failed
    at com.develop.jawin.win32.Ole32.CoCreateInstance(Unknown Source)
    at com.develop.jawin.win32.Ole32.GetFromProgID(Unknown Source)
    at com.develop.jawin.DispatchPtr.<init>(Unknown Source)
    at excel2pdf.Excel._Application.<init>(_Application.java:31)
    Actually Excel is started but as SYSTEM and not as my Username. Perhaps there's a problem with the security policy, I already gave all rights to catalina for my whole projekt( each directory of it). Have smb already had this problem? Any Ideas?

    Thanks for answering
    In my case I think I cannot use POI because I need Excel
    and a Virtual Printer , so I can convert excel files with exactly the same
    format to PDF. POI is suppose better idea for creating or manipulating
    OpenOffice files (they are working together with OO on file formats),
    and unfortunately OpenOffice doesnt work fine with charts (I already had
    this solution, openoffice-server and Uno ).
    It must be smth with Tomcat-Configuration or security, because my
    programm is working with the internal tomcat-server of JBuilder, and
    as application too. In both cases Excel is started with my username and
    not SYSTEM (my tomcat server is started as service, perhaps thats why
    by starting excel from my servlet Excel is by user - SYSTEM).

  • Applet-Servlet Communication problem EOFException

    Hi! i´ve been searching and searching through forums because it seems this problem is very common, but none of the solutions i´ve seen so far suits me, so i´m here looking for some help because i´ve been stuck one week with this. First of all sorry if my english isn´t the best... i´m a bit rusty...
    Well, i had some code that worked perfectly, but i needed to perform some changes because i needed the servlet to send more info to the applet, and here started the problems, when i made the changes it started to throw EOFException when i was trying to read the InputStream, and furthermore when i came back to the original code it started to throw the exception in the same place too
    So here i am... don´t know what to do now and i entrust to you to give me some tips.
    Here comes some code. This is the original code, the one that runned but it doesn´t run right now
    Applet:
    public ListasComponentesSeleccionables cargarListasComponentes( ) throws IOException, ClassNotFoundException {
              String serv = "/Desaladora/cargarListasComponentesApplet.do";
              String host = Principal.documentBase.getHost( );
              URL direccion = new URL( "http", host, 8080, serv );
              // Create conection
              URLConnection connection = direccion.openConnection( );
              connection.setDoInput( true ); 
              connection.setDoOutput( true );
              connection.setUseCaches( false );
              connection.setRequestProperty( "Content-Type", "application/x-java-serialized-object" );
              ObjectOutputStream output;
              output = new ObjectOutputStream( connection.getOutputStream( ) );
              output.writeObject( new Boolean(true) );
              output.flush( );
              output.close( );
              ObjectInputStream input = new ObjectInputStream( connection.getInputStream( ) ); //<-- Here is the problem
              ListasComponentesSeleccionables response = new ListasComponentesSeleccionables( );
              response = ( ListasComponentesSeleccionables ) input.readObject( );
              return response;
         }Servlet:
    ublic class CargarListasComponentesAppletAction extends Action {
    public ActionForward execute(     ActionMapping mapping,
                                                     ActionForm form,
                                                     HttpServletRequest request,
                                                     HttpServletResponse response )
                            throws ServletException, IOException, Exception  {
              InitialContext context = new InitialContext();
              SensorManagerService sensor_service;
              ActuatorManagerService actuator_service;
              Globals.LOGGER_SECURITY.debug( "Entering ACTION 'CargarListasComponentesAppletAction'" );
              response.setContentType("application/x-java-serialized-object");
              try
                   ObjectInputStream bufferentrada = new ObjectInputStream(request.getInputStream());
                   Boolean peticionOK = (Boolean)bufferentrada.readObject();
                   ObjectOutputStream buffersalida = new ObjectOutputStream(response.getOutputStream());
                   sensor_service = ( SensorManagerService ) context.lookup( "desaladora/SensorManagerServiceBean/local" );
                   ArrayList<AlarmConnectedSensorDTO> sensorList = sensor_service.findAllSensorsToAlarms();
                   actuator_service = ( ActuatorManagerService ) context.lookup( "desaladora/ActuatorManagerServiceBean/local" );
                   ArrayList<AlarmConnectedActuatorDTO> actuatorList = actuator_service.findAllActuatorsToAlarms();
                   buffersalida.writeObject( crearListasSeleccionables(sensorList, actuatorList) );
                   buffersalida.flush();
              catch(Exception e)
                   System.out.println("Error en la trasmision de datos");
              return null;
         private ListasComponentesSeleccionables crearListasSeleccionables(ArrayList<AlarmConnectedSensorDTO> sensorList,
                    ArrayList<AlarmConnectedActuatorDTO> actuatorList) {
              Vector<Integer> vectorSensores = new Vector<Integer>();
              Vector<Integer> vectorActuadores = new Vector<Integer>();
              for(AlarmConnectedSensorDTO sensor : sensorList) {
                   vectorSensores.add(sensor.getIdSensor( ));
              for(AlarmConnectedActuatorDTO actuator : actuatorList) {
                   vectorActuadores.add(actuator.getIdActuator( ));
              ListasComponentesSeleccionables listasComponentesSeleccionables =
                                  new ListasComponentesSeleccionables(vectorSensores, vectorActuadores);
              return listasComponentesSeleccionables;
    }i´ve been running some test in another computer, and this code simply works, but it doesn´t work in the machine i usually work.
    Maybe someway the stream get corrupt? the info i´ve been trying to send and started throwing the exception may still be in the stream? I don´t know what to think right now.
    Hope someone has any idea, thankyou.

    I dont see the problem. However, I suggest you change this;
    System.out.println("Error en la trasmision de datos"); t
    to e.printStackTrace() to see what it is doing when it stops working.
    I also suggest peppering your code with System.out.println() statements to see what it is doing just before stopping.
    Also, try your code with a brand new file with only a few characters in it. If it works, add to it some of your originial file content until it stops working. This way, you can determine if its the file size that is causing the crash or something in the file content. If all else fails, study java I/O and try some other way to read/write the file. You can also try a different browser. If it works, its the browser. Still having problems? Create a new project with a simple applet and file read/write program and get that working. That way, all the other stuff in your original project isn't in the way.

  • Servlet mapping problem in Resin, very weird!

    ENV: resin 2.1.6 on windows 2000
    1, I copied all the files and folders in $resin/doc/java_tut to $resin/webapps
    2, I did a little change to $resin/conf/resin.conf
    In the old resin.conf, there is a lot about the '/' webapp.
    <web-app id='/'>
    <classpath id='WEB-INF/classes'
    source='WEB-INF/classes'
    compile='true'/>
    </web-app>
    I replaced it just with
    <web-app id='/'/>
    3, I tested the 'java_tut' webapp
    http://localhost:8080/java_tut/servlet/example.servlet.basic.MappingServlet
    works well.
    http://localhost:8080/java_tut/exact
    works well, too.
    4, Then I tested the '/' webapp
    http://localhost:8080/servlet/example.servlet.basic.MappingServlet
    works well.
    but
    http://localhost:8080/java_tut/exact
    returns error code 404
    what's the problem?

    don't you need to get rid of the java_tut bit?

  • Trigger Problem, need help in 8i

    SQL> Create table a (sno char(3), kkk varchar2(30));
    SQL> Create or replace trigger T$a before insert on a
    for each row
    begin
    if :new.sno = 'FFF' then select nvl(max(sno),0)+1 into :new.sno from a;
    end;
    SQL> insert into a select 'FFF', cont_no from gcmis.cont_rent;
    insert into a select 'FFF', cont_no from gcmis.cont_rent
    ERROR at line 1:
    ORA-04091: table TR.A is mutating, trigger/function may not see it
    ORA-06512: at "TR.T$A", line 2
    ORA-04088: error during execution of trigger 'TR.T$A'
    Why & How?

    It happens because you read the table that was in the middle of being modified by your trigger...
    The only way to proceed is to rewrite your statement so it does not read the table.
    For example, you can store the maxvalue of your field in another table...
    But don't forget that if sno is a unique key, you'll probably have problems when working with a mutli-users app...
    SQL> Create table a (sno char(3), kkk varchar2(30));
    SQL> Create or replace trigger T$a before insert on a
    for each row
    begin
    if :new.sno = 'FFF' then select nvl(max(sno),0)+1 into :new.sno from a;
    end;
    SQL> insert into a select 'FFF', cont_no from gcmis.cont_rent;
    insert into a select 'FFF', cont_no from gcmis.cont_rent
    ERROR at line 1:
    ORA-04091: table TR.A is mutating, trigger/function may not see it
    ORA-06512: at "TR.T$A", line 2
    ORA-04088: error during execution of trigger 'TR.T$A'
    Why & How?

  • Post-trigger problem in master detail form.

    I have designed a master detail form having two data blocks.
    in detail data block there is a post-query.
    when i tried delete one record in master block
    an error occurred ie
    'frm-40654. Record is updated by another user
    re-query to see changes'.
    in detail block there are 3 non database items.
    when i delete the post-query trigger the record is deleting properly.but the post-query trigger is also needed to display the non database item values. please give me a solution to tackle this problem.

    Hi,
    Even though yout items are non-database items, when you assign a value to them forms sets the block status to "CHANGED".
    Add the following lines add the end of your post-query trigger to reset the block status to "QUERY"
    set_record_property (GET_BLOCK_PROPERTY('YOUR_BLOCK_NAME',CURRENT_RECORD)
    ,name_in('system.cursor_block')
    ,STATUS
    ,QUERY_STATUS
    Hope this helps,
    Hugo

  • How to send Oracle rowid to servlet? | Problem with national characters.

    There is same possibility how to send rowid to servlet?
    I have now definition like this:
    <af:image source="/imageservlet?Par1=#{bindings.Col1.inputValue}"/>
    But If column contents national characters, servlet methods obtained changed these characters.
    My idea is to use not primary key for row, but use oracle rowid. It is simply possible?
    Use something like this:
    <af:image source="/imageservlet?Rowid=#{bindings.Rowid}"/
    Or Do you have ideas how to solve problem with national characters ?
    Thanks
    FiL

    Hi,
    Although your workaround works.
    I think this is a simple encoding problem.
    I simply need to make sure all parameters and pages are encoded with a char set which contains the national characters you mentioned.
    This is a bit dependent on the exact technology your using, but most can be done via the web.xml:
      <jsp-config>
          <jsp-property-group>
              <url-pattern>*.jsp</url-pattern>
              <page-encoding>UTF-8</page-encoding>
          </jsp-property-group>
      </jsp-config>     This forces all JSP pages to be encoded in UTF-8
    Adding the following parameter sometimes helps as well, although I think this one is a bit dated:
    You said your using a servlet so your servlet needs a similar block for its pattern
      <context-param>
        <param-name>PARAMETER_ENCODING</param-name>
        <param-value>UTF-8</param-value>
      </context-param>If you want to be 100% sure the encoding is set right make sure thepages contain:
    <%@ page contentType="text/html;charset=utf-8"%>Or depending on your view technology the syntax can be a bit different
    -Anton

  • Servlet configuration problems ..

    Hi
    I am a new member starting with Java Servlets:
    I have a problem with Configuring the Servlet on the J2EE Application server.
    Here is the Servlet code ...
    package mypackage;
    public class ShowParameters extends HttpServlet {
        public void doGet(HttpServletRequest request, HttpServletResponse response)         throws ServletException, IOException { .... }And this is the web.xml file
        <servlet>
            <servlet-name>ShowParameters</servlet-name>
            <servlet-class>mypackage.ShowParameters</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>ShowParameters</servlet-name>
            <url-pattern>/ShowParameters</url-pattern>
        </servlet-mapping>And the HTML file is ....
    <FORM ACTION="ShowParameters">
        First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
        Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
        Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
        <CENTER>
            <INPUT TYPE="SUBMIT">
        </CENTER>
    </FORM>I have set the CLASSPATH variable t /build/mypackage/
    I get two erros:
    Wrapper cannot find servlet class ..
    ClassNotFound exception ...
    Also, how do I compile " the servlet class file with the line; package hello; " with the package name
    I would appreciate any help ..
    Thanks
    N

    I am trying to invoke a servlet from an HTML page.
    Method 1
        <FORM ACTION="ThreeParams" METHOD="GET">
            First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
               <CENTER>
            <INPUT TYPE="SUBMIT">
        </CENTER>
        </FORM>Method 2
    <td><a href="Threeparams">Execute</a></td>Method 1 does not work but Method 2 does. But Method 2 does not transmit param1 to the server.
    Any thought on how to get it correct?
    Rgds
    N

  • Servlet side problem

    hi there,
    i have managed to get my mipd program talking 2 a tomcat server, but i have run into the following problem:
    the servlet has at initiation a buffer called int l = 0; and increment the l value by 1 , this is fine but when i get another phone 2 connect to the server, i want the value of l to increment to 2, instead the value resets to 0 and then increments by 1 giving me the final value of 1 yet again on the second phone
    here is the code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class testing3 extends HttpServlet{
    int l;
    public testing3(){ l=0;}
    public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException{
    InputStream in = req.getInputStream();
    PrintWriter out = res.getWriter();
    String rankstring = "sent by server";
    int requestlength = req.getContentLength();
    if(l==0){
    if(requestlength > 0 ){
    for(int i=0;i<requestlength;i++){
    int c = in.read();
    if(c==-1)break;
    l++;
    else if(l==2)
    out.write(rankstring);
    System.out.println("l value is" + l);
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException,ServletException{
    doPost(req,res);
    how do i get around this problem?advice will be greatly appreciated
    regards

    i think you want to number of hits kind of value...
    make that variable static
    you should get the value that you want
    [email protected]

  • Servlet intercommunication problem

    Hi,
    I have a problem regarding servlet intercommunication.
    What I m doing is : I have an HTML form in which user enters some data and submits it. Servlet_1 is called , it gets all the parameters and displays all data in the form of an html form again. Now, if the user clicks on "SAVE" button , only then Servlet_2 should get called and that data should be stored in database .
    I m having problem while saving data.I just lose track of data entered by the user somewhere between the servlets.
    How should I get the data enetered by the user previously, and in what form I should store it to access it later on through any servlet?
    Please help.
    Regards
    Shweta

    I suggest other than showing the data on the HTML returned by Servlet_1, you created hidden values of the data submitted into the displayed form. In this way, the data would be resent to Servlet_2 when Save is pressed.
    Alternatively, you can use a Session to store the contents of the submitted information. (this will enable you to access it later on any servlet)

Maybe you are looking for

  • Why can't i see my files in the bookmark folders in safari

    I can see my folders in my Safari bookmarks but now I can't see the files in the folders.  What have I done????

  • Macbook Dropped, screen issue

    So, I dropped my macbook, which by the way, I blame on IKEA for their poorly designed Laptop stand called Dave (dont buy it!). But thats beside the point. The stand tipped over, and my macbook was dropped. Now the bottom right hand corner is brighter

  • Dms-download file error

    Hi SAP experts, We are using KPRO content server for our client and have configured the same. While uploading a file from PC or downloading a file to PC from SAP content server, sap is creating two to three additional files on desktop or the folder f

  • PDF ACTION

    I want to use the srw package to open another report and pass the parameter. I currently use the hyperlink prop but I don't like the way the path shows when you mouse over the link. I'm having some trouble with using the SRW.SET_PDF_ACTION() package.

  • New PC - personal library 'greyed out'

    Evening all Just bought a new PC and successfully transferred all my music files across from the old one. However, when I plug my i-pod in, my personal library appears in grey instead of black and I can't drag anything onto my i-pod. This is despite