Results 1 to 2 of 2
  1. #1
    meathook is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default Problems with servlet

    Hello everyone,

    I am having problem with the java servlets

    When i send things from the form, to the servlet just shows a white page.

    The codes

    Servlet - [Java] /* * To change this template, choose Tools | Templates * and open the templa - Pastebin.com
    View - [Java] index - Pastebin.com
    The class Aluno - [Java] /* * To change this template, choose Tools | Templates * and open the templa - Pastebin.com

    I want to pass the "idadeAluno" in the condition and print on the page.

    meathook~

  2. #2
    go4soumya is offline Member
    Join Date
    Oct 2010
    Posts
    32
    Rep Power
    0

    Default

    hi meathook,

    I read your codes and found that you wrote:

    Java Code:
    if(idadeAluno > 18)
            {
                System.out.println("Maior");
            }
            else
            {
                System.out.println("Menor");
            }
    well, System.out.println prints the value in the console and not on the page. To print on the page, write in the processRequest() method of your servlet:

    Java Code:
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    and use
    Java Code:
    out.println
    instead of System.out.println

    Try this,
    Good luck

Similar Threads

  1. Replies: 2
    Last Post: 10-28-2010, 04:55 PM
  2. Replies: 1
    Last Post: 12-02-2008, 01:23 AM
  3. Replies: 0
    Last Post: 08-30-2008, 12:52 PM
  4. Replies: 1
    Last Post: 08-07-2007, 04:47 PM
  5. problems when loading an image in servlet
    By oregon in forum Java Servlet
    Replies: 1
    Last Post: 08-05-2007, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •