在jsp中直接给bean赋值

来源:互联网 发布:virtualbox安装mac os 编辑:程序博客网 时间:2024/05/16 16:23

jsp:useBean就是一个action

package com.jsptutorial;public class Message {private String text;public String getText() {return text;}public void setText(String text) {this.text = text;}}

<html><head><title>jsp:useBean Demo</title></head><body><jsp:useBean id="msg" class="com.jsptutorial.Message" /><jsp:setProperty name="msg" property="text" value="JSP useBean Demo" /><h1><jsp:getProperty name="msg" property="text" /></h1></body></html>

原文:http://www.zentut.com/jsp-tutorial/jsp-standard-actions/

一个更像Java的方法:http://188029.net/java/j12-03-09.html

原创粉丝点击