corelwing
发贴: 2
|
于 2005-06-02 09:53
请各位帮帮忙! 我采用的开发工具是JBuider2005 update4,JDK1.5.0,服务器是:JBoss4.01,数据库是MySql4.1.11,采用J2EE架构。 我现在已经做好了EJB和action、actionForm,其中EJB和action已经测试成功。现在的问题是在这个JSP页面中写代码时用到的是数组循环显示,在其中我要添加一个链接,用于传递一个参数值到actionForm中,我现在在用的方法在以前bean write显示时用到的方法一样的,在那里是可以的,但在这就不行了。它不能将数据传输到Form,action返回的值为空。怎样解决这个问题?请各位指教!
代码如下:其中findkCategoryAction1的作用是:按actionForm传递过来的参数查找数据库中kCategory参数值相同的记录并将结果返回给Form。
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %> <%@ page contentType="text/html; charset=UTF-8" %> <%@ page import="java.util.Enumeration" %> <%@ page import="java.util.ArrayList" %>
<html> <head> <title>新闻分类</title> <style type="text/css"> <!-- body { background-image: url(images/BG.jpg); } .style1 { font-family: "宋体"; font-size: medium; color: #0000FF; font-style: italic; } --> </style> <script src="bws_chk.js" type="text/javascript"></script> <script src="tv_cnt.js" type="text/javascript"></script> </head>
<body>
<script type="text/javascript"> USEFRAMES = 1; HIGHLIGHT = 1; USETEXTLINKS = 1; //replace 0 with 1 for hyperlinks STARTALLOPEN = 0; //replace 0 with 1 to show the whole tree ICONPATH = 'images/'; //change if the gif's folder is a subfolder, for example: 'images/' foldersTree = gFld("<i>fenlei</i>"); KCategory =insFld(foldersTree,gFld("all")); </script> <% StringBuffer s= new StringBuffer(); s.append("<script type=\"text/javascript\">"); ArrayList rsl=(ArrayList)request.getAttribute("Messages"); for(java.util.Iterator iter=rsl.iterator();iter.hasNext() { String str = (String)iter.next(); s.append("insFld(KCategory,gFld(\""); s.append(str); s.append("\",'\findkCategoryAction1.do?KCategory="); s.append(str); s.append("'));");
} s.append("initializeDocument();</script>"); out.print; %> </body> </html>
其中, s.append("\",'\findkCategoryAction1.do?KCategory="); s.append(str); s.append("'));"); 就是用来链接的。
|