[jboss-user] [JBoss Seam] - Re: problem to load classes

JoviJojo do-not-reply at jboss.com
Fri Dec 15 07:07:56 EST 2006


yes, i restarted the deployment. in my application the use cases should be (to start with) 
1) user login
2) register new logs
the user login case seam to be fine,
but the register log part are not working!! for one that the new log table are not created, and input text fields do not work. i can see the 'name' of each input field, BUT you can enter anything there, basically you got list of input fields titiles
please give me a hint: many thanks in advance!!!"
here are some codes
__________
log.java

package com.omxgroup.oith;
import java.io.Serializable;
import javax.persistence.GeneratedValue;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
import org.jboss.seam.annotations.Name;

@Entity
@Name("omxlog")
@Table(name="OMXLogs")
public class OMXLog implements Serializable
{
	   private Long id;
	   private String logName;
	   private String customerName;
	   private String errorType;
	   private String causingReason;
	   private String involvementInformation;
	   private String afflictedParts;
	   private String estimatedCost;
	   private String logDescription;
	   
	   private static final long serialVersionUID = 1881413500711441955L;
	   	   
	   public OMXLog(String logName, String customerName, String errorType, String causingReason, 
			   String involvementInformation, String afflictedParts, String estimatedCost, String logDescription)
	   {
	      this.logName = logName;
	      this.customerName = customerName;
	      this.errorType = errorType;
	      this.causingReason = causingReason;
	      this.involvementInformation = involvementInformation;
	      this.afflictedParts = afflictedParts;
	      this.estimatedCost = estimatedCost;	      
	   }
	   
	   public OMXLog() {}

	  @Id @GeneratedValue
	  public Long getId()
	  {
	   return id;
	  }
	  public void setId(Long id)
	  {
	      this.id = id;
	   }
	   
	   @Id @NotNull @Length(min=5, max=15) 
	   public String getLogName()
	   {
	      return logName;
	   }
	   public void setLogName(String logName)
	   {
	      this.logName = logName;
	   }
	   
	   @Length(max=100) @NotNull
	   public String getCustomerName()
	   {
	      return customerName;
	   }
	   public void setCustomerName(String customerName)
	   {
	      this.customerName = customerName;
	   }
	   
	   @Length(max=100) @NotNull
	   public String getErrorType()
	   {
	      return errorType;
	   }
	   public void setErrorType(String errorType)
	   {
	      this.errorType = errorType;
	   }
	   
	   @Length(max=1000) @NotNull
	   public String getCausingReason()
	   {
	      return causingReason;
	   }
	   public void setCausingReason(String causingReason)
	   {
	      this.causingReason= causingReason;
	   }
	   
	   @Length(max=1000) @NotNull
	   public String getInvolvementInformation()
	   {
	      return involvementInformation;
	   }
	   public void setInvolvementInformation(String involvementInformation)
	   {
	      this.involvementInformation = involvementInformation;
	   }
	   
	   @Length(max=100) @NotNull
	   public String getAfflictedParts()
	   {
	      return afflictedParts;
	   }
	   
	   public void setAfflictedParts(String afflictedParts)
	   {
	      this.afflictedParts = afflictedParts;
	   }

	   @Length(max=100) @NotNull
	   public String getEstimatedCost()
	   {
	      return estimatedCost;
	   }
	   
	   public void setEstimatedCost(String estimatedCost)
	   {
	      this.estimatedCost = estimatedCost;
	   }
	   
	   @Length(max=2000) @NotNull
	   public String getLogDescription()
	   {
	      return logDescription;
	   }
	   
	   public void setLogDescription(String logDescription)
	   {
	      this.logDescription = logDescription;
	   }
	   
}
---------------
LogRegister.java
package com.omxgroup.oith;

import javax.ejb.Local;

@Local
public interface LogRegister
{
   public String logregister();
}
-----------
LogRegisterAction.java
//Author JOXI	
//OMX Developer
//Date: 2006-12-06
package com.omxgroup.oith;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ejb.*;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.core.FacesMessages;


@Stateless
@Name("logregister")
public class LogRegisterAction implements LogRegister
{

   @In
   private OMXLog omxlog;
   
   @PersistenceContext
   private EntityManager em;
        
   @In(create=true)
   private transient FacesMessages facesMessages;
   
   public String logregister()
   {
      List existing = em.createQuery("select logName from  OMXLog where logName=:logName")
         .setParameter("logName", omxlog.getLogName())
         .getResultList();
      if (existing.size()==0)
      {
         em.persist(omxlog);
         facesMessages.add("Add new log: #{omxlog.logName} to OMX Log clearing database");
         //log.info("Registered new user #{user.username}");
         return "/logregister.xhtml";
      }
      else
      {
         FacesMessages.instance().add(" this log: #{omxlog.logName} already exists in the database, create a new one or edit it later");
         return null;
      }
   }
   
}
--------------
registerLog.xhtml
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                template="layout/template.xhtml">

	<ui:define name="body">
	<h:form>
	<h:messages globalOnly="true" styleClass="message"/>
	    
	        
				<h1>Register a new log</h1>
									
						<s:validateAll>
							
						           Log Name
						           <h:inputText value="#{omxlog.logName}" required="true"/>
						     
							
								<h:outputLabel for="customerName">customer Name:</h:outputLabel>
								
									<h:inputText id="customerName" value="#{omxlog.customerName}" required="true"/>
									<h:message for="customerName"/>
								
							
							
								<h:outputLabel for="causingReason">Causing Reason:</h:outputLabel>
								
									<h:inputText id="causingReason" value="#{omxlog.causingReason}" required="true"/>
									<h:message for="causingReason" />
								
							
							
								<h:outputLabel for="involvementInformation">involvement information:</h:outputLabel>
								
									<h:inputText id="involvementInformation" value="#{omxlog.involvementInformation}" required="true"/>
									<h:message for="causingReason" />
								
							
							
								<h:outputLabel for="causingReason">Estimated Cost:</h:outputLabel>
								
									<h:inputText id="estimatedCost" value="#{omxlog.estimatedCost}" required="true"/>
									<h:message for="estimatedCost" />
								
							
							
								<h:outputLabel for="afflictedParts">Afflicted Parts:</h:outputLabel>
								
									<h:inputText id="afflictedParts" value="#{omxlog.afflictedParts}" required="true"/>
									<h:message for="afflictedParts" />
								
							
							
								<h:outputLabel for="logDescription">Log Description:</h:outputLabel>
								
									<h:inputText id="logDescription" value="#{omxlog.logDescription}" required="true"/>
									<h:message for="logDescription" />
								
							
							</s:validateAll>
						
						<h:messages globalOnly="true" />
						
							&#160;
							
								<h:commandButton value="Register New Log" action="#{logregister.logregister}" class="button"/>&#160;
								<s:link value="Cancel" action="logRegister" linkStyle="button" buttonClass="button"/>
							
						
						
					
						
		
	
			
			
		
	</h:form>
	</ui:define>
</ui:composition>




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994200#3994200

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994200



More information about the jboss-user mailing list