fix messages
parent
fa03edf32d
commit
6b90d7b0c0
@ -1,5 +1,27 @@
|
|||||||
package ru.ulstu.core.navigation;
|
package ru.ulstu.core.navigation;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
@Named
|
||||||
public class Page {
|
public class Page {
|
||||||
|
public static final String INDEX = "/index.xhtml";
|
||||||
public static final String PAPER_LIST = "/paper/papers.xhtml";
|
public static final String PAPER_LIST = "/paper/papers.xhtml";
|
||||||
|
public static final String DASHBOARD = "/paper/dashboard.xhtml";
|
||||||
|
public static final String LOGOUT = "/logout";
|
||||||
|
|
||||||
|
public String getPAPER_LIST() {
|
||||||
|
return PAPER_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getINDEX() {
|
||||||
|
return INDEX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDASHBOARD() {
|
||||||
|
return DASHBOARD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLOGOUT() {
|
||||||
|
return LOGOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package ru.ulstu.core.util;
|
||||||
|
|
||||||
|
import javax.faces.FacesException;
|
||||||
|
import javax.faces.application.FacesMessage;
|
||||||
|
import javax.faces.context.ExternalContext;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class FacesUtil {
|
||||||
|
public static void redirectToPage(FacesContext context, String page, String params) {
|
||||||
|
ExternalContext extContext = context.getExternalContext();
|
||||||
|
String url = extContext.encodeActionURL(context.getApplication().getViewHandler().getActionURL(context, page)
|
||||||
|
+ params);
|
||||||
|
try {
|
||||||
|
extContext.redirect(url);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new FacesException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void redirectToPage(String page) {
|
||||||
|
redirectToPage(FacesContext.getCurrentInstance(), page, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void redirectToPage(String page, String params) {
|
||||||
|
redirectToPage(FacesContext.getCurrentInstance(), page, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showInfoMessage(String summary, String detail) {
|
||||||
|
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, detail);
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
fc.getExternalContext().getFlash().setKeepMessages(true);
|
||||||
|
fc.addMessage(null, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showDangerMessage(String summary, String detail) {
|
||||||
|
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, summary, detail);
|
||||||
|
FacesContext.getCurrentInstance().addMessage(null, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,21 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en"
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorate="~{default}">
|
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container" layout:fragment="content">
|
|
||||||
<section id="services">
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 text-center">
|
|
||||||
<h2 class="section-heading text-uppercase">Доступ запрещен</h2>
|
|
||||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en"
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorate="~{default}">
|
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container" layout:fragment="content">
|
|
||||||
<section id="services">
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 text-center">
|
|
||||||
<h2 class="section-heading text-uppercase">Страница не найдена</h2>
|
|
||||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en"
|
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
||||||
layout:decorate="~{default}">
|
|
||||||
<head>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container" layout:fragment="content">
|
|
||||||
<section id="services">
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-12 text-center">
|
|
||||||
<h2 class="section-heading text-uppercase">Ошибка сервера</h2>
|
|
||||||
<a href="/"><h3>Вернуться на главную</h3></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue