jsp中使用javabean

来源:互联网 发布:js两个数相加 编辑:程序博客网 时间:2024/04/30 10:05

HelloWorld.java

 

public class HelloWorld{private String name="hello";public String getName(){     return name;}public void setName(String name){     this.name = name;}}


hiBean.jsp

<html><head><title>JavaBeantest </title></head><body><jsp:useBean id="helloBean" scope="session" class="hello.HelloWorld"/><%= helloBean.getName() %> <%helloBean.setName("check"); %><%= helloBean.getName() %></body></html>


 

原创粉丝点击