本人新手想做个对话输入提交的网页
javabean类:
package tags;public class SubBean {
private String content = "";
public String getcontent(){
return content;
}
public void setcontent(String content){
this.content = content;
}
}
JSP部分:
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>输入提交</title>
</head>
<body>
<h1>请输入要提交的内容</h1>
<form name="forml"method="post"action="">
<input type="text"name="String">
<input type="submit"name="submit"value="提交">
</form>
<jsp:useBean id="Sub"class="tags.SubBean"/>
<jsp:setProperty name="Sub"property="name"param="name"/>
<P>content:<jsp:getProperty name="Sub"property="name"/></P>
</body>
</html>
不知道哪出错了 望各位路过的大哥大姐指点一二···
javabean类:
package tags;public class SubBean {
private String content = "";
public String getcontent(){
return content;
}
public void setcontent(String content){
this.content = content;
}
}
JSP部分:
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>输入提交</title>
</head>
<body>
<h1>请输入要提交的内容</h1>
<form name="forml"method="post"action="">
<input type="text"name="String">
<input type="submit"name="submit"value="提交">
</form>
<jsp:useBean id="Sub"class="tags.SubBean"/>
<jsp:setProperty name="Sub"property="name"param="name"/>
<P>content:<jsp:getProperty name="Sub"property="name"/></P>
</body>
</html>
不知道哪出错了 望各位路过的大哥大姐指点一二···
解决方案 »
- com.microsoft.sqlserver.jdbc.SQLServerException: 到主机 的 TCP/IP 连接失败。 java.net.Con
- 谁给我一份javamail的例子!
- 紧急求助,谁帮我看看这个程序啊,无法读写数据库
- 高手路过近来看下,100分跪求
- 关于页面显示时间的及时更新!
- 100分相送,求高手解决org.springframework.beans.factory.BeanCreationException
- 一个JSP连接mysql错误!
- 关于helloworld的问题
- 如何在IE中以只读的属性直接打开硬盘中的word,excel文档?
- 另我头疼的老大难:普通汉字和数据库汉字的显示问题?如何解决???大家快来给我个好的解决办法!!!
- 关于urlrewrite 301不带www的跳转到带www的配置
- 乱码问题 在线等
你没有写提交给谁,一般提交给servlet进行处理 servlet要在web.xml中配置
package myBean;public class EmployeeBean {
private int id = 0,salary = 0;
private String name = "none",occupation = "none";
boolean male = true;
public int getId(){
return id;
}
public void setId(int id){
this.id = id;
}
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public boolean isMale(){
return male;
}
public void setMale(boolean male){
this.male = male;
}
public int getSalary(){
return salary;
}
public void setSalary(int salary){
this.salary = salary;
}
public String getOccupation(){
return occupation;
}
public void setOccupation(String occupation){
this.occupation = occupation;
}
}<%@page contentType="text/html;charest=gb2312" %>
<html>
<head>
<title>javaBean</title>
</head>
<body>
<form name="form1"method="post"action="">
<br>name:<input type="text"name="name">
<br>sex:<input type="radio"name="male"value="true">man
<input type="radio"name="male"value="false">woman
<br>id:<input type="text"name="id">
<br>occupation:<input type="text"name="occupation">
<br>salary:<input type="text"name="salary">
<br><input type="submit"name="submit"value="Submit">
</form><jsp:useBean id="employee"class="myBean.EmployeeBean"/>
<jsp:setProperty name="employee"property="name"param="name"/>
<jsp:setProperty name="employee"property="id"param="id"/>
<jsp:setProperty name="employee"property="male"param="male"/>
<jsp:setProperty name="employee"property="salary"param="salary"/>
<jsp:setProperty name="employee"property="occupation"param="occupation"/>
<P>name:<jsp:getProperty name="employee"property="name"/></P>
<p>id:<jsp:getProperty name="employee"property="id"/></p>
<p>isMale:<jsp:getProperty name="employee"property="male"/></p>
<p>salary:<jsp:getProperty name="employee"property="salary"/>yuan</p>
<p>occupation:<jsp:getProperty name="employee"property="occupation"/></p>
</body>
</html>为什么这里可以提交 我的代码就不行呢?
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>输入提交</title>
</head>
<body>
<h1>请输入要提交的内容</h1>
<form name="forml"method="post"action="">
<input type="text"name="String">
<input type="submit"name="submit"value="提交">
</form>
<jsp:useBean id="Sub"class="tags.SubBean"/>
<jsp:setProperty name="Sub"property="content"param="content"/>
<P>content:<jsp:getProperty name="Sub"property="content"/></P>
</body>
</html>