您的位置:程序门 -> java -> web 开发



页面作用问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


页面作用问题
发表于:2007-04-06 21:25:23 楼主

这是处理提交的页面
<%@   page   contenttype= "text/html;   charset=gbk "   %>

<%   request.setcharacterencoding( "gb2312 ");%>
<html>
<head>
<title>
usebean
</title>
</head>
<body   bgcolor= "#ffffff ">
    <jsp:usebean   id= "testbean "   scope= "session "   class= "aa.usebean ">
</jsp:usebean>
<jsp:setproperty   name= "testbean "   property= "* "/>
bookname: <%=testbean.getbookname()   %> <br   />
bookconcern: <%=testbean.getbookconcern()   %> <br   />
bookcompany: <%=testbean.getbookcompany()   %> <br   />
</form>
</body>
</html>
其中的session     我把他改成page   和application也正确的,但是我这个好象只影响到本页面啊。。。。为什么要用session
javabean
package   aa;

public   class   usebean   {
       

        private   string   bookname;
        private   string   bookconcern;
        private   string   bookcompany;
public   void     setbookname(string   bookname){
        this.bookname=bookname;

}
public   void   setbookconcern(string   bookconcern)
{
        this.bookconcern=bookconcern;
}
public   void   setbookcompany(string   bookcompany){
        this.bookcompany=bookcompany;
}
public       string     getbookname(){
        return   bookname;
}
public   string   getbookconcern(){
        return   bookconcern;

}
public   string   getbookcompany(){
        return     bookcompany;

}
}
     

(1)
<%@   page   contenttype= "text/html;   charset=gbk "     language= "java "   %>
<html>
<head>
<title>
test
</title>
</head>
<body   bgcolor= "#ffffff ">
<form   action= "usebean.jsp "   name= "form "   method= "post ">
bookname <input   type= "text "   name= "bookname "> <br/>
bookconcern <input   type= "text "   name= "bookconcern "> <br/>
bookcompany <input   type= "text "   name= "bookcompany "> <br/>
<input   type= "submit "   name= "sumbit "   value= "提交 "/>
</form>
</body>
</html>




快速检索

最新资讯
热门点击