java - 获取搜索容器列的主键

标签 java liferay portlet

这是我的搜索容器代码,我正在尝试为我的留言簿 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/

相关文章:

java - 将自定义翻译字符串添加到 liferay 主题

websphere - 是否可以在 Websphere Portal 上调试 portlet?

javascript - Liferay 7 CE - Osgi 模块(liferay mvc portlet)不加载 javascript 文件

Liferay 6.1 portlet 在 5.2.3 中工作不正确

java - Vector<> 类的 toArray() 方法

java - 将entrySet流式传输到groupingBy而不是keySet

java - 一种计算二叉搜索树中具有 2 个子节点的节点数的方法

java - fragment 和文本转语音以及幻灯片菜单

eclipse - 在 Eclipse 中启动服务器后找不到 Liferay 主页

java - Liferay Asset - 如何在不更改创建日期的情况下更新liferay asset?