Message Boards

SiteNavigationMenuItemType edit.jsp Problem

Alexander Spielauer, modified 3 Years ago.

SiteNavigationMenuItemType edit.jsp Problem

New Member Posts: 4 Join Date: 7/21/20 Recent Posts
Hello Liferay Community,

I currently have the problem that i want to create a custom site navigation menu point.
I found out that this can be done via
SiteNavigationMenuItemType

I implemented a simple sample project attached to this post (for Liferay DXP Version 7.1).

My problem is:
The edit.jsp is not found and throws an error
java.io.FileNotFoundException: /edit.jsp

I guess i need a specific usage of the
ServletContext
but i did not find how to do that.
Does anyone maybe know an answer please?
greetings Alex.

Additional Information:
In order that you do not have to look into the zip file here are parts of the code:
@Component(
		immediate = true,
		property = {
				
		},
		service = SiteNavigationMenuItemType.class
	)
public class MyNavigationMenuItemType implements SiteNavigationMenuItemType {

    ...
    
	@Override
	public void renderAddPage(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
			throws IOException {
		ServletContext _servletContext = httpServletRequest.getSession().getServletContext();
		_jspRenderer.renderJSP(_servletContext, httpServletRequest, httpServletResponse, "/edit.jsp");
	}

	@Override
	public void renderEditPage(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
			SiteNavigationMenuItem siteNavigationMenuItem) throws IOException {
		httpServletRequest.setAttribute(SITE_NAVIGATION_MENU_ITEM, siteNavigationMenuItem);

		ServletContext _servletContext = httpServletRequest.getSession().getServletContext();
		_jspRenderer.renderJSP(_servletContext, httpServletRequest, httpServletResponse, "/edit.jsp");
	}
	
	@Reference
	private JSPRenderer _jspRenderer;
The edit.jsp is located at
src/main/resources/META-INF/resources/edit.jsp

thanks in advance for any help.