初学JSP,小地方不懂 将ID为“cart”的BEAN的各属性附值,值为请求表单的各对应值。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 赋值是怎么进行的,property="*" 代表赋值过程吗? property="*" 代表将请求表单中对应的值赋到BEAN的各属性中。如:提交的表单中有一名为“id”的字段,则会将其值赋给BEAN中对应的属性“id”。 下面这段代码是怎么工作的呢,搞不清楚啊<%@ page contentType="text/html; charset=GBK" %><html><head><title>index</title></head><jsp:useBean id="indexBeanId" scope="session" class="textdatafile.indexBean" /><jsp:setProperty name="indexBeanId" property="*" /><body><h1>JBuilder Generated JSP</h1><form method="post"><br>Enter new value : <input name="sample"><br><br><br><input type="submit" name="Submit" value="Submit"><input type="reset" value="Reset"><br>Value of Bean property is :<jsp:getProperty name="indexBeanId" property="sample"/></form></body></html>package textdatafile;public class indexBean { private String sample00= "Start value"; //Access sample property public String getSample() { return sample00; } //Access sample property public void setSample(String newValue) { if (newValue!=null) { sample00 = newValue; } }} 此处jsp:setProperty name="indexBeanId" property="*" 作用相当于类indexBean 调用setSample()给sample00 赋值,然后用jsp:getProperty name="indexBeanId" property="sample"将sample00的值取出 可是,jsp:getProperty name="indexBeanId" property="sample" 是怎么识别sample00的值的呢? 明明property="sample" 新手jsp 登录记住密码功能实例 struts页面跳转问题 hibernate 特别慢 MS2000使用MVC模式如何制作报表,Excel或XML导出 [servlet]怎么利用byte[]显示图片? 一个令人困惑的问题(关于连接池) 急寻!!!!!!!!!!!!! ICE3.5版本使用出现问题。 日期查询问题.在线等~! Applet和CGI的系统可以用JSP+Servlet来取代么? 为什么我向sql server数据库image字段写入的图片读不出来?应该显示图片的地方出现了一个“叉”,请问这是什么问题? 大伙有谁这样(xml->html->excel)做过excel报表的进来一下
提交的表单中有一名为“id”的字段,则会将其值赋给BEAN中对应的属性“id”。
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title>
index
</title>
</head>
<jsp:useBean id="indexBeanId" scope="session" class="textdatafile.indexBean" />
<jsp:setProperty name="indexBeanId" property="*" />
<body>
<h1>
JBuilder Generated JSP
</h1>
<form method="post">
<br>Enter new value : <input name="sample"><br>
<br><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset">
<br>
Value of Bean property is :<jsp:getProperty name="indexBeanId" property="sample"/>
</form>
</body>
</html>
package textdatafile;public class indexBean {
private String sample00= "Start value";
//Access sample property
public String getSample() {
return sample00;
}
//Access sample property
public void setSample(String newValue) {
if (newValue!=null) {
sample00 = newValue;
}
}
}
类indexBean 调用setSample()给sample00 赋值,
然后用jsp:getProperty name="indexBeanId" property="sample"将sample00的值取出