嗨,我需要将参数从搜索容器列文本中的一个 jsp 传递到另一个 jsp。我已经显示了结果,并且我在列的最后添加了超链接,当它单击它将打开 edit.jsp 页面时,我需要将 courseid 从 result.jsp 传递给该 edit.jsp。谁能告诉我解决方案?
编辑.jsp
<%
PortletURL editCourseURL=renderResponse.createActionURL();
editCourseURL.setParameter(ActionRequest.ACTION_NAME,"editCourse");
%>
<%
String ns =renderRequest.getParameter("courseId");
System.out.println("hai hello "+ns);
//long n= Long.parseLong(ns);
System.out.println("hello world");
Course courses =CourseLocalServiceUtil.getCourse(3);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//sdf = new SimpleDateFormat("yyyy-MM-dd");
String sdate = sdf.format(courses.getSdate());
String edate = sdf.format(courses.getEdate());
String cname=courses.getCname();
String cdesc=courses.getCdesc();
System.out.println(sdate);
%>
<form action="<%=editCourseURL%>" method="post" id="register-form" >
<div class="label1">Course Name</div>
<input type="text" id="cname" name="cname" value="<%=cname%>"/><br />
<div class="label2">Course Description</div>
<input type="text" id="cdesc" name="cdesc" value="<%=cdesc%>"/><br/>
<div class="label3">Start Date</div>
<input type="date" name="sdate" id="sdate" value="<%=sdate%>"/><br/>
<div class="label4">End Date</div>
<input type="date" id="edate" name="edate" value="<%=edate%>" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
<portlet:renderURL var="homeURL">
<portlet:param name="jspPage" value="/html/course/view.jsp"></portlet:param>
</portlet:renderURL>
<a href="<%=homeURL%>"> --HOME--</a>
结果.jsp:
<%
int n=CourseLocalServiceUtil.getCoursesCount();
List courses = CourseLocalServiceUtil.getCourses(0,n);
if(Validator.isNull(courses))courses = new ArrayList();
%>
<portlet:renderURL var="edit">
<portlet:param name="jspPage" value="/html/course/edit.jsp"></portlet:param>
</portlet:renderURL>
<portlet:renderURL var="delete">
<portlet:param name="jspPage" value="/html/course/delete.jsp"></portlet:param>
</portlet:renderURL>
<liferay-ui:search-container delta="10" emptyResultsMessage="no-courses-were-found" >
<liferay-ui:search-container-results results="<%=courses%>" total="<%=courses.size()%>" />
<liferay-ui:search-container-row className="com.course.slayer.model.Course" modelVar="course" >
<liferay-ui:search-container-column-text name="Course Name" property="cname" />
<liferay-ui:search-container-column-text name="Course Description" property="cdesc" />
<liferay-ui:search-container-column-text name="Start Date" property="sdate" />
<liferay-ui:search-container-column-text name="End Date" property="edate" />
<liferay-ui:search-container-column-text name="Edit" href="<%=edit%>" value="edit">
</liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="Delete" href="<%=delete%>" value="delete" />
</liferay-ui:search-container-row >
<liferay-ui:search-iterator />
</liferay-ui:search-container >
结果.jsp: