我已经定义了一个由我的六个 Portlet 组成的页面,并在portal-ext.properties
文件中将其配置为我的默认 Lnding 页面。
我有一个用于联系我的数据库的自定义登录页面,一旦用户有效,我将使用 /user/test/home 将他重定向到此页面,并尝试使用http://localhost:8086/user/test/home
但这没有用,我继续得到
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
response.setContentType("text/html");
System.out.println("Inside the doView Method");
PortletRequestDispatcher dispatcher = null;
if (this.name.isEmpty()) {
dispatcher = getPortletContext().getRequestDispatcher(
"/WEB-INF/jsp/AllInOne_view.jsp");
} else {
request.setAttribute("name", this.name);
dispatcher = getPortletContext().getRequestDispatcher(
"http://localhost:8086/user/test/home");
}
this.name = "";
this.action = "";
dispatcher.include(request, response);
}
17:53:47,765 ERROR [render_portlet_jsp:154] java.lang.NullPointerException
at org.ravi.learning.AllInOne.doView(AllInOne.java:57)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
AllinOne.java 是我的自定义 GenericPortlet 类 AllInOne.java:57 是
dispatcher.include(request, response);
此处更新部分
这是java类
package org.ravi.learning;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
public class AllInOne extends GenericPortlet {
String action = "";
String name = "";
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
System.out.println("Inside the Process Action Method new");
this.action = request.getParameter("myAction");
if (this.action.equals("formAction")) {
this.name = request.getParameter("personName");
}
String urlpaths = "http://localhost:8086/user/test/home";
response.sendRedirect(urlpaths);
}
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
response.setContentType("text/html");
}
}
作为一个新用户,我不能发布图片,所以请参考此外部链接获取图片