Vraptor e campos HORA

0 respostas
rogercafe

Olá pessoal, é o seguinte...
Como eu faço para trabalhar com campos do tipo HORA junto com o vRaptor?
Eu preciso do seguinte...
Tenho dois campos em uma JSP, Start Time e End Time, eu preciso passar eles para meu POJO para poder persistilos.
Eu preencho eles com os seguintes valores:
Start Time: 09:00
End Time: 12:00
Mas o vraptor está dando erro quando vai tratar desses campos.

Meu Pojo é o seguinte:

@Entity
public class Activity
{  
   @Id       
   @GeneratedValue
   private Integer		id;
   
   @Temporal(TemporalType.DATE)
   private Date		date;
   
   private Double		percentageComplete;
   private String 		remarks;
   
   @Temporal(TemporalType.TIME)
   private Date			startTime;
   
   @Temporal(TemporalType.TIME)
   private Date 		endTime;
   
   @ManyToOne
   @JoinColumn(name="ARTIFACT_ID")
   private Artifact 		artifact;
   
   @ManyToOne
   @JoinColumn(name="ACTIVETYPE_ID")
   private ActivityType 	activityType;
   
   @ManyToOne
   @JoinColumn(name="AGREEMENTTYPE_ID")
   private AgreementType 	type;
   
   @ManyToOne
   @JoinColumn(name="PROJECT_ID")
   private Project 			project;
   
   @ManyToOne
   @JoinColumn(name="USER_ID")
   private User 			user;
   
   
   public ActivityType getActivityType() {
	   return activityType;
   }
   public void setActivityType(ActivityType activityType) {
	   this.activityType = activityType;
   }
   public Artifact getArtifact() {
	   return artifact;
   }
   public void setArtifact(Artifact artifact) {
	   this.artifact = artifact;
   }
   public Date getDate() {
	   return date;
   }
   public void setDate(Date date) {
	   this.date = date;
   }
   public Date getEndTime() {
	   return endTime;
   }
   public void setEndTime(Date endTime) {
	   this.endTime = endTime;
   }
   public Project getProject() {
	   return project;
   }
   public void setProject(Project project) {
	   this.project = project;
   }
   public java.lang.String getRemarks() {
	   return remarks;
   }
   public void setRemarks(java.lang.String remarks) {
	   this.remarks = remarks;
   }
   
   public Date getStartTime() {
	   return startTime;
   }
   public void setStartTime(Date startTime) {
	   this.startTime = startTime;
   }
   public AgreementType getType() {
	   return type;
   }
   public void setType(AgreementType type) {
	   this.type = type;
   }
   public User getUser() {
	   return user;
   }
   public void setUser(User user) {
	   this.user = user;
   }
   public Integer getId() {
	   return id;
   }
   public void setId(Integer id) {
	   this.id = id;
   }
   public Double getPercentageComplete() {
	   return percentageComplete;
   }
   public void setPercentageComplete(Double percentageComplete) {
	   this.percentageComplete = percentageComplete;
   }
   
}

minha jsp está assim:

<form action="ActivityLogic.insert.logic" method="post">
	<input type="hidden" name="activity.id" value="${activity.id}" />
	<table width="500"  border="0">
  <tr>
    <td width="10%"><label>Complete:</label></td>
    <td colspan="4">
    	<select name="{activity.percentageComplete}">
				<option value="0">0%</option>
				<option value="10">10%</option>
				<option value="20">20%</option>
				<option value="30">30%</option>
				<option value="40">40%</option>
				<option value="50">50%</option>
				<option value="60">60%</option>
				<option value="70">70%</option>
				<option value="80">80%</option>
				<option value="90">90%</option>
				<option value="100">100%</option>
			</select>
		</td>
  	</tr>
	<tr>
    	<td><label>Start time:</label></td>
    	<td><input name="activity.startTime" value="<fmt:formatDate value="${activity.endTime}" type="time" timeStyle="short"/>" maxlength="5"/></td>
	</tr>		
	<tr>
		
    	<td width="9%"><label>End time:</label></td>
    	<td><input name="activity.endTime" value="<fmt:formatDate value="${activity.endTime}" type="time" timeStyle="short"/>" maxlength="5"/></td>
  	</tr>
  	<tr>
    	<td><label>Artifact:</label></td>
    	<td><t:select name="activity.artifact.id" collection="${artifacts}"  selected="${activity.artifact.id}" /></td>
	</tr>
	<tr>
    	<td><label>Type:</label></td>
    	<td><t:select name="activity.activityType.id" collection="${activityTypes}" selected="${activity.activityType.id}" /></td>
  	</tr>
  	<tr>
    	<td><label>Agreement:</label></td>
    	<td><t:select name="activity.type.id" collection="${agreementTypes}"	selected="${activity.type.id}" /></td>
	</tr>
	<tr>
   		<td><label>Project:</label></td>
    	<td><t:select name="activity.project.id" collection="${projects}" selected="${activity.project.id}"	/></td>
  	</tr>
  <tr>
    <td><label>Remarks:</label></td>
    <td colspan="4"><textarea cols="70" rows="5"></textarea></td>
  </tr> 
</table>
<input type="submit" value="save" />
 
</form>

Mas quando clico no submit vem a seguinte mensagem de erro:

2006-08-07 15:00:56,296 DEBUG vraptor.introspector.BasicIntrospector -> Parameter activity.id will be used on field activity 2006-08-07 15:00:56,296 DEBUG vraptor.reflection.JPathExecutor -> ready to use parameter [activity, id] 2006-08-07 15:00:56,296 DEBUG vraptor.converter.SimpleConverterManager -> Found converter org.vraptor.converter.basic.SimpleIntegerConverter 2006-08-07 15:00:56,296 DEBUG vraptor.introspector.BasicIntrospector -> Parameter activity.project.id will be used on field activity 2006-08-07 15:00:56,296 DEBUG vraptor.reflection.JPathExecutor -> ready to use parameter [activity, project, id] 2006-08-07 15:00:56,296 DEBUG vraptor.converter.SimpleConverterManager -> Found converter org.vraptor.converter.basic.SimpleIntegerConverter 2006-08-07 15:00:56,296 DEBUG vraptor.introspector.BasicIntrospector -> Parameter activity.startTime will be used on field activity 2006-08-07 15:00:56,296 DEBUG vraptor.reflection.JPathExecutor -> ready to use parameter [activity, startTime] 2006-08-07 15:00:56,296 DEBUG vraptor.introspector.BasicIntrospector -> Unable to find converter for java.util.Date org.vraptor.converter.ConversionException: Unable to find converter for java.util.Date at org.vraptor.converter.SimpleConverterManager.findConverter(SimpleConverterManager.java:102) at org.vraptor.converter.SimpleConverterManager.convert(SimpleConverterManager.java:53) at org.vraptor.reflection.JPathExecutor.convert(JPathExecutor.java:238) at org.vraptor.reflection.JPathExecutor.set(JPathExecutor.java:189) at org.vraptor.introspector.BasicIntrospector.readParameters(BasicIntrospector.java:72) at org.vraptor.core.ConversionEngine.convert(ConversionEngine.java:18) at org.vraptor.interceptor.SettingAndValidationInterceptor.intercept(SettingAndValidationInterceptor.java:63) at org.vraptor.core.BasicLogicFlow.execute(BasicLogicFlow.java:98) at org.vraptor.interceptor.InjectionInterceptor.intercept(InjectionInterceptor.java:49) at org.vraptor.core.BasicLogicFlow.execute(BasicLogicFlow.java:98) at org.vraptor.interceptor.ComponentLookupInterceptor.intercept(ComponentLookupInterceptor.java:33) at org.vraptor.core.BasicLogicFlow.execute(BasicLogicFlow.java:98) at com.eel.bugreports.logic.AutorizathionInterceptor.intercept(AutorizathionInterceptor.java:27) at org.vraptor.core.BasicLogicFlow.execute(BasicLogicFlow.java:98) at com.eel.bugreports.logic.DaoInterceptor.intercept(DaoInterceptor.java:16) at org.vraptor.core.BasicLogicFlow.execute(BasicLogicFlow.java:98) at org.vraptor.core.VRaptorExecution.execute(VRaptorExecution.java:70) at org.vraptor.core.VRaptorController.execute(VRaptorController.java:74) at org.vraptor.VRaptorServlet.service(VRaptorServlet.java:51) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595)
Criado 7 de agosto de 2006
Respostas 0
Participantes 1