Html form stop sunmitting to servlet

Hi,
I have a web application developed with Servlet and running on Tomcat. The web application is to search and retrieve records in Mysql database. The records are displayed and click a submit button will create a pdf file. The user may print it or/and save it.
The web application runs well after deployed to Tomcat, but after while, it changes from time to time, sometime one day, sometime several hours. Click the submit button does not submit to the servlet which creates a pdf file. I have to redeploy the web application to make it work again.
There is no exception thrown and no any other run time errors, simplely click the button does nothing. The screen refreshes, and show the same displayed records.
Thanks for any ideas about what might be wrong.
Mindy

What i m goin to say doesn't hv any affect but smtimes it does hav..
just try this...
cut ur source folder frm the present location & paste it in parallel to ur Webinf folder,then recompile & restart tomcat & run ur appl.

Similar Messages

  • Error when using a HTML form along with a servlet

    Hi All,
    I am using Sun Studio 4 to create a HTML form that takes in 4 inputs and then
    passes them on to a servlet to be processed.
    In my HTML form i have the form heading.. <form method = post action="processServlet">
    my directory structure is as follows:
    /home/cosmo/projects/testservlet/processServlet ... processServlet being the servlet underneath the testservlet directory.
    inputForm.html is also under the same testservlet directory. I am running TOMCAT.. and under the run time tab under tomcat --> Internal --> it has localhost:8081 and under that the default context is /home/cosmo/projects/testservlet
    NOW, when i execute my HTML page the URL on top says "http://localhost:8081/inputForm.html
    which seems correct. I get my form correctly. When i input the data,and i hit the submit button, the URL says "http://localhost:8081/processServlet" which i think is also correct, but i get a "404 Error and the error description says " The requested resource( /processServlet)
    is not available." I have coded the servlet to give me just a few lines of output, but instead, the above error shows up.
    Why would this be happening? Do i have my directory structure messed up? Do i have the wrong type of template? I used a web module to do this. I also compiled my Servlet from Sun Studio without any errors.
    Any help would be appreciated.
    Thanks
    Kal.

    You can't post directly to a servlet the way you can to an HTML or JSP page. You must map your requests to specific servlets for the request to get directed there. There are entries in the web.xml for this.
    You need to map the request for "processServlet" to "edu.xxx.yyy.processServlet", or the servlet engine won't know what to do with that request.
    Often times, an app will route all requests for a particular extension to a router servlet, which then figures out which class to actually send the request to. This keeps you from having to map all servlets in the web.xml file.

  • Problem in passing  HTML form values to a servlet in NetBean IDE

    hi there,
    When i click the submit button of the HTML File(with two textFields with values) the value received in the corresponding servlet is null , I used the get method to pass value so i was able to see the values in the URL but when i print the value in the Servlet it display null. I have verfied the web.xml to cheak the servlet mapping is right .Servlet mapping are perfect but i am not getting the value in the next page. Kindly give your suggestions.
    Thanks in advace

    Try this in your servlet.
    HttpSession session = request.getSession(true);     
    System.out.println(request.getParameter("xxxxx").toString());
    xxxx is the parameter name..
    Doesn't this work?

  • Uploading an image to a servlet with out  html form

    Hello,
    I had a look around the forum and could not find an answer to my question.
    I am trying to unload an image that is in a byte array to a servlet. the image is on the mobile phone. the mobile phone does not have html form to upload the picture.
    Is there any other way of uploading instead of using html form to invoke the servlet. It is just the connection bit that is confusing me. When the servlet is invoked then it can open an inputstream and take in the image.
    I hope this is clear and that some one else has done it.
    thanks
    martin

    search here and/or search google for "send byte array to servlet"
    it's certainly easy to find as far as i can tell
    first google result:
    http://forum.java.sun.com/thread.jspa?messageID=10173137&tstart=0

  • Validating HTML form generated by servlet

    Hi, folks. I have a dynamic html form generated by a servlet class. Once user fills up the form and submits it, i have another servlet does the form validation. My question is how can i reload the generated html form with error messages when user's inputs failed validation?
    I am not able to use JavaScript pop-up windows for doing validation cause the page will be displayed on PDA and cell phone as well. Any help is greatly appreciated.

    Could you combine the servlets.
    I'm not sure but then you may be able to have the generator servlet in the doGet method and the validator in the doPost method. (don't quote me on this)
    If you combine the servlets you have access to the original data (the form), that way if any validation errors occur you can repost the form with their entered data and an error message.

  • Question about running a servelt using HTML form.

    Hi, Im new to Servlets , I have created a servelt with this code :
    package oracle.servlets;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class LoginServlet extends HttpServlet {
        private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
        private static final String DB_URL = "jdbc:oracle:thin:@localhost:1521:ahmaddb";
        private static final String DB_USERNAME = "fundinfo";
        private static final String DB_PASSWORD = "tadapps";
        private static Connection con;
        private String pass;
        private String name;
    /*init() : invoked by the servlet engine before the servicing of client requests
    - Can be used to retrieve initialization parameters
    – Takes a ServletConfig object as a parameter
    – Is invoked when the servlet instance is created
    – Is useful for obtaining database connections from a connection pool*/
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
            //config.getInitParameter(arg0);
        public void doGet(HttpServletRequest request,
                          HttpServletResponse response) throws ServletException,
                                                               IOException {
    response.setContentType(CONTENT_TYPE);
            //PrintWriter : Print formatted representations of objects to a text-output stream.
            //getWriter() : Returns a PrintWriter object that can send character text to the client.
            PrintWriter out = response.getWriter();
            out.println("<html>");
            out.println("<head><title>My First Servlet</title></head>");
            out.println("<body>");
            out.println("<p>The servlet has received a GET. This is the reply.</p>");
            out.println("</body></html>");
            out.close();
        public void doPost(HttpServletRequest request,
                           HttpServletResponse response) throws ServletException,
                                                                IOException {
            response.setContentType(CONTENT_TYPE);
            PrintWriter out = response.getWriter();
            name = request.getParameter("user_name");
            pass = request.getParameter("user_password");
            boolean result = verifyPassword(name, pass);
            out.println("<html>");
            out.println("<head><title>LoginServlet</title></head>");
            out.println("<body>");
            if (result == true){
            out.println ("Hello " + name + ": Your login module is working great!");
            else{
            out.println ("Invalid user name or password");
            out.println ("</body></html>");
            out.close();
            // out.println("<p>The servlet has received a POST. This is the reply.</p>");
            //out.println("</body></html>");
            //out.close();
        public void configureConnection() throws SQLException {
        try{
        Class.forName("oracle.jdbc.OracleDriver");
        con = DriverManager.getConnection(DB_URL, DB_USERNAME,DB_PASSWORD);
        con.setAutoCommit(true);
        catch (Exception e){
        System.out.println("Connection failed: " +e.toString());
        public Connection getConnection() throws SQLException
        configureConnection();
        return con;
        protected boolean verifyPassword(String theuser, String password) {
        String originalPassword = null;
        try {
        con = getConnection();
        Statement stmt = con.createStatement();
        stmt.executeQuery("select password from login where uname='"+theuser+"'");
        ResultSet rs = stmt.getResultSet();
        if(rs.next())
        //>>
        originalPassword = rs.getString(1);
        stmt.close();
        if(originalPassword.equals(password)) {
        return true;
        else {
        return false;
        catch (Exception e){
        System.out.println("Exception in verifyPassword()="+e.toString());
        return false;
    }and created an HTML form to target this servlet
    <form action="/loginservlet" method="post">,
    when I enter the the credintials I get this output in the webpage :
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.5 404 Not Found
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.

    Thanks , yes it is added to the web.xml
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
        <description>Empty web.xml file for Web Application</description>
        <servlet>
            <servlet-name>LoginServlet</servlet-name>
            <servlet-class>oracle.servlets.LoginServlet</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>LoginServlet</servlet-name>
            <url-pattern>/loginservlet</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>35</session-timeout>
        </session-config>
        <mime-mapping>
            <extension>html</extension>
            <mime-type>text/html</mime-type>
        </mime-mapping>
        <mime-mapping>
            <extension>txt</extension>
            <mime-type>text/plain</mime-type>
        </mime-mapping>
    </web-app>Anymore suggestions?

  • Uploading File To MySQL from HTML form via Servlet

    Hello all !
    I hope this is better place to ask.
    I'm working on simple Servlet/Jsp application trying to hold to MVC pattern and got stuck on uploading file to MySQL db.
    Here's what I'm trying to accomplish:
    1) client submits a JPEG image via a simple html form on a webpage.
    2) JPEG is put into a database table, column field of type BLOB.
    3) Servlet processes the request, gets a connection to the db and inserts the image into the table.
    4) after that user is able to retrieve an image from db and display it in JSP page.
    This is pretty much the same task Angela was trying to do here:
    http://forum.java.sun.com/thread.jspa?threadID=667597&messageID=3905449
    I could use her snippets if i knew what is what and decided to figure out this myself. Aftet some investigation i found out that i need to import org.apache.commons.fileupload.*;which i found here: http://jakarta.apache.org/commons/fileupload/
    what am i driving at ?
    -----------------------1-----------------------
    After first line of code
    boolean isPart = FileUpload.isMultipartContent(request);netBeans 5.5 beta2 with bundled Tomcat 5.5.17 underlines this with warning saying that
    org.apache.commons.fileupload.FileUploadBase
    has been depreceted
    is it a reason for concern ?
    -----------------------2-----------------------
    Is it actually good idea to store images in db as blob ?
    what about large ammounts of text ?
    thank you
    -Dominik

    is it a reason for concern ?Yes.
    You should take a look at the method in the documentation and find out exact reason for depricating it.
    If it is depricated becouse they going to remove it in the future you should use the new alternative method becouse if you use the old method your app will not work in the future releases of the API.
    If it is depricated becouse it is not safe to use the method you should clearly understand the risks involved in using the method and see if that can give you any trouble in your project.
    -----------------------2-----------------------
    Is it actually good idea to store images in db as
    blob ?I think that it is ths best option available when you want to store binary data
    what about large ammounts of text ?You can use clob columns.
    By the way when you store files in the database its better you put some extra columns to store the file name and file type(mime) becouse you cant directly detect those things later by just looking at the data of the file.

  • JDBC + SERVLET: inserting text data  to access file from Html form

    Hi everybody !
    I'm trying to insert text data from my html form to access database using servlet and jdbc technologies.
    The problem that I'm that the data is TEXT, but not the English language !!!
    So my access db file gets - ???????? symbols instead the real text.
    This is the form line that sending data to my servlet:
    <form
    method="POST"
    ACTION=http://localhost:8080/servlet/myServlet enctype="text/html">
    And this is servlet line that defines response content:
    res.setContentType( "text/html" );
    What can I do to get in access db file the right text format and not a ???????? symbols.
    Maybe I must to ad some <meta ...> , but where ?

    You're dealing with Unicode, I'd guess, and not ASCII.
    I guess I'd have two questions:
    (1) Is the character encoding on your pages set properly for the language you're trying to use?
    (2) Does Access handle Unicode characters?
    Access isn't exacly a world-class database. (If it was, there'd be no reason for M$ to develop SQL Server.) I'd find out if it supports other character sets. If not, you'll have to switch to a more capable database that does. - MOD

  • Displaying images in HTML Forms inside Servlets

              Dear friends
              How are you?
              I am developing Servlets in WebGain Studio Pro V4.1 VisualCafe
              V4.1 to display dynamic HTML forms with embedded
              images (*.jpg and *.gif).
              Please see the following sample code -
              "<DIV ID=\"Logo\" STYLE=\"position:absolute; left: 4%; top: 4%;
              width: 25%; height: 12%; z-index:1; visibility:visible\">" +
              "<IMG SRC=\"FigLogo.gif\" WIDTH=\"100%\" HEIGHT=\"100%\">" +
              "</DIV>"
              Then I deploymed servlets to BEA WLS 6.0 by including Servlets
              in the Web.xml file. However, I do not see the images when
              viewed in IE5.0 browser.
              I appreciate all comments and suggestions.
              Thanking you
              Very truly yours
              Sriram (Ram) Peddibhotla, PhD
              

              Dear Friends
              How are you?
              I moved all images (*.jpg, *.gif) to the subdirectory
              /myDomain/applications/DefaultWebApp_myServer/images
              and they are displaying now in the servlets with HTML forms.
              Thanking you
              Very truly yours
              Sriram (Ram) Peddibhotla, PhD
              "Sriram (Ram) Peddibhotla" <[email protected]> wrote:
              >
              >Dear Friends
              >
              >How are you?
              >
              >When the Servlet displays in the browser (IE5.0), when I click on where
              >the image
              >should be, I see the path
              >http://localhost:7001/servlet/FigureName.jpg (????). Why did it add
              >the /servlet
              >part to the path, I thought that was exclusively for deploying servlets
              >in web.xml
              >file.
              >
              >Thanking you
              >Very truly yours
              >Sriram (Ram) Peddibhotla, PhD
              >
              >
              >"Xiang Rao" <[email protected]> wrote:
              >>
              >>Check access.log to see the status of your image request (status code
              >>and response
              >>size). You can also check weblogic.log. On the other hand, IE cache
              >setup
              >>(e.g.,
              >>"Never") could cause this problem.
              >>
              >>"Sriram (Ra) Peddibhotla" <[email protected]> wrote:
              >>>
              >>>Dear friends
              >>>
              >>>How are you?
              >>>
              >>>I am developing Servlets in WebGain Studio Pro V4.1 VisualCafe
              >>>V4.1 to display dynamic HTML forms with embedded
              >>>images (*.jpg and *.gif).
              >>>
              >>>Please see the following sample code -
              >>>"<DIV ID=\"Logo\" STYLE=\"position:absolute; left: 4%; top: 4%;
              >>>width: 25%; height: 12%; z-index:1; visibility:visible\">" +
              >>>"<IMG SRC=\"FigLogo.gif\" WIDTH=\"100%\" HEIGHT=\"100%\">" +
              >>>"</DIV>"
              >>>
              >>>Then I deploymed servlets to BEA WLS 6.0 by including Servlets
              >>>in the Web.xml file. However, I do not see the images when
              >>>viewed in IE5.0 browser.
              >>>
              >>>I appreciate all comments and suggestions.
              >>>
              >>>Thanking you
              >>>Very truly yours
              >>>Sriram (Ram) Peddibhotla, PhD
              >>>          
              >>
              >
              

  • Getting a servlet to write a HTML form

    The problem is that I'm writing an auction website for a uni coursewor. In the main index, it has a "View Auctions"link, linked to a servlet that looks up the data in the database. It then generates a webpage with the results. At the bottom of the HTML page generated by the servlet, I want it to create a form so that the user can enter a bid by filling in the fields and click the submit button. My plan is to then have it go to another servlet that records the bid in the database.
    The main problem is the HTML line: <form name="makeBidForm" method="post" action="servlet/Bid">
    Because it has (and needs) quotes in the HTML coding, I'm finding it difficult to build a string with the quotes in it; everytime I enter a " character, Java is assuming I'm either opening or closing a Java ", instead of just wanting to have the " as part of the string.
    Is there a way to get around this, or a better way to do what i'm doing?
    So far the webpage shows up ok, but I'm getting ' " expected ' errors when i add the form line.
    The code I have so far is below:
    //ViewAuction.java, view and place bids user interface class
    //Gopinath Chandran, 2137957, 11.11.2004
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ViewAuction extends HttpServlet{
         public void init() throws ServletException{
              super.init();
              FindAuctionDA.initialize();
         public void destroy(){
              super.destroy();
              FindAuctionDA.terminate();
         public void doGet(HttpServletRequest request, HttpServletResponse response)     throws IOException, ServletException{
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("<html>");
              out.println("<head>");
              String title = "Today's Auctions";
              String array[];
              FindAuctionDA fa = new FindAuctionDA();
              array = fa.findAuction();
              out.println("<title>" + title + "</title>");
              out.println("</head>");
              out.println("<body bgcolor=\"white\">");
              out.println("<h1>" + title + "</h1>");
              for (int i = 0; i < 10; i++){
                   out.println(array);
              out.println("out<form name=" + "makeBidForm" + " method=" + "post" + "action=" + ""> action="servlet/NewBuyer">
              out.println("<p>Place A Bid");
              out.println("<table width=" + "294" + " border="+ "0" + ">");
              out.println("<tr>");
              out.println("<td><div align=" + "right" + ">AUCTION ID: </div></td>");
              out.println("<td><div align=" + "right" + ">");
              out.println("<input type=" + "text" + " name=" + "textfield" + ">");
              out.println("</div></td>");
              out.println("</tr>");
              out.println("<tr>");
              out.println("<td><div align=" + "right" + ">BUYER'S ID: </div></td>");
              out.println("<td><div align=" + "right" + ">");
              out.println("<input type=" + "text" + " name=" + "textfield" + ">");
              out.println("</div></td>");
              out.println("</tr>");
              out.println("<tr>");
              out.println("<td><div align=" + "right" + ">PRICE:</div></td>");
              out.println("<td><div align=" + "right" + ">");
              out.println("<input type=" + "text" + " name=" + "textfield" + ">");
              out.println("</div></td>");
              out.println("</tr>");
              out.println("</table>");
              out.println("<p>");
              out.println("<input type=" + "submit" + "name=" + "Submit" + "value=" + "Submit" + ">");
              out.println("</p>");
              out.println("<hr>");
              out.println("<p>Back");
              out.println("</body>");
              out.println("</html>");

    Might I suggest you use a JSP for the presentation rather than a servlet.
    You can still use the servlet to load the data, but then just forward on to a JSP to do the presentation.
    Use the right tools for the right jobs.
    If you are generating this amount of HTML with out.println() from a servlet, then you should be using a JSP.
    I particularly cringe at seeing all the + strings - they are all strings! Why do the + concatenation?
    ps: I think the problem is that you are closing your form tag twice in the string, and have two action attributes for it. You have ">" outside of a string, and you are not closing your parentheses.
    Do it in JSP - you will find it a lot easier.

  • Can a HTML form send data to two servlets?

    I would like to know if an HTML Form can send data to two servlets, I guess I am askin is that can the parameters be passed to two ACTION attributes??

    Hmmmm, well I'm not sure if that is possible, but you could do something of the sort on the server side by chaining them.... the technieque is called Servlet Chaining
    Hope this helps
    Omer

  • Buttons in HTML Forms attached to servlets

    Hi,
    This seems like it should be a simple thing to me, but I haven't done enough html (or maybe it's enough servlets) to know what to do here.
    I have a section of my webpage that is entirely servlet-based. On one page (created by a servlet), I have a form. I'd like to put two buttons on the bottom of this form and be able to distinguish which one was pushed. The form sends to another servlet and I am getting other data out of the form in that servlet. (Text fields, which is text input type, that show up in the requestParameters). I tried the following:
    out.println( "<input type=\"submit\" value=\"Button1\" name=\"button1\">" );
    out.println( "<input type=\"submit\" value=\"Button2\" name=\"button2\">" );in the servlet that the form connects to, I tried the following:
    String buttonOne = request.getParameter( "button1" );
    String buttonTwo = request.getParamter( "button2" );
    if(buttonOne != null)
         System.out.println( buttonOne );
    if(buttonTwo != null)
         System.out.println( buttonTwo );
    }But when I do this, nothing prints to the screen, so obviously it isn't right.
    Anyways, if anyone could tell me a way I could tell which button was clicked, that's all I want!!!
    Thanks for any help you might give!!

    But when I do this, nothing prints to the screen, so obviously it isn't right.And don't expect System.out.println() in a servlet to print to any "screen". It certainly won't appear in the browser in response to your request; it should appear in one of your servlet container's log files. If it doesn't, then use the servlet log() method instead. Or just generate HTML containing your debugging output and send that back as the response.
    PC&#178;

  • Help : Calling a Servlet.doPost from a HTML Form (404 Error !!!)

    All
    I trying to make a call to a doPost method of a servlet from the doGet method of the same servlet.
    The call is made from an HTML form, so
    *<form name="input" action="servlet/deleteAlertPage" method="post">*
    ======================================================================
    The web.xml file entry is as follows:
    *<servlet>*
    *<servlet-name>deleteAlertPage</servlet-name>*
    *<servlet-class>bsp.perceptive.custom.webapp.deleteAlert.deleteAlertPage</servlet-class>*
    *<load-on-startup>0</load-on-startup>*
    *</servlet>*
    *<servlet-mapping>*
    *<servlet-name>deleteAlertPage</servlet-name>*
    *<url-pattern>/deleteAlertPage</url-pattern>*
    *</servlet-mapping>*
    So when I run my Servlet from my JDeveloper, I do see the “doGet” method getting executed successfully and I see my HTML from appearing on a browser page.
    As soon as I press the submit button, where I want the “doPost” method to get executed, I get the following error:
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    *10.4.5 404 Not Found*
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead.
    The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource
    is permanently unavailable and has no forwarding address.
    Any ideas ? Is my Servlet Setup and Execution Correct ?
    Any help is appreciated.
    My JDeveloper Version is the latest release :
    About
    Oracle JDeveloper 11g Release 1 11.1.1.2.0
    Studio Edition Version 11.1.1.2.0
    Build JDEVADF_11.1.1.2.0_GENERIC_091029.2229.5536
    Copyright © 1997, 2009 Oracle and/or its affiliates. All rights reserved.
    IDE Version: 11.1.1.2.36.55.36
    Product ID: oracle.jdeveloper
    Product Version: 11.1.1.2.36.55.36
    Any help and advice is greatly appreciated.
    Regards
    patrice

    John
    I got it to work !!
    I had to place the application name in the action value also I had to change the port number, from 8080 to be 7101.
    However
    It was not that straight forward, because when I created my web Application I gave it the application Name of "BSPCustPerWebApps" and Project Name of "BSPCustPerWebApps"and this is reflected in my JDeveloper folder structure: "....\mywork\BSPCustPerWebApps\BSPCustPerWebApps\src\bsp\perceptive\custom\webapp\deleteAlert"
    now when I run my Servlet initially I noticed that Browser URL is saying : http://localhost:7101/BSPCustPerWebApps-BSPCustPerWebApps-context-root/deleteAlertPage
    which means that the web application is : BSPCustPerWebApps-BSPCustPerWebApps-context-root
    so I changed my action value to be
    action="http://localhost:7101/BSPCustPerWebApps-BSPCustPerWebApps-context-root/deleteAlertPage"
    and that worked.
    Weblogic must have created/defauled the application name using the application name and project name that I gave duriung the servlet creation.
    Is there a way of changing the application name to be something shorter and more meaningfull ?
    Also I did not want to hard code the server name, port etc in the action value, so again is there way of making this to be derived ?
    Do you know how to access the WebLogic Console ? , considering I have only installed JDev, which has an embedded weblogic server.
    Thanks for your help.

  • How to get a parameter from a HTML  select list in a servlet

    Hi!
    I have the following problem :
    In a HTML form I have the following select list:
    <select name="tickets">
                                            <option value="1">1</option>
                                            <option value="2">2</option>
                                            <option value="3">3</option>
                                            <option value="4">4</option>
                                            <option value="5">5</option>
                                            <option value="6">6</option>
    </select>And in the servlet I try to read the value I have selected doing : String tickB = (String) request.getParameter("tickets");But for my amazement tickB always has the value 1, althought I have selected in the list the value 2,3,4,5 or 6
    �Where is the error ? �Have I to do with getParamaterValues instead getParameter to obtain the correct value?
    Bye
    Edited by: bladu on Jun 4, 2008 1:25 AM

    Where is the error ? No error in portion of code you have shown.
    But for my amazement tickB always has the value 1, althought I have selected in the list the value 2,3,4,5 or 6Are you sure there are no other form element(hidden field, text field) with same name tickets ? If you are using GET method, you may check the url to see if there are more than one parameters named tickets set in it
    Have I to do with getParamaterValues instead getParameter to obtain the correct value? Not required.

  • How can an applet retrieve the values of a HTML form shown in a JEditorPane

    Hi,
    I'm doing an applet that contains a JTree and a JEditorPane
    among other components. Each node of the JTree represents some
    information that is stored in a database, and whenever a JTree
    node is selected, this information is recovered and shown in
    the JEditorPane with a html form. To make the html form,
    the applet calls a servlet, which retrieves the information of
    the node selected from the database. This information is stored
    like a XML string, and using XSLT, the servlet sends the html
    form to the applet, which shows it in the JEditorPane.
    My problem is that I don't know how I can recover new values
    that a user of the application can introduce in the input fields
    of the html form. I need to recover this new values and send them
    to another servlet which store the information in the database.
    If someone could help me I'd be very pleased.
    Eduardo

    At least I found a fantastic example. Here it is:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.net.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    public class FormSubmission extends JApplet {
    private final static String FORM_TEXT = "<html><head></head><body><h1>Formulario</h1>"
    + "<form action=\"\" method=\"get\"><table><tr><td>Nombre:</td>"
    + "<td><input name=\"Nombre\" type=\"text\" value=\"James T.\"></td>"
    + "</tr><tr><td>Apellido:</td>"
    + "<td><input name=\"Apellido\" type=\"text\" value=\"Kirk\"></td>"
    + "</tr><tr><td>Cargo:</td>"
    + "<td><select name=\"Cargo\"><option>Captain<option>Comandante<option>General</select></td>"
    + "</tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"Enviar\"></td>"
    + "</tr></table></form></body></html>";
    protected HashMap radioGroups = new HashMap();
    private Vector v = new Vector();
    public FormSubmission() {
    getContentPane().setLayout(new BorderLayout());
    JEditorPane editorPane = new JEditorPane();
    editorPane.setEditable(false);
    editorPane.setEditorKit(new HTMLEditorKit()
    public ViewFactory getViewFactory() {
    return new HTMLEditorKit.HTMLFactory() {
    public View create(Element elem) {
    Object o = elem.getAttributes().getAttribute(javax.swing.text.StyleConstants.NameAttribute);
    if (o instanceof HTML.Tag)
    HTML.Tag kind = (HTML.Tag) o;
    if (kind == HTML.Tag.INPUT || kind == HTML.Tag.SELECT || kind == HTML.Tag.TEXTAREA)
    return new FormView(elem)
    protected void submitData(String data)
    showData(data);
    protected void imageSubmit(String data)
    showData(data);
    // Workaround f�r Bug #4529702
    protected Component createComponent()
    if (getElement().getName().equals("input") &&
    getElement().getAttributes().getAttribute(HTML.Attribute.TYPE).equals("radio"))
    String name = (String) getElement().getAttributes().getAttribute(HTML.Attribute.NAME);
    if (radioGroups.get(name) == null)
    radioGroups.put(name, new ButtonGroup());
    ((JToggleButton.ToggleButtonModel) getElement().getAttributes().getAttribute(StyleConstants.ModelAttribute)).setGroup((ButtonGroup) radioGroups.get(name));
    JComponent comp = (JComponent) super.createComponent();
    // Peque�a mejora visual
    comp.setOpaque(false);
    return comp;
    return super.create(elem);
    //editorPane.setText(FORM_TEXT);
    editorPane.setText(texto);
    getContentPane().add(new JScrollPane(editorPane), BorderLayout.CENTER);
    private void showData(String data) {
         // ergebnis significa resultado
    StringBuffer ergebnis = new StringBuffer("");
    StringTokenizer st = new StringTokenizer(data, "&");
    while (st.hasMoreTokens()) {
    String token = st.nextToken();
    String key = URLDecoder.decode(token.substring(0, token.indexOf("=")));
    String value = URLDecoder.decode(token.substring(token.indexOf("=")+1,token.length()));
    v.add(value);
    ergebnis.append(" "); ergebnis.append(key); ergebnis.append(": "); ergebnis.append(value); ergebnis.append(" ");
    ergebnis.append(" ");
    JOptionPane.showMessageDialog(this, ergebnis.toString());
    public static void main(String[] args) throws Exception {
    JFrame frame = new JFrame ();
    FormSubmission editor = new FormSubmission ();
    frame.getContentPane().add(editor);
    frame.pack();
    frame.show();
    }

Maybe you are looking for

  • Scratch Disc Questions using Firewire External Drive & Imac

    Hello. I've read through the existing questions regarding scratch disc and Photoshop, yet can't seem to find an answer to my questions. I would greatly appreciate any tips/advice. Here is my setup and situation: I am running an iMac with a 2.16 intel

  • Can't create artricles properly, no thumbnails

    I just taught a DPS class yesterday and 12 different computers were having problems creating folios properly. First, we were having problems adding both horizontal and vertical layouts using the "Add open Indesign documents" feature. If we added the

  • How to load metadata directly into essbase 9.3 ?

    Hi all, When I load metadata directly into essbase with IKM SQL to Hyperion Essbase (METADATA). My metadata is already on Microsoft SQL 2000. After execute an interface that load metadata to essbase and check in the essbase outline , It seem that out

  • Need an USEREXIT before ME21N / ME22N Save happens 46C

    I am on version 46c, and the BADI ME_PROCESS_PO_CUST is not there. Tried enhancement MM06E005 and MM06E004 , but not helpful. If there are some other Userexits which can be used, please let me know. Req: need to modify some data on the line items as

  • SQL Server Reporting Service 2008 R2 - The request failed with HTTP status 401: Unauthorized.

    I got the error "The request failed with HTTP status 401: Unauthorized." when I call the Reporting Service Web Service. The code is very simple: // Initialise the reporting service Web Service this.RSWebService = new ReportingService2010(); // Pass w