1 7 8 package poker.presentation.login; 9 10 import com.lutris.appserver.server.httpPresentation.HttpPresentation; 12 import com.lutris.appserver.server.httpPresentation.HttpPresentationComms; 13 import com.lutris.appserver.server.httpPresentation.HttpPresentationException; 14 import com.lutris.util.KeywordValueException; 15 import org.w3c.dom.html.HTMLInputElement; 16 17 public class LoginPresentation implements HttpPresentation { 18 19 20 public void run(HttpPresentationComms comms) 21 throws HttpPresentationException, KeywordValueException { 22 23 LoginHTML login; 24 login = (LoginHTML)comms.xmlcFactory.create(LoginHTML.class); 25 26 String username = (String )comms.session.getSessionData().get("oname"); 28 String password = ""; 29 String cash = ""; 30 String id = comms.session.getSessionKey(); 31 String m = (String )comms.session.getSessionData().get("loginMessage"); 32 if (m != null) { 33 login.setTextMessage(m); 34 } 35 else 36 login.setTextMessage("Enter your username, password and desired" + 37 " additional cash amount!"); 38 39 if (username == null || username.equals("")) { 40 username = comms.request.getParameter("username"); 41 password = comms.request.getParameter("pw"); 42 cash = comms.request.getParameter("cash"); 43 } 44 if (username == null || username.equals("")) { 45 username = comms.request.getParameter(""); 46 password = comms.request.getParameter(""); 47 cash = comms.request.getParameter(""); 48 } 49 50 51 53 HTMLInputElement input = null; 54 input = login.getElementId(); 55 input.setValue(id); 56 input = login.getElementUsername(); 57 input.setValue(username); 58 input = login.getElementPassword(); 59 input.setValue(password); 60 input.setAttribute("type","password"); 61 input = login.getElementCash(); 62 input.setValue(cash); 63 64 input = login.getElementUsernameCreate(); 65 input.setValue(username); 66 input = login.getElementPasswordCreate(); 67 input.setValue(password); 68 input = login.getElementCashCreate(); 69 input.setValue(cash); 70 71 comms.response.writeDOM(login); 72 } 73 74 } 75 | Popular Tags |