-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: java.lang.IllegalArgumentException
PostPosted: Tue Sep 09, 2008 5:19 am 
Newbie

Joined: Fri May 02, 2008 6:03 am
Posts: 6
Hi,

I want to use my hibernate generate pojo java files in spring to complete my application.In Event.java (which I generated by hbm2java ant task)
two variables are, in which first is String type and other is Date type.

When I send these two variables using jsp welcome page to Event.java, I found error on jsp page can not parse String to required type Date.

I am still trying but not getting.

hbm2java generated code
Event.java ::

Code:
package events;
// Generated Jun 5, 2008 9:16:18 AM by Hibernate Tools 3.2.0.b9


import java.util.Date;

/**
* Event generated by hbm2java
*/
public class Event  implements java.io.Serializable {


     private long id;
     private Date date;
     private String title;

    public Event() {
    }

    public Event(Date date, String title) {
       this.date = date;
       this.title = title;
    }
   
    public long getId() {
        return this.id;
    }
   
    public void setId(long id) {
        this.id = id;
    }
    public Date getDate() {
        return this.date;
    }
   
    public void setDate(Date date) {
        this.date = date;
    }
    public String getTitle() {
        return this.title;
    }
   
    public void setTitle(String title) {
        this.title = title;
    }




}




welcome form
hello.jsp ::
Code:
<%@ include file="/WEB-INF/jsp/include.jsp" %>
<%@ taglib prefix="spring" uri="/spring" %>


<html>
<head>
<title><fmt:message key="Event.title"/></title>
</head>
<body>
<h1><fmt:message key="Event.heading"/></h1>

<form method="post"> 
<table width="95%" bgcolor="f8f8ff" border="0" cellspacing="0" cellpadding="5">   

<tr>     

    <td alignment="right" width="20%">
    Event Date:
    </td>

<!--here entry for event is done in springapp2-servlet.xml i.e. Event.java-->     

<spring:bind path="event.date">       

<td width="20%">
<input type="text" name="date">     
</td>       
 
  <td width="60%">         
  <font color="red"><c:out value="${status.errorMessage}"/></font>       
  </td>     
   </spring:bind>   
   
</tr>
   
     <tr>     
         <td alignment="right" width="20%">
         Event Title
         </td>

        <spring:bind path="event.title">       

        <td width="20%">         
        <input type="text" name="title">       
        </td>       
 
        <td width="60%">         
        <font color="red"><c:out value="${status.errorMessage}"/></font>       
        </td>     
 
        </spring:bind>   
   </tr>
   </table> 
   
   <br>
   
    <spring:hasBindErrors name="event">   
    <b>Please fix all errors!</b> 
    </spring:hasBindErrors> 
   
    <br><br>
     
     <input type="submit" alignment="center" value="Submit">
     
     </form>
     
     
     
         
     </body>
     </html>


Problem is I submit date as string type like 2008/09/09 to Event.java but it must be date type in Event.java.

Should I something change in jsp page to convert date(String type) to date(Date type)?

How manner I can remove this problem?

I try but not getting.


Please!! post your valuable suggestions.


Regards,

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 09, 2008 7:22 am 
Beginner
Beginner

Joined: Tue Nov 27, 2007 9:44 am
Posts: 46
Hi,

also wirklich Deutsch ist das ja nicht.

To me this looks more like a Spring question, a subject on which I am unable to help you. But you might try to put this question on the Hibernate Users forum, where English is the standard communication language.

Good Luck


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.