struts2的action怎么取js上填写的值?
js上有代码:<s:formname="myform"action="login"method="post"theme="simple">帐号<s:textfieldna...
js上有代码:
<s:form name="myform" action="login" method="post" theme="simple">
帐号<s:textfield name="FacelookUser.fuUserUsername" lable="帐号" /><br/>
密码<s:textfield name="FacelookUser.fuUserPassword" lable="密码" /><br/>
<s:submit value="submit"></s:submit>
</s:form>
action上有:
private FacelookUser facelookUser;
public FacelookUser getFacelookUser() {
return facelookUser;
}
public void setFacelookUser(FacelookUser facelookUser) {
this.facelookUser = facelookUser;
}
要取到facelookUser值,怎么操作?
public String execute() throws Exception {
// TODO Auto-generated method stub
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
FacelookUserService fus = (FacelookUserService)ac.getBean("facelookUserServiceImpl");
//...FacelookUser entity;这个entity怎么从js上取过来???
Boolean res = fus.login(fus.login(entity));
FacelookUser fu = this.getFacelookUser();
if(res==true){
return SUCCESS;
}else{
return "false";
}
} 展开
<s:form name="myform" action="login" method="post" theme="simple">
帐号<s:textfield name="FacelookUser.fuUserUsername" lable="帐号" /><br/>
密码<s:textfield name="FacelookUser.fuUserPassword" lable="密码" /><br/>
<s:submit value="submit"></s:submit>
</s:form>
action上有:
private FacelookUser facelookUser;
public FacelookUser getFacelookUser() {
return facelookUser;
}
public void setFacelookUser(FacelookUser facelookUser) {
this.facelookUser = facelookUser;
}
要取到facelookUser值,怎么操作?
public String execute() throws Exception {
// TODO Auto-generated method stub
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
FacelookUserService fus = (FacelookUserService)ac.getBean("facelookUserServiceImpl");
//...FacelookUser entity;这个entity怎么从js上取过来???
Boolean res = fus.login(fus.login(entity));
FacelookUser fu = this.getFacelookUser();
if(res==true){
return SUCCESS;
}else{
return "false";
}
} 展开
4个回答
展开全部
帐号<s:textfield name="facelookUser.fuUserUsername" lable="帐号" /><br/>
密码<s:textfield name="facelookUser.fuUserPassword" lable="密码" /><br/>
Struts会自动实例化、装配
密码<s:textfield name="facelookUser.fuUserPassword" lable="密码" /><br/>
Struts会自动实例化、装配
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
facelookUser.getfuUserUsername();
facelookUser.fuUserPassword();
facelookUser.fuUserPassword();
追问
我要的是由帐号 密码 组成的FacelookUser entity;
追答
private FacelookUser entity = new FacelookUser();
再生成get,set方法。不就直接能用了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你总要在action里实例化一下这个类,.getFacelookUser就好了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询