Problem with Servlet that generates HTML

Hello,
I have a servlet that connects to a database to get some information which it displays in a HTML file generated by the same servlet.
For each line that I want to display from the Database I create the following in my servlet:
<input type="hidden" value="Ajax-Chelsea" name="bet_1_choice"/>
However, when I test it in Tomcat it doesn't work, and I realised in Firefox that it gets the above line as follows with the bold part added:
<input type="hidden" )="" value="Ajax-Chelsea" name="bet_1_choice"/>
I also use a javascript to add the DB information in another area of the HTML page, another table, but I don't know if this is relevant.
I don't understand what is wrong. Can someone help me please?

Thanks for your responses.
Actually the problem was my javascript. Now it is sorted out.

Similar Messages

  • Having problem with javabean that generate password

    i have created a javabean for generating password.
    this is my java coding.
    package autogenerate;
    import java.util.*;
    public class GeneratePwId
    private String Passwd;
    public String getPasswd()
    return this.Passwd;
    public void setPasswd(String Psd)
    char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
    'J', 'K', 'L', 'M', 'N', 'P', 'R', 'T',
    'U', 'V', 'W', 'X', 'Y', 'a', 'b', 'c',
    'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
    'm', 'n', 'p', 'q', 'r', 's', 't', 'u',
    'v', 'w', 'x', 'y', 'z', '0', '1', '2',
    '3', '4', '5', '6', '7', '8', '9'
    Psd = "" ;
    while( Psd.length() < 10 )
    Psd += letters[ (int)( Math.random() * letters.length ) ] ;
    this.Passwd = Psd;
    and trying to use a jsp to retrieve this password.
    <html>
    <head>
    <title>
    Try retrieving password
    </title>
    </head>
    <body>
    <jsp:useBean class="autogenerate.GeneratePwId" id="bean0" scope="page"/>
    <%
    String Password = bean0.getPasswd();
    out.println(Password);
    %>
    <%=bean0.getPasswd()%>
    </body>
    </html>
    i try to retrieve the password from javabean and display it out. but the result i got is always null. may i know what is the problem with my javabean? or my jsp?
    can anyone help me please?
    Thanks alot

    this is my .java code for getter and setter
    package autogenerate;
    import java.util.*;
    public class GeneratePwId
    private String passwd;
    public String getPasswd()
         return this.passwd;
    public void setPasswd(int length)
    char[] letters = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
    'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
    'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a',
    'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
    'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
    't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1',
    '2', '3', '4', '5', '6', '7', '8', '9'
    String psd = "" ;
    length = 10;
    while( psd.length() < length )
    psd += letters[ (int)( Math.random() * letters.length ) ] ;
    this.passwd = psd;
    and this is my jsp code
    <html>
    <head>
    <title>
    Try retrieving password
    </title>
    </head>
    <body>
    <jsp:useBean class="autogenerate.GeneratePwId" id="bean0" scope="page"/>
    <%
    String Password = bean0.getPasswd();
    %>
    <%=Password%>
    <%=bean0.getPasswd()%>
    </body>
    </html>

  • Problem with servlet call within servlet

    I have already a servlet that generates a jpeg images that works fine.
    a second servlet generates an pdf document via the iText library and works also fine.
    the problem or question is how to call the first servlet to insert an
    image into the generated pdf??
    tia
    marky

    Have a look to HttpURLConnection object (in java.net package). A example of the code :
    URL url = "http://myServer/myJpegServlet";
    HttpURLConnection uc = (HttpURLConnection) url.openConnection();
    uc.setDoInput(true);
    uc.setUseCaches(false);
    uc.setAllowUserInteraction(false);
    InputStream dataIn = uc.getInputStream();
    byte[] buf = new byte[512];
    while( (dataIn.read(buf)) != -1 ) {
    //Do what you want with the data
    datain.close();
    uc.close;
    Hope this helps!
    Simon Pierre NOLIN

  • Problem with JMenus that Persist - Is this a Java bug?

    I am having a problem with JMenus that persist. By this I mean
    that my drop down menus persist on the screen even after they have
    been selected.
    I've checked the Java bug database, and the following seems
    to come closest to my problem:
    Bug ID: 4235188
    JPopupMenus and JMenus persist when their JFrame becomes visible
    State: Closed, not a bug
    http://developer.java.sun.com/developer/bugParade/bugs/4235188.html
    This page says that the matter is closed and is not a bug. The
    resolution of this matter printed at the bottom of the page
    is completely abstruse to me and I would appreciate any
    comments to understand what they are talking about.
    The code at the end of my message illustrates my problem.
    1. Why should paintComponent() make any difference to
    Menu behavior?
    2. Is this a bug?
    3. What's the workaround if I have to paint() or repaint()?
    Thanks
    Tony Lin
    // Example of Menu Persistence Problem
    // Try running this with line 41, paintComponent(), and without line 41
    // Menus behave normally if line 41 is commented out
    // If line 41 exists, menus will persist after they have been selected
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class P2 extends JPanel {
    JMenuItem[] mi;
    public P2() {
    JFrame thisFrame = new JFrame();
    thisFrame.getContentPane().add(this);
    JMenu menu = new JMenu("My Menu");
    JMenuBar mb = new JMenuBar();
    mi = new JMenuItem[4];
    for (int i=0; i<mi.length; i++) {
    mi[i] = new JMenuItem("Menu Item " + String.valueOf(i));
    menu.add(mi);
    mb.add(menu);
    thisFrame.setJMenuBar(mb);
    thisFrame.setSize(400,200);
    thisFrame.setLocation(150,200);
    thisFrame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    System.exit(0);
    thisFrame.setVisible(true);
    public void paintComponent(Graphics g) {} //Affects menu behavior!
    public static void main(String[] args) {
    new P2();

    Well, my understanding of the way painting works is that a component doesn't UNPAINT itself. Instead a message is sent to the component under the coordinates of the menu to REPAINT itself.
    In your demo program the JFrame is the component under the JMenu. The paintComponent() method of JFrame is empty, so nothing gets repainted.
    I added super.paintComponent(g); to the method and everything works fine.

  • URGENT ! JDEV 10.1.2 Problem with data control generated from session bean

    I got a problem with data control generated from session bean which return a collection of data transfer object.
    The dto's seem to be correct. The session bean load correctly the data into and the object's are plenty of data. Using the console to display the dto content is ok.
    When generating a data control from this session bean and associate the dto included in the collection only the first object level and one-to-one dto object are correctly setted in the data control. Object that represent collection into the dto (one-to-many foreign key) are setted as collection with an iterator but the structure of the object is not setted. I don't know how to associate this second level of collection with the dto bean class to obtain the attributes definition.
    I created a case with hr schema like the hrApp demo application in the tutorial with departments and employees table. I got the same problem.
    Is it a bug ?
    It exists a workaround to force the data control to understand the collection data structure ?
    Help is welcome ! this is urgent !!!

    we found the problem by assigning the child dto bean class to the node representing the iterator in the xml file corresponding to the master dto.

  • I have problem with account that i can't make update or buy from app store There is massage appear in my payment page that i must contact with i tunes support to complete this transaction Please help me to fixe this problem as soon possible Hany hassan 00

    I have problem with account that i can't make update or buy from app store
    There is massage appear in my payment page that i must contact with i tunes support to complete this transaction
    Please help me to fixe this problem as soon possible
    Hany hassan
    0096597617317
    0096596677186
    Thank you

    You need to Contact iTunes Support...
    Apple  Support  iTunes Store  Contact Us

  • Problem with Time Dimension generating

    Hello, everybody.
    I have a problem with Time Dimension generating with the help of the Standard Wizard.
    1. I choose Dimensions -> New -> Using Time Wizard
    2. Set Name as "Time"
    3. On the next screen I choose ROLAP: Relational Storage
    4. On the next screen set Start year: 2003, Number of years: 3
    5. On the next screen choose all levels of the Normal Hierarchy
    On the 6-th step Wizard complete 60% of job and hang up doing nothing (buttons "Cancel" and "Help" is active).
    chapter "Create REL_TIME Dimension Using the TIME Dimension Wizard", step 1-6 of tutorial =(
    http://www.oracle.com/technology/obe/11gr1_owb/owb11g_update_getting_started_intro/lesson3/less3_relational.htm
    My system characteristics:
    Builder client 11.1.0.7.0, warehouse at local computer.
    can anybody give me any advice about this problem? =(
    thanks in advance.

    Had this issue been solved please?
    I have just come across the exact same problem and this post is the only one i managed to find which describes exactly what is happening to me.
    Thanks

  • Problem with Spaces that started with Snow Leopard

    I've noticed two problems with Spaces that have arrived since switching to Snow Leopard... First, if I am in say Space 1 where I use Safari and I then want to move over to an open application, say like Excel, that I have running in Space 4, there are a number of ways to get there but one way I used to use all the time was to move down to the Dock and simply single click on the open Excel application and that would immediately switch me over to Space 4 and whatever Excel documents were already open there... Now, since switching to SL, a single click of whatever application in the Dock makes that application active in the Finder (you see its name appear in the upper left of the menu bar) but otherwise nothing happens... You then have to click a second time and then you switch over to Space 4... It's not really a double click because that implies to clicks closely spaced in time... For this, you can click once, leave the room, come back, click a second time and you will now switch to the alternate space where the open application is running... That is clearly different than it was under Leopard and I would suggest that it is a bug because there is no value in the outcome of that first click... It highlights the switched application but doesn't actually switch to it until you click a second time...
    Second, and this one is worse, if you say launch Excel (which you want to open in Space 4) while you are in Space 1, Excel will open and switch over to Space 4... So far so good... But now, with Excel open over in Space 4, if you are now back and working in Space 1 and while there you use the Finder to go to some other, currently unopened, Excel file and request that it open, it should switch over to Space 4 and open that file but instead it opens it wherever you are, in the case mentioned here, in Space 1... So now you have Excel files opened both in Spaces 1 and 4... Clearly a bug... Spaces had some similar issues in a few early versions of Leopard but they eventually got it working... Now it appears Spaces has regressed somewhat in SL... I love spaces and use it all the time... Hope it gets fixed soon... thanks... bob...

    Hi... I have since learned that the first paragraph of my original post where I say,
    "I've noticed two problems with Spaces that have arrived since switching to Snow Leopard... First, if I am in say Space 1 where I use Safari and I then want to move over to an open application, say like Excel, that I have running in Space 4, there are a number of ways to get there but one way I used to use all the time was to move down to the Dock and simply single click on the open Excel application and that would immediately switch me over to Space 4 and whatever Excel documents were already open there... Now, since switching to SL, a single click of whatever application in the Dock makes that application active in the Finder (you see its name appear in the upper left of the menu bar) but otherwise nothing happens... You then have to click a second time and then you switch over to Space 4... It's not really a double click because that implies to clicks closely spaced in time... For this, you can click once, leave the room, come back, click a second time and you will now switch to the alternate space where the open application is running... That is clearly different than it was under Leopard and I would suggest that it is a bug because there is no value in the outcome of that first click... It highlights the switched application but doesn't actually switch to it until you click a second time... "
    ...that turned out to be my mistake... In another post someone pointed out that in Spaces preferences you must have checked ON the preference that says,
    "When switching to an application, switch to a space with open windows for the application"...
    I had been playing with a number of things trying to figure out what was going on and somewhere in the mix had switched that off... (It is on on all my other computers and I'm sure it originally was on this one too)... When I switched it back on the above described problem went away... So that was my fault...
    But the second part,
    "Second, and this one is worse, if you say launch Excel (which you want to open in Space 4) while you are in Space 1, Excel will open and switch over to Space 4... So far so good... But now, with Excel open over in Space 4, if you are now back and working in Space 1 and while there you use the Finder to go to some other, currently unopened, Excel file and request that it open, it should switch over to Space 4 and open that file but instead it opens it wherever you are, in the case mentioned here, in Space 1... So now you have Excel files opened both in Spaces 1 and 4... Clearly a bug... "
    ...is a real problem... I fired up my G4 (power pc) that runs Leopard, 10.5.8, to see whether it behaves the above way or not and it does NOT... It works as one would expect.. So at least later in Leopard, the above mentioned problem was not present but it is in this first incarnation of Snow Leopard...
    To me, the utility of Spaces is all about keeping a single desktop from being cluttered with many open applications/files and to now have an application that opens in whatever space you happen to be in after it is first opened in its "correct" space sort of defeats the idea behind Spaces... I am currently trying to train myself to first hit <command><4> (my Excel space) before opening a second or subsequent Excel document to prevent it from opening somewhere where I don't want it to be...
    Again, I hope Apple sees and fixes this... I did submit an "Apple feedback" item for this issue... thanks... bob..

  • Problems with client.jar - generated from webservices toolkit from JDK 1.1.7

    We have deployed a web application using the webservices in WL 6.1 using JDK 1.3.1.
    The clients were able to successfully access the servlet it generated and download
    the client.jar. Unfortunately this client.jar seems to be dependent on JDK 1.2
    and beyond. It seems to use java.util.Map class in the JNDI-SOAP SPI.
    Is there any workaround or fix to this problem, so this jar can be used from a
    JDK 1.1.7 env?.
    Our objective is to use WL 6.1 EJB's from WL 4.5.1 using Webservices. Are there
    any known problems with this approach (Ofcourse other than this).
    Thank you.
    Dora Potluri
    Here is the stack trace from using the client.jar
    Class not found java.lang.ClassNotFoundException: java.util.Map
    [Root exception is java.lang.ClassNotFoundException: java.util.Map]javax.naming.
    NamingException: Class not found java.lang.ClassNotFoundException: java.util.Map
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at javax.naming.NamingException.<init>(Compiled Code)
    at weblogic.soap.http.SoapContext.throwNamingException(Compiled Code)
    at weblogic.soap.http.SoapContext.lookup(Compiled Code)
    at javax.naming.InitialContext.lookup(Compiled Code)
    at weatherEJB.WeatherBean.getTemp(Compiled Code)
    at weatherEJB.WeatherBeanEOImpl.getTemp(Compiled Code)
    at weatherEJB.WeatherBeanEOImpl_WLSkel.invoke(Compiled Code)
    at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(Compiled Code
    at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(Compiled
    Co
    de)
    at weblogic.rmi.extensions.BasicRequestDispatcher$BasicExecuteRequest.ex
    ecute(Compiled Code)
    at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
    Fri Sep 21 10:47:12 CDT 2001:<I> <EJB> Transaction: '1001087185816_1' rolled bac
    k due to EJB exception:

    Yes, there is an expectation that the client jar will be run on JDK 1.3x. WLS 6.1 is certified on JDK 1.3x only. This
    applies to the WebServices client as well. For details on platform support see
    http://e-docs.bea.com/wls/platforms/index.html
    Thanks,
    Jim
    Jim Rivera
    Product Manager, WebLogic Server
    BEA Systems, Inc.
    Dora Potluri wrote:
    I started testing using the client.jar generated by webservices WL 6.1 and found
    that it uses reflection API interfaces that are not available til JDK 1.3. Is
    there an expectation that the clients of Webservices are all going to be JDK 1.3.X.
    Here is the stack trace we get.
    java.lang.NoClassDefFoundError: java/lang/reflect/InvocationHandler
    at weblogic.soap.http.SoapContext.lookup(SoapContext.java:76)
    at javax.naming.InitialContext.lookup(InitialContext.java:280)
    at weatherEJB.WeatherBean.getTemp(WeatherBean.java:106)
    at weatherEJB.WeatherBeanEOImpl.getTemp(WeatherBeanEOImpl.java:47)
    at weatherEJB.WeatherBeanEOImpl_WLSkel.invoke(WeatherBeanEOImpl_WLSkel.java:90)
    at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(BasicServerObjectAdapter.java:261)
    at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicRequestHandler.java:56)
    at weblogic.rmi.extensions.BasicRequestDispatcher$BasicExecuteRequest.execute(BasicRequestDispatcher.java:166)
    at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)

  • Problem with NIReport.llb\Print HTML Report using IE.vi on different machines

    We have 5 machines here in our workgroup which have the same state regarding security patches and other system updates. We recently found out that there is a problem with the NIReport.llb\Print HTML Report using IE.vi on the different machines.
    If I would open the VI on MachineA the control could be loaded. If I would open the VI on MachineB the control could be loaded. If I would copy the VI from MachineB to MachineA and open the VI the control could not be loaded. If I would copy the VI from MachineA to MachineB and open the VI on MachineB the control could be loaded. MachineB could load the version from MachineA and MachineB but on MachineA only the own version will load. I have seen that both versions have the same GUID for the Microsoft Webbrowser but are different in some other aereas.
    Since printing HTML Reports is part of the application which will be distributed as application I want to know if someone else have seen such a behaviour or has got problems distributing an application.
    Also I want to know which additional information is stored in an Active-X container about the control beside the GUID.
    We have Win XP Prof SP2 with MS IE 6.0.2900.2180 on all machines in the workgroup.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

    Hi Tom,
    this is the VI <vi.lib>\Utillitiy\NIReport.llb\Print HTML Report using IE.vi copied from a machine that can load and run the VI and it will print. On this machine the control in the VI is white.
    This VI will give the "Control could not be loaded" message on my machine.
    The file shdocvw.dll is 2006-10-23 16:18 size 1.460 KB and I verifyed that both machines have the same version of this file.
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    Print HTML Report using IE.png ‏11 KB

  • A problem with servlets with  WebLogic 4.5.1 SP11

              Hello,
              We have developed a client that connects to servlets in WebLogic 4.5.1. Some of the servlets use sessions to store data, and they receive some parameters from the client to retrieve information from a database.
              When we use WebLogic 4.5.1, everything works fine. However, when we upgrade it to Service Pack 11, we find a problem. If we make a servlet that receives some parameters, but it does no use sessions, everything is correct. If we make a servlet that does not receive any parameter, and we use sessions, we find no problem either. But if we make a servlet that receives parameters and uses sessions within the doPost() method, there is an exception when we call the method Request.getSession(true).
              I would thank any help about this point, since I'm not sure if this is the result of a bug, or if there is a new parameter that we have to set in the file weblogic.properties, or any other reason.
              The code of our servlet is as simple as follows:
              public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
                   ObjectInputStream in = new ObjectInputStream(request.getInputStream());
                   String arg = null;
                   String arg2 = null;
                   String arg3 = null;
                   try{
                        arg = (String)in.readObject();
                        arg2 = (String)in.readObject();
                        arg3 = (String)in.readObject();
                   }catch(Exception e){
                   // Get the session and the counter param attribute
                   HttpSession session = request.getSession(true);
              // WE GET THE EXCEPTION AT THIS POINT.
                   Integer ival = (Integer) session.getValue("simplesession.counter");
                   if (ival == null)
                        // Initialize the counter
                        ival = new Integer(1);
                   else
                        // Increment the counter
                        ival = new Integer(ival.intValue() + 1);
                   // Set the new attribute value in the session
                   session.putValue("simplesession.counter", ival);
                   // Output data
                   ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
                   out.writeObject(ival);
                   out.close();
              On the other hand, the client invokes the serlvets using the following code:
              public int servletClient(String usuario,String password) {
                   int numero = 0;     
                   try{
                        // Input parameters
                        Serializable[] objs = {"login",usuario, password};
                        // Invokes the servlet
                        ObjectInputStream in = ServletWriter.postObjects(urlServlet, objs); // SEE BELOW...
                        // Get the results
                        numero = ((Integer)in.readObject()).intValue();
                        in.close();
                   }catch(Exception e){
                        e.printStackTrace();
              static public ObjectInputStream postObjects(URL servlet, Serializable objs[]) throws Exception
                        URLConnection con = servlet.openConnection();
                        con.setDoInput(true);
                        con.setDoOutput(true);
                        con.setUseCaches(false);
                        con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                        // Write the arguments as post data
                        ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
                        int numObjects = objs.length;
                        for (int x = 0; x < numObjects; x++) {
                             out.writeObject(objs[x]);
                        out.flush();
                        out.close();
                        return new ObjectInputStream( con.getInputStream() );
              // THE CLIENT CODE FINISHES HERE
              The exception we get is the following:
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> Servlet failed with RuntimeException
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.io.IOException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              --------------- nested within: ------------------
              weblogic.utils.NestedRuntimeException: cannot parse POST parameters of request /HelloWorldServlet
              - with nested exception:
              [java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20]
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.lang.RuntimeException.<init>(Compiled Code)
              at weblogic.utils.NestedRuntimeException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              I hope all this information can help you making an idea of our problem. We will be looking forward to receiving your answer.
              Thanks in advance,
              Frankie Carrero.
              

              Hello,
              We have developed a client that connects to servlets in WebLogic 4.5.1. Some of the servlets use sessions to store data, and they receive some parameters from the client to retrieve information from a database.
              When we use WebLogic 4.5.1, everything works fine. However, when we upgrade it to Service Pack 11, we find a problem. If we make a servlet that receives some parameters, but it does no use sessions, everything is correct. If we make a servlet that does not receive any parameter, and we use sessions, we find no problem either. But if we make a servlet that receives parameters and uses sessions within the doPost() method, there is an exception when we call the method Request.getSession(true).
              I would thank any help about this point, since I'm not sure if this is the result of a bug, or if there is a new parameter that we have to set in the file weblogic.properties, or any other reason.
              The code of our servlet is as simple as follows:
              public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
                   ObjectInputStream in = new ObjectInputStream(request.getInputStream());
                   String arg = null;
                   String arg2 = null;
                   String arg3 = null;
                   try{
                        arg = (String)in.readObject();
                        arg2 = (String)in.readObject();
                        arg3 = (String)in.readObject();
                   }catch(Exception e){
                   // Get the session and the counter param attribute
                   HttpSession session = request.getSession(true);
              // WE GET THE EXCEPTION AT THIS POINT.
                   Integer ival = (Integer) session.getValue("simplesession.counter");
                   if (ival == null)
                        // Initialize the counter
                        ival = new Integer(1);
                   else
                        // Increment the counter
                        ival = new Integer(ival.intValue() + 1);
                   // Set the new attribute value in the session
                   session.putValue("simplesession.counter", ival);
                   // Output data
                   ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream());
                   out.writeObject(ival);
                   out.close();
              On the other hand, the client invokes the serlvets using the following code:
              public int servletClient(String usuario,String password) {
                   int numero = 0;     
                   try{
                        // Input parameters
                        Serializable[] objs = {"login",usuario, password};
                        // Invokes the servlet
                        ObjectInputStream in = ServletWriter.postObjects(urlServlet, objs); // SEE BELOW...
                        // Get the results
                        numero = ((Integer)in.readObject()).intValue();
                        in.close();
                   }catch(Exception e){
                        e.printStackTrace();
              static public ObjectInputStream postObjects(URL servlet, Serializable objs[]) throws Exception
                        URLConnection con = servlet.openConnection();
                        con.setDoInput(true);
                        con.setDoOutput(true);
                        con.setUseCaches(false);
                        con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                        // Write the arguments as post data
                        ObjectOutputStream out = new ObjectOutputStream(con.getOutputStream());
                        int numObjects = objs.length;
                        for (int x = 0; x < numObjects; x++) {
                             out.writeObject(objs[x]);
                        out.flush();
                        out.close();
                        return new ObjectInputStream( con.getInputStream() );
              // THE CLIENT CODE FINISHES HERE
              The exception we get is the following:
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> Servlet failed with RuntimeException
              Mon Feb 21 13:47:41 GMT-02:00 2000:<E> <ServletContext-Servlets> java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.io.IOException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              --------------- nested within: ------------------
              weblogic.utils.NestedRuntimeException: cannot parse POST parameters of request /HelloWorldServlet
              - with nested exception:
              [java.io.IOException: Unexpected end of POST data. Read 0 bytes. Content-length = 20]
              at java.lang.Throwable.<init>(Compiled Code)
              at java.lang.Exception.<init>(Compiled Code)
              at java.lang.RuntimeException.<init>(Compiled Code)
              at weblogic.utils.NestedRuntimeException.<init>(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.mergePostParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.parseQueryParams(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getParameter(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.initSessionInfo(Compiled Code)
              at weblogic.servlet.internal.ServletRequestImpl.getSession(Compiled Code)
              at SGBA.servlets.HelloWorldServlet.doPost(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at javax.servlet.http.HttpServlet.service(Compiled Code)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.servlet.internal.ServletContextImpl.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.invokeServlet(Compiled Code)
              at weblogic.socket.MuxableSocketHTTP.execute(Compiled Code)
              at weblogic.t3.srvr.ExecuteThread.run(Compiled Code)
              I hope all this information can help you making an idea of our problem. We will be looking forward to receiving your answer.
              Thanks in advance,
              Frankie Carrero.
              

  • Problems with servlet mapping in 10g AS

    Hi There,
    i have a web application consisting of 2 controller servlets and use url mapping to send requests to the appropriate servlet, but i have a strange issue with 10g where it seems to be alternating between serlvets when handling requests!!!!
    the web.xml is like as follows (with the app having the root context '/app'):
    <servlet>
    <servlet-name>control1</servlet-name>
    <servlet-class>com.package1.class.name</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>control2</servlet-name>
    <servlet-class>com.package2.class.name</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>control2</servlet-name>
    <url-pattern>/special/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>control1</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    therefore i'd expect a request like http://domain.name/app/special/content to be handled by the control2 servlet and http://domain.name/app/normal/content or http://domain.name/app/normal/special/content to be handled by the control1 servlet...
    but what seems to happen when requesting http://domain.name/app/special/content oc4j seems to alternate which servlet it passes it to...
    is there any reason why this might be happening (like some app server configuration), as i have other applications that are configured in the same way, and there's no problems with requests going to the wrong servlet.
    many thanks for your help,
    Andy

    In your integration process, define the import parameter under Configurable Parameters category.
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/1f1a5c932d0d19e10000000a114a6b/frameset.htm
    Regards,
    Prateek

  • Problem with Servlets

    Hi,
    I am Tejas , a newbie with servlets. Now, I have a servlet which contains a Javascript method. On clicking a link , the Javascript method is called.
    But however, I find that there is some trouble. I created a class called MainFrames.java, the object of which I am instantiating in the Javascript method.
    But this code doesnt work properly. I have given the snippet below
    out.println("<script type='text/javascript'>");
    out.println("function threader()");
    out.println("{");
    out.println("alert('Inside Threader');");
    out.println("<%@ page import=\"XcForm.MainFrames\"%>"); //I have a hunch that this statement is the problem
    out.println("<%");
    out.println("MainFrames mainframes = new MainFrames();"); //without the import statement above, the MainFrames.java class is not being recognised
    out.println("%>");
    out.println("}");
    out.println("</script>");
    Thanks in advance,
    Tejas

    Do not put presentation code in servlets. Put them in JSPs. And mixing serverside code (scriptlets) and clientside code (javascript) this way is indeed not going to work. That code will certainly not be executed in the order as you write. Serverside code is executed at the server and is finished when the response is completed. So any serverside code inside clientside code is alreay executed. Clientside code is executed at the client and will only execute when the response is completed (onload, etc) or when the client invokes it (onclick, onsubmit, etc). Further on, do not put business code in presentation code. Put them in servlets.

  • Problems with servlet filters

    Hello,
    I'm trying to implement filters for some of the examples presented in the j2ee tutorial. Thus, I've realized a very simple filter that works very well for the Converter example (mapped to the index.jsp URL). But this filter doesn't work with the Duke's Bank application and I don't understand why. I've tried to map this filter to the Dispatcher servlet and also to different URLs, the filter is actually executed, but the client gets no response from the server.
    Here's the source code for my filter :
    package com.sun.ebank.web.filters;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public final class MyFilter implements Filter {
    private FilterConfig filterConfig = null;
    public void init(FilterConfig filterConfig) throws ServletException {
    this.filterConfig = filterConfig;
    public void destroy() {
    this.filterConfig = null;
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    if (filterConfig == null) return;
    HttpServletRequest hr = (HttpServletRequest)request;
    System.out.println ("MyFilter : " + hr.getMethod () +      " URL=" + hr.getRequestURL () +          " QueryString={" + hr.getQueryString () + "}");
    chain.doFilter(request, response);
    public String toString() {
    if (filterConfig ==null) return ("MyFilter()");
    StringBuffer sb = new StringBuffer("MyFilter(");
    sb.append(filterConfig);
    sb.append(")");
    return (sb.toString());
    Can anybody help me?
    Thanks,
    B.F.

    As you're not actually doing anything in this filter but a quick System.out.print, there doesn't appear to be a problem with the filter code.
    What does your web.xml file look like?
    Does your IDE allow you to trace through the filter to the next target in the chain? If so, where does the code die? If not, use System.out.print statements to determine how far into the code you get.
    No response to the client usually means that the response didn't have any content set. You can verify this by checking the state of the response object after doFilter has been called; if the headers haven't been set then something crashed in a bad way.
    Good luck!

  • Problem with Servlet Tutorial

    I am going through the servlet tutorial with a specific end in mind. I found a section that I think relates exactly to what I want to do. I want to have servlet redirect the user to another URL. The following code is given as an example.
    public class Dispatcher extends HttpServlet {     
       public void doGet(HttpServletRequest request,      
          HttpServletResponse response) {     
          request.setAttribute("selectedScreen",     
             request.getServletPath());     
          RequestDispatcher dispatcher = request.     
             getRequestDispatcher("/template.jsp");     
          if (dispatcher != null)     
             dispatcher.forward(request, response);     
       public void doPost(HttpServletRequest request,      
    }The problem is that I can't compile this. There is no HttpServletRequest.getRequestDispatcher(String) method. Am I misssing something here? Am I even on the right track?

    An extract from one of my servlets that redirects to
    another URL is
    this:response.sendRedirect(response.encodeRedirec
    URL("NoLogon"));But it appears you want to
    forward, rather than redirect. There's a difference,
    but I don't exactly know what it is. The forwarding
    example in my servlets book looks like
    this:RequestDispatcher dispatcher =
    getServletContext().getRequestDispatcher(address);
    dispatcher.forward(request, response);
    I tried pasting your first example into my code and got the follwoing error:
    Method encodeDirectURL(java.lang.String) not found in interface javax.servlet.ServletResponse
    It seems like there is still something missing here. When I look at the API I only see four methods for this class.

Maybe you are looking for

  • S3-S440 no wifi after upgrading to Windows 8.1

    After upgrading to windows 8.1, the wifi is not working anymore. I cannot find the wifi driver in the device managerment and I cannot see any information about wifi driver. I try to re-setup the driver many times and checked the wireless module was e

  • Screen Stays on while connected to PC

    Is this normal with new 5th Gen 80gb units. My old 3rd gen would turn off the backlight after connecting to the PC. After disconnected from PC - backlight goes out in time frame selected. G4   Mac OS X (10.4.7)  

  • If computer turned off on the day of a set reminder, it isn't popping up the following day.

    I have several recurring reminders that I get to pop up on the first of every month for example. It is a work computer, and since the first of March fell on a Sunday, my computer was turned off. I would expect that the reminders would have then poppe

  • Passing Parameters in URL problem

    I have a page where I do some processing. I have created a branch on that page back to the main report page for the app. I have the following on the "Edit Branch" page: Point Branch Point: On Submit: After Processing... Sequence: 10 Action Target typ

  • CC Updater will not connect to update programs

    Mac 10.9 Problem is relatively new and a while after 10.9 (Maverick) updgrade. I click on Updater and it cannot connect for updates now.