Mercurial > hg > LGServer
comparison src/main/java/de/mpiwg/web/AbstractBean.java @ 0:7682c04c63a8
First commit of the source code!
author | "jurzua <jurzua@mpiwg-berlin.mpg.de>" |
---|---|
date | Tue, 10 Mar 2015 14:50:41 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7682c04c63a8 |
---|---|
1 package de.mpiwg.web; | |
2 | |
3 import java.util.ArrayList; | |
4 | |
5 import javax.faces.context.FacesContext; | |
6 | |
7 public class AbstractBean { | |
8 | |
9 public Object getRequestBean(String name){ | |
10 return FacesContext.getCurrentInstance().getExternalContext().getRequestMap().get(name); | |
11 } | |
12 | |
13 public SessionBean getSessionBean(){ | |
14 return (SessionBean)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get(SessionBean.BEAN_NAME); | |
15 } | |
16 | |
17 public void addMsg(String msg){ | |
18 if(getSessionBean().getMsgList() == null){ | |
19 getSessionBean().setMsgList(new ArrayList<String>()); | |
20 } | |
21 if(!getSessionBean().getMsgList().contains(msg)){ | |
22 getSessionBean().getMsgList().add(msg); | |
23 } | |
24 } | |
25 | |
26 public void listenerCloseMsgPopup(){ | |
27 System.out.println("listenerCloseMsgPopup"); | |
28 getSessionBean().setMsgList(null); | |
29 } | |
30 | |
31 public void internalError(Exception e){ | |
32 addMsg("Internal Error: " + e.getMessage()); | |
33 e.printStackTrace(); | |
34 } | |
35 | |
36 } |