一个最简单的JSP usebean的例子,调试有错误,大家帮忙看看啊!

chaney chaney 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
有一个文件,java的编译成class。调试总是报错,麻烦各位看看。
usebean.htm
<form method="post" action="usebean.jsp">
<input type="text" name="name">

<select name="sex">
<option value="先生">先生</option>
<option value="小姐">小姐</option>
</select>

<input type="submit" name="submit" value="提交">
</form>

usebean.jsp
<%@page language="java" import="HelloBean;" %>

<jsp:useBean id="Hello" class="HelloBean" scope="request" >
<jsp:setProperty name="Hello" property="*" />
</jsp:useBean>

<html>
< %=Hello.getName()% >

< %=Hello.getSex()% >
</html>

HelloBean.java

public class HelloBean{
private String name="";
private String sex="";
public HelloBean(){
}
public void setName(String name){
this.name = name;
}
public String getName(){
return this.name;
}
public void setSex(String sex){
this.sex = sex;
}
public String getSex(){
return this.sex;
}
}
...全文
评论 22
收藏 已收藏
分享
返回顶部
chaney
Web 开发 81,108 成员 341,721 内容