留言板

ErrorPage Configuration

thumbnail
prabhakar reddy,修改在9 年前。

ErrorPage Configuration

New Member 帖子: 7 加入日期: 13-8-1 最近的帖子
Hi All,

I want too configure the custom pages for 404 , 403 and 500 errors in Liferay. can anyone have any idea?

Thanks,
thumbnail
Manali Lalaji,修改在9 年前。

RE: ErrorPage Configuration

Expert 帖子: 362 加入日期: 10-3-9 最近的帖子
Hi,

For 404 error,

You can create a hook and override the jsp portal-web\docroot\errors\404.jsp
Create a custom jsp : hooks\HookPlugin-hook\docroot\WEB-INF\custom_jsps\errors\404.jsp

and add below portal-ext.properties:
layout.show.http.status=true
layout.friendly.url.page.not.found=/errors/404.jsp

HTH!
thumbnail
Jitendra Rajput,修改在9 年前。

RE: ErrorPage Configuration

Liferay Master 帖子: 875 加入日期: 11-1-7 最近的帖子
For other error codes like 500 you can add below entry in web.xml .

<error-page>
<error-code>500</error-code>
<location>/errors/500Error.jsp</location>
</error-page>


You need to create ext-plugin to over ride web.xml.
thumbnail
Tanweer Ahmed .,修改在1 年前。

RE: ErrorPage Configuration

Expert 帖子: 322 加入日期: 10-3-11 最近的帖子
Hi Prabhakar,

Just in case you do not find the 404.jsp, you have to override /errors/code.jsp.

LR 6.2 uses code.jsp for displaying the Error messages of this kind.

-Tanweer
thumbnail
prabhakar reddy,修改在9 年前。

RE: ErrorPage Configuration

New Member 帖子: 7 加入日期: 13-8-1 最近的帖子
Hi All,

For configure the custom error page for 403(forbidden error), we need to write a liferay hook.

/html/portal/status.jsp in side this jsp page we have code like this. Now we can write our custom message here.

<c:when test="<%= SessionErrors.contains(request, PrincipalException.class.getName()) %>">
<h3 class="alert alert-error">
<liferay-ui:message key="forbidden" />
</h3>

<liferay-ui:message key="you-do-not-have-permission-to-access-the-requested-resource" />

<br /><br />

<code class="lfr-url-error"><%= HtmlUtil.escape(url) %></code>
</c:when>



Thanks,
Prabhakar reddy.
Mahesh Salunkhe,修改在8 年前。

RE: ErrorPage Configuration

New Member 帖子: 8 加入日期: 12-9-5 最近的帖子
My requirement is to show custom 'under construction page'

what i tried so far-
layout.show.http.status=true
layout.friendly.url.page.not.found=/html/portal/page_under_construction.html

I created page_under_construction.html and jpg image and put under folder '/ROOT/html/portal'.

Upto this, it's working fine.

How to get images outside tomcat/webapps/ as 'under construction' page/html is at some other drive e.g. 'D' or webapps of another tomcat?
Note - i have tried updating file 'server.xml' --> <host>-->
e.g.<context path="/foo/bar" docbase="D:/images"></context>

What is way to accomplish this?