01: /*
02: * Poker
03: *
04: * Enhydra super-servlet presentation object
05: *
06: */
07:
08: package poker.presentation.login;
09:
10: // Enhydra SuperServlet imports
11: 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 CreatePlayerPresentation implements HttpPresentation {
18:
19: public void run(HttpPresentationComms comms)
20: throws HttpPresentationException, KeywordValueException {
21:
22: CreatePlayerHTML createPlayer;
23: createPlayer = (CreatePlayerHTML) comms.xmlcFactory
24: .create(CreatePlayerHTML.class);
25:
26: String name = (String) comms.request.getParameter("username");
27: String pw = (String) comms.request.getParameter("password");
28: String email = (String) comms.request.getParameter("email");
29: String cash = (String) comms.request.getParameter("cash");
30: String m = (String) comms.session.getSessionData().get("error");
31:
32: if (m != null) {
33: createPlayer.setTextError(m);
34: } else
35: createPlayer.setTextError("");
36:
37: HTMLInputElement input = null;
38: if (name != null) {
39: input = createPlayer.getElementUsername();
40: input.setValue(name);
41: } else {
42: input = createPlayer.getElementUsername();
43: input.setValue("");
44: }
45:
46: if (pw != null) {
47: input = createPlayer.getElementPassword();
48: input.setValue(pw);
49: input.setAttribute("type", "password");
50: } else {
51: input = createPlayer.getElementPassword();
52: input.setValue("");
53: }
54:
55: if (email != null) {
56: input = createPlayer.getElementEmail();
57: input.setValue(email);
58: } else {
59: input = createPlayer.getElementEmail();
60: input.setValue("");
61: }
62: if (cash != null) {
63: input = createPlayer.getElementCash();
64: input.setValue(cash);
65: } else {
66: input = createPlayer.getElementCash();
67: input.setValue("500");
68: }
69:
70: comms.response.writeDOM(createPlayer);
71: }
72:
73: }
|