I need to do the following construction:
String pageName = request.getParameter("pageName");
if ("some_parameter".equals("pageName")) {
include("html/one.jsp", request, response);
}
if ("third_parameter".equals("pageName")) {
include("html/two.jsp", request, response);
}
But I always have problems like NullPointerException.
I mean, I'm trying to make different renderURL show different jsps, but I don't know how to do this. If you do not explain what I am, but I have knowledge in this topic, write smth in the comments, I will give more information. Thanks in advance!
Ok, I give you my example:
public static final String VIEW = "view";
public static final String ADD_BOOK = "add_book";
private final String VIEW_PAGE_PATH = "/html/view.jsp";
private final String ADD_BOOK_PAGE_PATH = "/html/add_book.jsp";
@Override
public void render(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
String pageName = request.getParameter("pageName");
if (pageName.equalsIgnoreCase(ADD_BOOK)) {
include(ADD_BOOK_PAGE_PATH, request, response);
} else {
include(VIEW_PAGE_PATH, request, response);
}
}
and my view.jsp:
<portlet:renderURL var="addBookVar">
<portlet:param name="pageName" value="<%=Library.ADD_BOOK %>"/>
</portlet:renderURL>
<a href="${addBookVar}">Add Book</a>
Why is this code not working? What to do to achieve a situation when different renderURL show different jsps?
source
share