Struts2 页面往action中传值乱码 问题,页面alert不乱码,传到action中就乱码。后来将值传入model中,不乱码

土耳其的猫 土耳其的猫 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
修改前:
url : "spinglunAdd.action?content= newcontent)+ "&itemid=" + itemid
+ "&receiveuserid="+receiveuserid+"&itemtype=question&path=<%=basePath%>",


public class QuestionentityManagerAction extends ActionSupport implements ServletRequestAware{
private Spinglun spinglun=new Spinglun();
spinglun.setItemid(itemid);

spinglun.setReceiveuserid(receiveuserid);
spinglun.setCreatetime(new Date().getTime()+"");
spinglun.setItemtype(itemtype);
spinglun.setContent(content);
public Spinglun getSpinglun() {
return spinglun;
}
public void setSpinglun(Spinglun spinglun) {
this.spinglun = spinglun;
}
}
修改后:
url : "spinglunAdd.action?spinglun.content= encodeURI(newcontent) + "&spinglun.itemid=" + itemid
+ "&spinglun.receiveuserid="+receiveuserid+"&spinglun.itemtype=question&path=<%=basePath%>",


public class QuestionentityManagerAction extends ActionSupport implements ServletRequestAware{
private Spinglun spinglun=new Spinglun();
public Spinglun getSpinglun() {
return spinglun;
}
public void setSpinglun(Spinglun spinglun) {
this.spinglun = spinglun;
}
}
为啥放到对象中就不乱吗了?????如果按修改前的方式传值,是不是需要配置过滤器,在web.xml中
...全文
评论 3
收藏 已收藏
分享
返回顶部
土耳其的猫
JavaScript 87,983 成员 224,681 内容