[JBoss Seam] - Re: Error during model data update
by jason_rency
the faces-config.xml
| <?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE faces-config
| PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
| "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
|
| <faces-config>
|
| <!-- Navigation rules for the OTP reg Server -->
|
| <navigation-rule>
|
| <navigation-case>
| <from-outcome>login</from-outcome>
| <to-view-id>/home.xhtml</to-view-id>
| <redirect />
| </navigation-case>
|
| <navigation-case>
| <from-outcome>register</from-outcome>
| <to-view-id>/register.xhtml</to-view-id>
| <redirect />
| </navigation-case>
| </navigation-rule>
|
|
| <!-- Facelets support -->
|
| <application>
| <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
| </application>
|
| <!-- Select one of the two standard persistence lifecycle models for the Seam application -->
|
| <lifecycle>
| <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
| </lifecycle>
|
| </faces-config>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960265#3960265
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960265
19 years, 9 months
[JBoss Seam] - Re: Error during model data update
by jason_rency
the registerAction.java
package src.reg.server;
|
| import static org.jboss.seam.ScopeType.EVENT;
|
| import java.util.List;
|
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import org.jboss.seam.annotations.Destroy;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.core.FacesMessages;
|
| @Stateful
| @Scope(EVENT)
| @Name("register")
| public class RegisterAction implements Register
| {
|
| @In
| private RegUser user;
|
| @PersistenceContext
| private EntityManager em;
|
| @In(create=true)
| private transient FacesMessages facesMessages;
|
| private String PIN;
| private String verify;
|
| public String register()
| {
| System.out.println(PIN);
| System.out.println(user.getUId());
|
| if ( PIN.equals(verify) )
| {
| List existing = em.createQuery("select U_ID from RegUser where U_ID=:UId")
| .setParameter("UId", user.getUId())
| .getResultList();
| if (existing.size()==0)
| {
| //set hashcode of the pin
| user.setPinHash(PIN.hashCode());
| em.persist(user);
| facesMessages.add("Successfully registered as #{user.UId});
| return "login";
| }
| else
| {
| facesMessages.add("Username #{user.UId} already exists");
| return null;
| }
| }
| else
| {
| facesMessages.add("verify", "Re-enter your password");
| verify=null;
| return null;
| }
| }
|
| public String getVerify()
| {
| return verify;
| }
|
| public void setPIN(String PIN)
| {
| this.PIN = PIN;
| }
|
| public String getPIN()
| {
| return PIN;
| }
|
| public void setVerify(String verify)
| {
| this.verify = verify;
| }
|
| @Destroy @Remove
| public void destroy() {}
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960264#3960264
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960264
19 years, 9 months
[JBoss Seam] - Re: Error during model data update
by jason_rency
the register.xhtml
| <!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:s="http://jboss.com/products/seam/taglib">
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
| <title>OTP REG SERVER</title>
| <link href="css/screen.css" rel="stylesheet" type="text/css" />
| </head>
| <body id="pgHome">
| <h:form>
| <div id="document">
| <div id="header">
| <div id="title"><img src="img/hdr.title.gif" /></div>
| </div>
| <div id="container">
| <div id="sidebar">
| <h1>to register</h1>
| <p>
|
| here is to register a new user
| </p>
| </div>
| <div id="content">
| <div class="section">
| <h1>Register</h1>
| </div>
| <div class="section">
| <fieldset>
|
| <s:validateAll>
| <div class="entry">
| <div class="label"><h:outputLabel for="UId">Username:</h:outputLabel></div>
| <div class="input">
| <h:inputText id="UId" value="#{user.UId}" required="true"/><br/>
| <span class="errors"><h:message for="UId" /></span>
| </div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="PIN">Password:</h:outputLabel></div>
| <div class="input">
| <h:inputSecret id="PIN" value="#{register.PIN}" required="true"/><br/>
| <span class="errors"><h:message for="PIN" /></span>
| </div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="verify">Confirm PIN:</h:outputLabel></div>
| <div class="input">
| <h:inputSecret id="verify" value="#{register.verify}" required="true"/><br/>
| <span class="errors"><h:message for="verify" /></span>
| </div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="EMail">EMail:</h:outputLabel></div>
| <div class="input">
| <h:inputText id="EMail" value="#{user.EMail}" required="true"/><br/>
| <span class="errors"><h:message for="EMail" /></span>
| </div>
| </div>
| <div class="entry">
| <div class="label"><h:outputLabel for="phoneNumber">Phone Number:</h:outputLabel></div>
| <div class="input">
| <h:inputText id="phoneNumber" value="#{user.phoneNumber}" required="false"/><br/>
| <span class="errors"><h:message for="phoneNumber" /></span>
| </div>
| </div>
| </s:validateAll>
|
| <div class="entry errors"><h:messages globalOnly="true" /></div>
| <div class="entry">
| <div class="label"> </div>
| <div class="input">
| <h:commandButton value="Register" action="#{register.register}" class="button"/>
| <s:link value="Cancel" action="login" linkStyle="button" buttonClass="button"/>
| </div>
| </div>
|
| </fieldset>
| </div>
| </div>
| </div>
| <div id="footer">OTP registeration Server</div>
| </div>
| </h:form>
| </body>
| </html>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960263#3960263
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960263
19 years, 9 months
[JBoss jBPM] - Re: CommandExecutor in a clustered environment
by t-dome
I did the locking in the following way:
if (message != null) {
| jbpmContext.getSession().lock(message, LockMode.UPGRADE);
| checkForMoreMessages = true;
| Command command = (Command) message;
| command.execute();
| jbpmContext.save(message.getToken().getProcessInstance());
| jbpmContext.getSession().delete(message);
| }
| session.getTransaction().commit();
|
I implemented MyDbMessageService, because DbMessageService deletes the message from the session before it returns it (and before I can lock it in the CommandExecutor).
The message is now deleted in the CommandExecutor after locking it.
It is not possible to simply extend jBPM classes if they are not in the same package.
This is because many jBPM classes don't use 'protected' fields, but ones with package-local access.
For now I didn't try clustering with the CommandExecutor, I did only the locking part. Also I can't use JMS.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960262#3960262
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960262
19 years, 9 months