System.out.println(fristname+lastname);
改为out.println(fristname+lastname);

解决方案 »

  1.   

    System.out.println(fristname+lastname);输出信息到控制台。
    out.println(fristname+lastname);才会写在页面上
      

  2.   

    改为以下代码试试
    <html>
    <head>
    <title>
    你好!
    </title>
    <metahttp-equiv="Content-Type" content="text/html";charset="gb2312">
    </head>
    <body bgcolor="#FFFFFF">
    <form method="post" action="/firstjsp.jsp">
    <p>firstname:
    </p>
    <p>
    <input type="text" name="firstname">
    </p>
    <p>lastname:
    </p>
    <input type="text" name="lastname">
    </p>
    <p>
    <input type="submit" name="submit" value="提交">
    </p>
    </form>
    </body>
    </html>
    这是firstjsp.jsp
    <!--firstjsp.jsp--->
    <%@page contentType="text/html";charset="gb2312"%>
    <html><body>
    欢迎
    <%!String firetname,lastname,s;%>
    <%
    firstname=request.getParameter("fristname");
    lastname=request.getParameter("lastname");
    %>
    <b><i><font size="7" face="Arial Black"><p>
    <%
    firstname=new String(firstname.getBytes("ISO-8859-1");
    lastname=new String(lastname.getBytes("ISO-8859-1");
    %>
    <%= firstname%><%=lastname%>
    </p></font></i></b>
    光临!
    </body>
    </html>
      

  3.   

    <p>
    <input type="text" name="firstname"> //
    </p>----------
    firstname=request.getParameter("fristname");在html中是firstname 到了后面怎么是fristname呢?
      

  4.   

    是不是两个参数firstname和lastname没有从表单提交中得到啊
      

  5.   

    如果是null就是没接受到参数。看看表单吧
    我是椰子,不会说谎的椰子。jsp不精,java不精,就是有点神经。:)
      

  6.   

    如果是null就是没接受到参数。看看表单吧
    我是椰子,不会说谎的椰子。jsp不精,java不精,就是有点神经。:)
      

  7.   

    firstname=new String(firstname.getBytes("ISO-8859-1");
    lastname=new String(lastname.getBytes("ISO-8859-1");
    这样做也不会报错??奇怪??分明少了一个)!
      

  8.   

    to: upc_chenli(chenli)的确,但是lastname也应该有值的,就算firstname没有的话
      

  9.   

    firstjsp.jsp是在当前目录下吧??
    那么你的form中的action应该是:action="firstjsp.jsp"!!
      

  10.   

    fristname拼写错误。应为firstname
      

  11.   

    你的Form的Action属性设置正确吗?页面上显示了“光临!”字样吗?
      

  12.   

    firstname=request.getParameter("fristname");里面有拼写错误,和提交页面的变量名不同,当然取不到值。
      

  13.   

    我又重装了tomcat4.0.4他的classpath是自己设置的,当我再运行这个程序时连欢迎都没了,只返回“光临!”字样。是我文件放的地方不对吗?请问jsp文件应该放在哪里啊?另外上面说的拼写错误我改正过来了,可还是不行啊?为什么?该如何解决啊?耽误大家时间了,谢谢大家!
      

  14.   

    还有就是我的hello world程序无论是放到apache tomcat4.0/webapps/examples/jsp/下,还是apache tomcat4.0/webapps/root下都不能正常显示.在apache tomcat4.0/webapps/examples/jsp/下的时候当我打开http://localhost:8080/examples/jsp/HelloWorld.jsp后返回的是:Apache Tomcat/4.0.4 - HTTP Status 404 - /jsp/HelloWorld.jsp--------------------------------------------------------------------------------type Status reportmessage /jsp/HelloWorld.jspdescription The requested resource (/jsp/HelloWorld.jsp) is not available.
    请问这是为什么?
      

  15.   

    呵呵,解决了,谢谢大家.原来是我的tomcat设置有问题.