我的意思就是在JSP页面中有个表单,把表单的值传给servlet由servlet完成对数据库的访问,可是现在我要传到servlet的值我想先把他显示出来看看到底传过来没有,可是运行的时候出现了错误,是怎么回事,谢谢回帖!~

解决方案 »

  1.   

    有没有搞错,你得servlet类名都是小写
      

  2.   

    我明白你的意思,是不是不加你写的那几句就没问题啊?
    是不是你tomcat的问题,我没发现代码错误
      

  3.   

    我是初学,对命名的规范还不是很熟,我用的是JB应该不会存在tomcat的问题,不加上我自己加的还是不行啊,其实我的问题就是JSP传值给SERVLET的问题,其中的细节在哪里,也就是关键在哪里是不是还有什么根本的错误我没有找到呢?谢谢大家的回帖!~
      

  4.   

    //out.println(userName);  你这句是怎么回事呢?
    你相当于在<html>标记之前输出userName。
    //out.println(userName);  
      //结素
        out.println("<html>");
        out.println("<head><title>newuser</title></head>");
        out.println("<body bgcolor=\"#ffffff\">");
        out.println("<p>The servlet has received a GET. This is the reply.</p>");
        out.println("</body></html>");
      }
    改一下:  //结素
        out.println("<html>");
        out.println("<head><title>newuser</title></head>");
        out.println("<body bgcolor=\"#ffffff\">");
        out.println("<p>The servlet has received a GET. This is the reply.</p>");
        out.println(userName);  
        out.println("</body></html>");
      }
      

  5.   

    我是想在SERVLET取出值之后输出他打印一下,看是不是把值传过来了,我照你说的做一下,谢谢!~
      

  6.   

    你可以打印,不过用:
    System.out.println(userName);
      

  7.   

    还是不行,我把报错的信息贴出来,我想是不是我的路径有问题?或者是<fotm action = "/newuser" method = "POST">有问题StandardHost[localhost]: MAPPING configuration error for request URI
      

  8.   

    你写成这样试试 action = "<%= request.getContextPath() %>/newuser"
      

  9.   

    JB中XML是自动生成的,应该不会出现什么问题的,我试试liuyb94242的方法吧
      

  10.   

    还是不行,哪位兄弟对jsp和servlet之间的连接问题有好的例子能拿出来给大家看一下吗?我感觉这个问题就是一张薄纸,我,我相信还有很多人,没有捅破
      

  11.   

    servlet 没有doPost方法接收jsp的请求,newuser.java增加doPost
    **.jsp
    <form name="form1" method="post" action="/newuser">或
    <form name="form1" method="post" action="/servlet/newuser">
      

  12.   

    没有找到servlet或jsp
    检查一下你的web.xml
      

  13.   

    我的表单里面有<form name="form1" method="post" action="/newuser">
    我用的是JBX,也存在XML的配置问题吗?XML都是自动升成的啊
      

  14.   

    把doGet改称doPost()就好了,或者干脆service(),就可以了。