我倾向于使用jsp set并使用java bean获取action标记并获取错误。任何解决方案请..
这是我的索引表格。
form action="setAndGet_process.jsp" method="post">
Name:<input type="text" name="name"><br>
Password:<input type="password" name="password"><br>
Email:<input type="text" name="email"><br>
<input type="submit" value="Register">
</form>
Jsp进程代码处理输入
<jsp:useBean id="u" class="jsp.SetAndGetUser"></jsp:useBean>
<jsp:setProperty property="*" name="u" />
Records:
<br>
<jsp:getProperty property="name" name="u" /><br>
<jsp:getProperty property="password" name="u" /><br>
<jsp:getProperty property="email" name="u" /><br>
和java最后一个是setter和getter的java用户bean
package jsp;
public class SetAndGetUser {
private String name, password, email;
}
答案 0 :(得分:0)
将此添加到您的班级“SetAndGetUser”
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}