关于jsp的请求的传送?
xie20 2005-04-14 06:34:29 //textA.jsp
<%@ page errorPage="textA_error.jsp" %>
<html>
<head>
<title>示例</title>
</head>
<body scroll=no>
<form name="frma" method="post" action="textB.jsp" >
<p>
你的姓名:
<input type="text" size="15" name="yourName" value="" >
<input type="button" name="subBtn" value="[提交]" onClick="f_check()" >
</p>
</form>
</body>
</html>
<script language="JavaScript" type="text/javascript">
<!--
function f_check(){
if(document.forms(0).yourName.value==""){
alert("请输入姓名");
}else{
document.forms(0).submit();
}
}
-->
</SCRIPT>
//textB.jsp
<%@ page contentType="text/html; charset=GBK" %>
<%@ page errorPage="textB_error.jsp" %>
<html>
<head>
<title>示例</title>
</head>
<jsp:useBean id="tBean" scope="page" class="bean.TextBean" >
<jsp:setProperty name="tBean" property="*" />
</jsp:useBean>
<body scroll=no>
<form name="frmb" method="post" action="" >
<p>
<%=tBean.getyourName()%>
</p>
</form>
</body>
</html>
package bean;
public class TextBean {
private String yourName = "";
public TextBean() {
}
public void setyourName(String yourName){
this.yourName = yourName;}
public String getyourName(){
return this.yourName ;}}
还有一个TextBean没有写。texta传到textb的参数可以理解。
问题就是textb中并没有使用setyourName(),怎么用getyourName(),就得到在texta中输入的值?