lundi 3 août 2015

Sumbit Button showing as Textbox in a Servlet Java EE

I have a problem in a simple Servlet, I'm using the response.setContentType("text/html"); to use html content, everything is good except a Submit button showing as a Textbox, I had this problem too when I was using a simple html file instead of a Servlet, I changed the html file type to HTML4 instead of HTML5 and it solved the problem, but now on the Servlet I can't do that, and I want your help about the problem that I faced when using a HTML5 file too.

Here is the code :

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<HTML><BODY>");

        String identifiant = request.getParameter("identifiant");
        int id = Integer.parseInt(identifiant);

        for ( Film x : Stock.FilmList ) {
            if (x.getIdentifiant() == id) {
                out.println("Title is : "+x.getTitle()+"<BR/>");
                out.println("Nb Ex is : "+x.getNbEx()+"<BR/>");
                out.println("Autor is : "+x.getAutorPrincipal().getFirstName()+" "+x.getAutorPrincipal().getLastName()+"<BR/>");
                out.println("Genre is : "+x.getGenre());
                out.println("<form action=\"addtocart\" method=\"GET\">");
                out.println("<input type=\"text\" name=\"quantity\"/>");
                out.println("<input type=\"hidden\" name=\"idFilm\" value=\""+x.getIdentifiant()+"\"/>");
                out.println("<input type=\"sumbit\" value=\"Add\"/>");
                out.println("</form>");
            }
        }

        out.println("</BODY></HTML>");
    }

And here an image of the result, showing the Submit button as a Textbox.. http://ift.tt/1SX2PdK

Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire