写一个方法,把path="/jsp2.jsp"/里面内容换成参数不可以吗?
解决方案 »
- log4j乱码问题(xml配置)
- 关于如果表存在则不删除,如果表在则删除,表问下怎么写?
- MINA怎么传输一个byte数组
- SQL2000与EJB之间的数据类型问题?
- 类似二叉树结构的算法
- 不改页面的源码是不是不能让指定字符高亮
- HELP!求助!这个错误怎么解决呀!Init Error: javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLIni
- hibernate的O/R映射文件中的<param/>是啥玩意?
- weblogic 6.1 和 7.0区别大吗?
- 我在JBUILDER里连接不上MSDE数据库,帮我看看啊,该怎么解决啊?
- 考研,你选择哪个方向??
- 老是出现这些问题,咨询一下各位!!
那怎么给参数赋值呢?
<forward name="play2" path="/jsp2.jsp"/>
<forward name="play1" path="/jsp1.jsp"/>
</global-forwards>其中Action:
package wjhstruts;
import org.apache.struts.action.*;
import javax.servlet.http.*;public class wjhAction extends Action {
public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
wjhActionForm wjhActionForm = (wjhActionForm) actionForm;
if(request.getParameter("a1")!=null&&"打开页面1".equals((String)request.getParameter("a1"))) {
return (actionMapping.findForward("play1"));
}
if(request.getParameter("a2")!=null&&"打开页面2".equals((String)request.getParameter("a2"))) {
return (actionMapping.findForward("play2"));
}
}
request.getParameter("a1")!=null&&"打开页面1".equals((String)request.getParameter("a1"))) 是什么意思,运行错误哦!请指正。
在下面中:
if(request.getParameter("a1")!=null&&"打开页面1".equals((String)request.getParameter("a1"))) {
return (actionMapping.findForward("play1"));
}
request.getParameter("a1")可能是乱码。如果把“打开页面1”等于"open1"就可以。如何转换中文?