Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://xmlns.jcp.org/jsf/html"
- xmlns:p="http://primefaces.org/ui"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:pm="http://primefaces.org/mobile"
- xmlns:ui="http://java.sun.com/jsf/facelets">
- <h:head>
- <!-- <link rel="stylesheet" type="text/css" href="generalstyle.css" /> -->
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <link rel="apple-touch-icon" href="../images/TBT-Icon.png" />
- <style type="text/css">
- </style>
- </h:head>
- <h:body>
- <p:growl id="growl" life="3000" showDetail="true" />
- <h:form action="#{verifyCredentials.checkCredentials}" method="POST">
- <div id="form">
- <p:fieldset legend="Teilnehmer-Beurteilungstool">
- <p>
- <pm:field>
- <p:outputLabel for="basic" value="Benutzername:" id="basiclabel" />
- <br />
- <p:tooltip for="basic" value="Geben Sie Ihren Login Namen ein." id="basictooltip"/>
- <p:inputText id="basic" value="#{verifyCredentials.kursleiter.name}" autocomplete="on" sticky="true" />
- <p:watermark for="basic" value="Login Namen" id="basicwatermark"/>
- </pm:field>
- </p>
- <p>
- <pm:field>
- <p:outputLabel for="password" value="Passwort:" id="passwordlabel"/>
- <br />
- <p:tooltip for="password" value="Geben Sie Ihr Passwort ein." id="passwordtooltip"/>
- <p:password required="true" id="password" value="#{verifyCredentials.kursleiter.passwort}" sticky="true" update="growl"/>
- <p:watermark for="password" value="Passwort" id="passwordwatermark"/>
- </pm:field>
- </p>
- <p>
- <p:tooltip for="log" value="Einloggen." id="logtooltip"/>
- <p:commandButton id="log" value="Login" type="submit" action="#{verifyCredentials.checkCredentials}" update="growl"/>
- </p>
- </p:fieldset>
- </div>
- </h:form>
- </h:body>
- </html>
- package com.ubs.tbt.login;
- import javax.faces.application.FacesMessage;
- import javax.faces.bean.ManagedBean;
- import javax.faces.context.FacesContext;
- @ManagedBean
- public class MessageManagedBean {
- private String message;
- public MessageManagedBean(String type) {
- if(type=="negativ") {
- outPutGrowlNEG();
- }
- if(type == "positiv") {
- outPutGrowlPOS();
- }
- if(type == "wrong") {
- System.out.println("Wrong Growl: " + type);
- outPutGrowlWrong();
- }
- }
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
- public void outPutGrowlNEG() {
- FacesContext context = FacesContext.getCurrentInstance();
- context.addMessage(null, new FacesMessage("Erfolgreich", "Die Bewertung wurde hinzugefügt..."));
- context.addMessage(null, new FacesMessage("Bewertung:", "Negativ"));
- }
- public void outPutGrowlPOS() {
- FacesContext context = FacesContext.getCurrentInstance();
- context.addMessage(null, new FacesMessage("Erfolgreich", "Die Bewertung wurde hinzugefügt..."));
- context.addMessage(null, new FacesMessage("Bewertung:", "Positiv"));
- }
- public void outPutGrowlWrong() {
- FacesContext context = FacesContext.getCurrentInstance();
- System.out.println("outPutGrowlWrong");
- context.addMessage(null, new FacesMessage("Passwort Inkorrekt", "Wrong Password"));
- }
- }
- else if (lit.getName().equals(kursleiter.getName()) && !(lit.getPasswort().equals(kursleiter.getPasswort()))){
- System.out.println("CHECK: Could not find a match");
- String type = "wrong";
- MessageManagedBean mmb = new MessageManagedBean(type);
- /*
- * Die Session schon da schliessen, sonst ist es unsicher
- */
- transaction.commit();
- session.close();
- sessionFactory.close();
- return "nok";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement