类似这样的调用<a href="/test.action?id=1">test</a>
在action类中用request.getParameter("id")为何得不到参数值?
action类中已经implements ServletRequestAware谢谢。
在action类中用request.getParameter("id")为何得不到参数值?
action类中已经implements ServletRequestAware谢谢。
解决方案 »
- JDBC时出错,菜鸟求帮忙
- Java的Servlet过滤器在容器中运行时是单例的还是多例的?
- 谁有je-analysis-1.4.0.jar包?谢谢
- hibernate的HQL里面的like查询的问题
- J2EE新人的困惑,求前辈们指点!!拜托了!!
- 实现一个字符串的简单加密及解密,只要简单到“加密后看不出原来的意思”就可以了,如何实现?
- 怎样从数据库中取数据显示在下拉列表框里jsp的
- 关于servlet中获取ip问题
- springMVC+spring3.2+hibernate3.3
- !!!!!急!!一位在校的计算机专业的mm想请问各位大侠:如何用jsp对文本文件进行修改
- struts1是单线程还是多线程?struts2是单线程还是多线程?
- lucene关键词高亮显示
LoginForm loginForm = (LoginForm) form;// TODO Auto-generated method stub
// String id = loginForm.getPassword();
String id = "123";
IBcGoodsService service = (IBcGoodsService) getBean("BcGoodsService");
BcGoods bcGoodsFormDB = service.getBcGoodsByid(Long.valueOf(id)); List<BcGoods> list = service.findAll();
// System.out.println(bcGoodsFormDB.getImg());
// for (BcGoods goods : list) {
// System.out.println(goods.getName());
// }
// if (bcGoodsFormDB.getName().equals(BcGoodsname)) {
request.setAttribute("bcGoodsFormDBImg", bcGoodsFormDB.getImg());
request.setAttribute("bcGoodsFormDB", list); return mapping.findForward("success");
// }
// return mapping.findForward("false");
}
}lz继承的action不了解 ,附上代码共参考 关注
mapping.findForward("id");
用 <a href="<s:url action="mselectdownload"><s:param name="tag" value="m"/></s:url>">信息发布</a>
这种形式看看
我用的是Struts2,你的是Struts1中的。
我的类是这样
...extends ActionSupport implements ServletRequestAware { ...method() {
String id = request.getParameter("id"); //null值,为什么?
}}
return this.id;
} public void setId(int id){
this.id = id;
} public String execute() throws Exception{
return SUCCESS;
}}接收页面直接用${id}即可获取
在JDeveloper中,死活得不到传过来的参数值。
同样的代码,拷到Eclipse中运行,就能得到。
可能是oc4j服务器的问题,也可能是Jdeveloper的版本号低(10.1.3.1)与运行环境不兼容导致。感谢。
<s:param name="id">1</s:param>
</url>
要这么传!~