Commit 66b28c13 by tuomari

git-svn-id: https://dev.intra.insomnia.fi/svn/trunk@21 8cf89bec-f6a3-4178-919f-364fb3449fe5

1 parent 7ebee0a4
...@@ -6,11 +6,7 @@ ...@@ -6,11 +6,7 @@
<attribute name="owner.project.facets" value="jst.java"/> <attribute name="owner.project.facets" value="jst.java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"/>
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
......
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title></title>
</h:head>
<h:body>
<ui:composition template="/layout/default-template.xhtml">
<ui:define name="title">CreateUser</ui:define>
<ui:define name="header">Header</ui:define>
<ui:define name="content">
<h:form>
<h:inputText value="#{userView.name}" />
<h:commandButton action="helloPage" value="Save" />
</h:form>
<h:form>
</h:form>
</ui:define>
<ui:define name="footer">footer</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
package fi.insomnia.bortal.view;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import fi.insomnia.bortal.UserBeanLocal;
import fi.insomnia.bortal.db.User;
@ManagedBean
@SessionScoped
public class UserView {
@EJB
private UserBeanLocal bean;
private User currentUser;
private String nick = "default";
private String password = "default";
private String realname = "default";
private String address = "default";
public String saveUser()
{
// Luodaan uusi kyttj UserBeanin funktiolla createNewUser jolle
// annetaan parametrina pakolliset tiedot ( nick ja salasana )
// Paluuarvona saadaan uusi uljas kyttj-olio.
currentUser = bean.createNewUser(nick, password);
if(currentUser == null)
{
return "fault";
}
// asetetaan muut kentt..
currentUser.setName(realname);
currentUser.setAddress(address);
return "edit";
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public void setCurrentUser(User currentUser) {
this.currentUser = currentUser;
}
public User getCurrentUser() {
return currentUser;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!