这是我的搜索容器代码,我正在尝试为我的留言簿 portlet 集成更新和删除方法。我必须获得主键才能做到这一点。这就是我到目前为止所得到的
<liferay-ui:search-container>
<liferay-ui:search-container-results
results="<%=EntryLocalServiceUtil.getEntries(scopeGroupId,
guestbookId, searchContainer.getStart(),
searchContainer.getEnd())%>" />
<liferay-ui:search-container-row
className="com.liferay.docs.guestbook.model.Entry" modelVar="entry">
<portlet:renderURL var="updateEntryURL">
<portlet:param name="mvcPath" value="/html/guestbook/update_entry.jsp"/>
<portlet:param name="entryId" value="entryId"/>
</portlet:renderURL>
<liferay-ui:search-container-column-text property="message" />
<liferay-ui:search-container-column-text property="name" />
<liferay-ui:search-container-column-text name="Edit" href="#" value="EDIT">
</liferay-ui:search-container-column-text>
<liferay-ui:search-container-column-text name="Delete" href="#" value="DELETE">
</liferay-ui:search-container-column-text>
</liferay-ui:search-container-row>
<liferay-ui:search-iterator />
我正在努力完成这一部分
<portlet:renderURL var="updateEntryURL">
<portlet:param name="mvcPath" value="/html/guestbook/update_entry.jsp"/>
<portlet:param name="entryId" value="entryId"/>
</portlet:renderURL>
但我目前不知道如何获取条目 ID。我对这个框架非常陌生。
谢谢!
最佳答案
线路
<liferay-ui:search-container-row
className="com.liferay.docs.guestbook.model.Entry" modelVar="entry">
掌握着你答案的关键:modelVar="entry"
.
在该标签的范围内,您可以执行,例如 <%=entry.getId()%>
(或使用此表达式的 EL 版本)。您基本上有一个名为 entry
的变量范围内可用
关于java - 获取搜索容器列的主键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31869356/