我设法让 jquery portlet 在我的带有 java 后端的 JSP 上工作,使用这个例子作为起点:http: //jqueryui.com/demos/sortable/#portlets
对于每个 portlet,我需要在 portlet 标题上添加一个附加图标,具体取决于用户是否具有该 portlet 的权限。所以它就像
$(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
.find(".portlet-header")
.addClass("ui-widget-header ui-corner-all")
.prepend('<span class="ui-icon ui-icon-plusthick"></span>')
/* if user has permission for this portlet */
.prepend('<span class="ui-icon ui-icon-pencil"></span>')
.end()
.find(".portlet-content");
$(".portlet-header .ui-icon-pencil").click(function() {
alert($(this).parents('.portlet').attr('id'))
/* go to a specific page for this portlet */
});
我的问题有点基本 - 每个 portlet 将该信息传递给 jquery 的最佳方式是什么?传递参数?(如果是这样,如何?)隐藏的div?我使用 jquery 的时间还不够长,无法知道最好的方法。