<%! String str1,str;%>这里是干什么?那个感叹号有什么用??

解决方案 »

  1.   

    jsp文件可以放在root下,java文件放在root\web_inf\classes下然后编译
      

  2.   

    <%! String str1,str;%>
    用来定义变量的,你的问题不是一个问题,一两句话说不清,最好自己到网上查查肯定有答案
      

  3.   

    <%! String str1,str;%>
    这是声名变量,大侠们,其他地方没错,
    就是我导入bean 跟applet 的时候出错的!!!!
    你们看来也是
      

  4.   

    虽然可能跟结果没有关系,但是你的str1为什么定义了两次?
      

  5.   

    <jsp:useBean id="hw" scope="request" class="hello.hello"></jsp:useBean>
    <font color="#FF3366"><%=hw.getString()%></font>
    <br>
    <%hw.setString="hello word !!!"%>//这句问题???
    <br>
    <font color="#CC9966">你hao ma 吗?<%=hw.getString()%></font>
    <applet code="helloworld.class" width="156" height="80"></applet>
    真的这个applet就不可以用吗?
    这段代码有问题,去掉之后就可以正常了。贴出你的bean代码
      

  6.   

    我的bean 代码已经编译成功了,啊!
     我想是跟我的路径有映射有关系,一直提示我的文件不存在,
    我的bean是这样的,很简单的。
    我的bean是这样:
    package hello;
    public class hello
    {
     String s;
      public hello()
      {  this.s="hello world!";
       }
     public void setString(String mystring)
      {
       this.s=mystring;
       }
    public String getString()
      {
       return(this.s);  }
    }
      

  7.   

    <jsp:useBean id="hw" scope="request" class="hello.hello"></jsp:useBean>
    <font color="#FF3366"><%=hw.getString()%></font>
    <br>
    <%hw.setString("hello word !!!");%>//原来的代码<%hw.setString="hello word !!!"%>
    <br>
    <font color="#CC9966">你hao ma 吗?<%=hw.getString()%></font><applet code=".\WEB-INF\classes\hello\hello.class" width="156" height="80"></applet>//要指定倒入类的路径
    以上是修改后的代码。此外,applet和bean是不一样的,所以页面执行的结果是applet什么都没有