如果portlet是一个Web应用程序,那么为什么从ServletRequest获取portlet首选项(在请求范围内)?
如何在应用程序范围内获取首选项对象?
更新1
我通过以下方式获取portlet首选项.这是对的吗?下面的prefs成员是在应用程序范围内.
private synchronized void setupPreferences(HttpServletRequest request) {
// creating preferences
if( prefs == null ) {
prefs = PortalUtil.getPreferences(request);
if( prefs != null ) {
System.out.println("Preferences were taken from request");
}
String portletResource = ParamUtil.getString(request, "portletResource");
if (Validator.isNotNull(portletResource)) {
try {
System.out.println("Replacing preferences from 'portletRecource' parameter");
prefs = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
} catch (SystemException e) {
e.printStackTrace();
} catch (PortalException e) {
e.printStackTrace();
}
}
if( prefs == null ) {
System.out.println("Preferences were NOT obtained yet"); …Run Code Online (Sandbox Code Playgroud) 我想在验证表单时添加确认消息和重定向到我的jsp.
我在liferay的源代码中看到了这个
SessionMessages.add(actionRequest, config.getPortletName() + ".doConfigure");
Run Code Online (Sandbox Code Playgroud)
这会显示绿色样式的消息Param has been saved successfully.但是不起作用.它显然使用配置菜单(打开一个弹出窗口),我使用首选项菜单,我仍然可以调整这行代码吗?
当我更改首选项时,我想在我的portlet中进行重定向,但是现在,它仍然在首选项页面上,我必须单击Return to full page.
此外,如果未验证首选项,是否可以显示错误消息?
问候.谢谢
什么是关系和区别ActionRequest,RenderRequest和PortletRequest?
我们可以从另一个获得一个实例吗?
Map countryList = new HashMap();
String str = "http://10.10.10.25/TEPortalIntegration/CustomerPortalAppIntegrationService.svc/PaymentSchedule/PEPL/Unit336";
try {
URL url = new URL(str);
URLConnection urlc = url.openConnection();
BufferedReader bfr = new BufferedReader(new InputStreamReader(
urlc.getInputStream()));
String line, des;
double title;
final StringBuilder builder = new StringBuilder(2048);
while ((line = bfr.readLine()) != null) {
builder.append(line);
}
// convert response to JSON array
final JSONArray jsa = new JSONArray(builder.toString());
// extract out data of interest
for (int i = 0; i < jsa.length(); i++) {
final JSONObject jo = (JSONObject) …Run Code Online (Sandbox Code Playgroud) 我一直在尝试使用这个小教程开发Portlet with Multiple Actions来调用portlet的方法'signinAction' .但是当我尝试这样做时,我得到Portlet暂时不可用的错误.我在Tomcat的服务器控制台中看不到任何东西.另外,当我使用processAction()时,我没有收到错误.我不知道出了什么问题.
JSP:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:actionURL var="signinAction" name="signinAction">
</portlet:actionURL>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login</title>
</head>
<body onload="load()" id="body1">
<form action="<%=signinAction.toString() %>" name="signinForm" method="post" onsubmit="return signin(this)">
<center>
<div class="div-upside-down" id="div-style">
<table width="95%">
<tr>
<td colspan="3"><p class="pp"></p>
</td>
</tr>
<tr>
<td id="td1">
<input type="text" id="email" name="email" placeholder="Email" />
<p id="one"></p>
</td>
<td id="td2">
<input type="password" …Run Code Online (Sandbox Code Playgroud) 在自定义portlet Liferay 6.1.1 GA2中创建kaleo工作流的步骤.
嗨,我是liferay的新手.我正在使用Liferay 6.1.1 GA2版本.有人可以请我提供在自定义portlet中创建工作流程的步骤,其中包含一些可行的示例.
提前致谢.
我正在使用Liferay 6.20和tomcat.
根据这篇文章:Liferay:登录Liferay的默认方法是什么?我已经在我的基本portlet类中添加了一个记录器,如下所示:
package mypackage.katalog;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.util.bridges.mvc.MVCPortlet;
/**
* Portlet implementation class KatalogUslugPortlet
*/
public class KatalogUslugPortlet extends MVCPortlet {
private static Log _log = LogFactoryUtil.getLog(KatalogUslugPortlet.class);
@Override
public void processAction(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {
testLogger();
super.processAction(actionRequest, actionResponse);
}
private void testLogger() {
System.out.print("SYSTEM_OUT!!!");
_log.info("INFO!!!");
_log.debug("DEBUG!!!");
_log.error("ERROR!!!");
}
}
Run Code Online (Sandbox Code Playgroud)
并且日志既不出现在控制台中,也不出现在tomcat日志中.怎么可能出错?
我在Eclipse中有一份Portlet项目的清单,例如20(新的可能会在将来出现,或者可能不会)。
我想做的是:
我尝试研究IPC,但它们都有一个示例,其中一个Portlet触发了一个事件,而一个以上的Portlet正在侦听,但反之亦然。
我们怎样才能做到这一点?有什么建议么?
我想为资产发布者portlet应用我的高级样式,用于创建并将在功能中创建的所有实例.(我想更新文档预览的宽度而不是portlet的宽度)这是我的代码:
.yui3-dd-draggable.yui3-resize{
width: 75% !important;
}
Run Code Online (Sandbox Code Playgroud)
我试过这样的
.portlet-borderless.portlet-asset-publisher.yui3-dd-draggable.yui3-resize{
width: 75% !important;
}
Run Code Online (Sandbox Code Playgroud)
要么
.portlet-borderless.portlet-asset-publisher. yui3-dd-draggable.yui3-resize{
width: 75% !important;
}
Run Code Online (Sandbox Code Playgroud)
要么
.portlet-borderless.portlet-asset-publisher
.yui3-dd-draggable.yui3-resize{
width: 75% !important;
}
}
Run Code Online (Sandbox Code Playgroud)
要么
.yui3-dd-draggable.yui3-resize{
.portlet-borderless.portlet-asset-publisher
width: 75% !important;
}
}
Run Code Online (Sandbox Code Playgroud)
或所有这些变体,但使用.portlet-borderless.portlet-document-library而不是.portlet-borderless.portlet-asset-publisher但没有成功.
那么你有什么建议如何为我的网站中的所有资产发布者portlet制作我的css默认值?
我得到这个Gradle错误:
> Task :jar
[Class my.MyPortlet is not assignable to specified service com.liferay.portal.kernel.model.Portlet]
Run Code Online (Sandbox Code Playgroud)
...这个极简主义的Liferay 7 portlet(官方文档的简化):
package my;
import com.liferay.portal.kernel.model.Portlet;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
import org.osgi.service.component.annotations.Component;
@Component(
service = Portlet.class
)
public class MyPortlet extends MVCPortlet {
}
Run Code Online (Sandbox Code Playgroud)
在调试模式下运行Gradle并没有给我更多线索:
[aQute.bnd.osgi.Builder] parseClassFile(): path=javax.portlet.PortletRequest resource=:/home/nico/.gradle/caches/modules-2/files-2.1/javax.portlet/portlet-api/2.0/1cd72f2a37fcf8ab9893a9468d7ba71c85fe2653/portlet-api-2.0.jar(javax/portlet/PortletRequest.class):
[aQute.bnd.osgi.Builder] end
[aQute.bnd.osgi.Builder] begin com.liferay.ant.bnd.npm.NpmAnalyzerPlugin@39735dcf
[aQute.bnd.osgi.Builder] end
[aQute.bnd.osgi.Builder] begin com.liferay.ant.bnd.resource.bundle.ResourceBundleLoaderAnalyzerPlugin@4e811a19
[aQute.bnd.osgi.Builder] end
[aQute.bnd.osgi.Builder] parseClassFile(): path=my/MyPortlet.class resource=/home/nico/my/build/classes/java/main/my/MyPortlet.class
[aQute.bnd.osgi.Builder] begin com.liferay.ant.bnd.sass.SassAnalyzerPlugin@526cd630
[aQute.bnd.osgi.Builder] end
[aQute.bnd.osgi.Builder] begin com.liferay.ant.bnd.service.ServiceAnalyzerPlugin@a73dc4
[aQute.bnd.osgi.Builder] end
[aQute.bnd.osgi.Builder] begin com.liferay.ant.bnd.social.SocialAnalyzerPlugin@2399853a
[aQute.bnd.osgi.Builder] end
[aQute.bnd.osgi.Builder] begin aQute.lib.spring.SpringComponent@650e1282
[aQute.bnd.osgi.Builder] end
[aQute.bnd.osgi.Builder] …Run Code Online (Sandbox Code Playgroud)