早教吧作业答案频道 -->其他-->
struts标签获得不了jsp页面的值(username,password打印出来都是null)LoginAction类:packagecom.actions;importcom.opensymphony.xwork2.ActionSupport;publicclassLoginActionextendsActionSupport{Stringusername;Stringpassword;publ
题目详情
struts标签获得不了jsp页面的值(username,password打印出来都是null)
LoginAction类:
package com.actions;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport{
String username;
String password;
public String getUsername(){
return username;
}
public void setUsername(){
this.username = username;
}
public String getPassword(){
System.out.print(password);
return password;
}
public void setPassword(){
this.password = password;
}
public String execute() throws Exception{
System.out.print("xax" + getUsername() + " "+getPassword());
return SUCCESS;
}
}
JSP:
Login
//中间一堆meta啥的去掉的,空间不够
还未注册?点击注册
web.xml:
login.jsp
struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
struts2
/*
struts.xml
/login_success.jsp
LoginAction类:
package com.actions;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport{
String username;
String password;
public String getUsername(){
return username;
}
public void setUsername(){
this.username = username;
}
public String getPassword(){
System.out.print(password);
return password;
}
public void setPassword(){
this.password = password;
}
public String execute() throws Exception{
System.out.print("xax" + getUsername() + " "+getPassword());
return SUCCESS;
}
}
JSP:
Login
//中间一堆meta啥的去掉的,空间不够
还未注册?点击注册
web.xml:
login.jsp
struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
struts2
/*
struts.xml
/login_success.jsp
▼优质解答
答案和解析
我试过你的代码,发现错误在于你的LoginAction代码,这两个set方法没写对,应该有参数的,否则没法赋值的.public void setUsername(String username){this.username = username;}public void setPassword(String passwor...
看了struts标签获得不了jsp...的网友还看了以下:
请高手帮我看段MATLAB的程序,有几个地方不懂意思,最好能帮我每句都写个注释.此程序是huffm 2020-05-13 …
按顺序.1氢(qīng)氦(hài)锂(lǐ)铍(pí)硼(péng)2碳(tàn)氮(dàn)氧 2020-05-13 …
设A为n阶矩阵,证明:R(A+I)+R(A-I)>=n已知R(A)=R(kA),k≠0;R(A+B 2020-05-14 …
about chinese,help meIn "nǐ zài nǎ lǐ gōng zuò?" 2020-05-14 …
Who Am I 短文翻译So I looked like a fish.Then my tail 2020-05-16 …
用这些英文字母拼词这些英文字母打乱了顺序.一个题目一个词.第一题:r,c,t,a,e,s,r第二题 2020-05-16 …
怎样分清楚I和l(尤其在书上)我发现i的大写I和L的小写l好难分辨,尤其是在书上看.有什么好方法好 2020-05-16 …
累累(léiléi)的果实还是累累(lěIlěi)的果实 2020-05-16 …
求最后一个字读léi的日本姓氏léi,最好是两个字惹! 2020-05-17 …
新目标八年级上册英语书第十二页SELF CHECK的2作文怎么写,要求:weii,I hopeyo 2020-05-17 …