Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h:form>
- <h1>Регистрация</h1>
- <h:panelGrid columns="3">
- <h:outputLabel for="email" value="Email: " />
- <h:inputText id="email" value="#{userBean.email}" required="true" />
- <h:message for="email" />
- <h:outputLabel for="password" value="Пароль: " />
- <h:inputSecret id="password" value="#{userBean.password}" required="true" />
- <h:message for="password" />
- <h:commandButton value="Зарегестрировать" action="#{userBean.registrate()}" />
- <h:button value="Войти" outcome="login" />
- <br />
- </h:panelGrid>
- </h:form>
- @Named
- @SessionScoped
- public class UserBean implements Serializable {
- @Inject
- private UserEJB userEJB;
- private String email;
- private String password;
- private User currentUser;
- public User getCurrentUser() {
- return currentUser;
- }
- public void setCurrentUser(User currentUser) {
- this.currentUser = currentUser;
- }
- public String getEmail() {
- return email;
- }
- public void setEmail(String email) {
- this.email = email;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- public String registrate() {
- User user = new User();
- user.setEmail(email);
- user.setPassword(password);
- currentUser = user;
- userEJB.create(user);
- return "index";
- }
- }
Add Comment
Please, Sign In to add comment