You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by danielitob <gb...@aliceposta.it> on 2006/10/02 13:26:38 UTC

Date component

Hi guys,
i was surprising to note how difficult is using an inputDate of Tomahawk...
i've read many examples but i need a simplest solution...
i've used in my jsf page

<h:outputText value="Data"/>
<t:inputDate value="#{user.dataReg}">
					
</t:inputDate>

and i've a date columns in a mysql table.
I've to read this value entered in my page and putting it into database...
i do it in this manner

pst.setDate(12, dataReg);

(i've 12 fields in my table).
When i do it i've

java.lang.IllegalArgumentException: argument type mismatch 

How can i solve it?
I need a converter?
Please help me with code......thanks very much
-- 
View this message in context: http://www.nabble.com/Date-component-tf2369054.html#a6599625
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Date component

Posted by Gerald Müllan <bi...@gmail.com>.
Can you post a snippet of your managed bean here?

On 10/2/06, danielitob <gb...@aliceposta.it> wrote:
>
> thanks,
> i've tried with type value set to date but i've the same expection...
> can someone help me?
> I'vent understood where can be my problem..............
>
>
>
>
> Gerald M?llan wrote:
> >
> > Hi,
> >
> > normally you should not need a converter for just the simplest example.
> >
> > The "value" attribute of inputDate has only to be bound to a Date type
> > in the backend, in your case is this dataReg. Maybe you also have to
> > set the "type" attribute, e.g. to "date".
> >
> > Just have a look at our examples date page:
> >
> > http://www.irian.at/myfaces/date.jsf
> >
> > cheers,
> >
> > Gerald
> >
> > On 10/2/06, danielitob <gb...@aliceposta.it> wrote:
> >>
> >> Hi guys,
> >> i was surprising to note how difficult is using an inputDate of
> >> Tomahawk...
> >> i've read many examples but i need a simplest solution...
> >> i've used in my jsf page
> >>
> >> <h:outputText value="Data"/>
> >> <t:inputDate value="#{user.dataReg}">
> >>
> >> </t:inputDate>
> >>
> >> and i've a date columns in a mysql table.
> >> I've to read this value entered in my page and putting it into
> >> database...
> >> i do it in this manner
> >>
> >> pst.setDate(12, dataReg);
> >>
> >> (i've 12 fields in my table).
> >> When i do it i've
> >>
> >> java.lang.IllegalArgumentException: argument type mismatch
> >>
> >> How can i solve it?
> >> I need a converter?
> >> Please help me with code......thanks very much
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Date-component-tf2369054.html#a6599625
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Date-component-tf2369054.html#a6602958
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Date component

Posted by danielitob <gb...@aliceposta.it>.
thanks,
i've tried with type value set to date but i've the same expection...
can someone help me?
I'vent understood where can be my problem..............




Gerald M?llan wrote:
> 
> Hi,
> 
> normally you should not need a converter for just the simplest example.
> 
> The "value" attribute of inputDate has only to be bound to a Date type
> in the backend, in your case is this dataReg. Maybe you also have to
> set the "type" attribute, e.g. to "date".
> 
> Just have a look at our examples date page:
> 
> http://www.irian.at/myfaces/date.jsf
> 
> cheers,
> 
> Gerald
> 
> On 10/2/06, danielitob <gb...@aliceposta.it> wrote:
>>
>> Hi guys,
>> i was surprising to note how difficult is using an inputDate of
>> Tomahawk...
>> i've read many examples but i need a simplest solution...
>> i've used in my jsf page
>>
>> <h:outputText value="Data"/>
>> <t:inputDate value="#{user.dataReg}">
>>
>> </t:inputDate>
>>
>> and i've a date columns in a mysql table.
>> I've to read this value entered in my page and putting it into
>> database...
>> i do it in this manner
>>
>> pst.setDate(12, dataReg);
>>
>> (i've 12 fields in my table).
>> When i do it i've
>>
>> java.lang.IllegalArgumentException: argument type mismatch
>>
>> How can i solve it?
>> I need a converter?
>> Please help me with code......thanks very much
>> --
>> View this message in context:
>> http://www.nabble.com/Date-component-tf2369054.html#a6599625
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 

-- 
View this message in context: http://www.nabble.com/Date-component-tf2369054.html#a6602958
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Date component

Posted by Gerald Müllan <bi...@gmail.com>.
Hi,

normally you should not need a converter for just the simplest example.

The "value" attribute of inputDate has only to be bound to a Date type
in the backend, in your case is this dataReg. Maybe you also have to
set the "type" attribute, e.g. to "date".

Just have a look at our examples date page:

http://www.irian.at/myfaces/date.jsf

cheers,

Gerald

On 10/2/06, danielitob <gb...@aliceposta.it> wrote:
>
> Hi guys,
> i was surprising to note how difficult is using an inputDate of Tomahawk...
> i've read many examples but i need a simplest solution...
> i've used in my jsf page
>
> <h:outputText value="Data"/>
> <t:inputDate value="#{user.dataReg}">
>
> </t:inputDate>
>
> and i've a date columns in a mysql table.
> I've to read this value entered in my page and putting it into database...
> i do it in this manner
>
> pst.setDate(12, dataReg);
>
> (i've 12 fields in my table).
> When i do it i've
>
> java.lang.IllegalArgumentException: argument type mismatch
>
> How can i solve it?
> I need a converter?
> Please help me with code......thanks very much
> --
> View this message in context: http://www.nabble.com/Date-component-tf2369054.html#a6599625
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Date component

Posted by Jeff Bischoff <jb...@klkurz.com>.
daniel,

Is it a java.util.Date, java.sql.Date, or some other Date?
You haven't shown us your imports...

danielitob wrote:
> this is my managed bean user,i've declared it in session scope.
> I've posted you only important code..i hope you help me,thanks.
> 
> 
> public class User extends Visit {
> private Date dataReg;
> public void setDataReg(Date dataReg) {
> 		this.dataReg = dataReg;
> 	}
> 
> 	/**
> 	 * @return Returns the teamname.
> 	 * @uml.property name="teamname"
> 	 */
> 	public Date getDataReg() {
> 		return dataReg;
> 	}
> 
> public void AddNewUser(ActionEvent e) throws Exception {
> pst = conn.prepareStatement("INSERT INTO
> utente(username,password,nomegruppo,tipo,nome,cognome,citta,dataReg) VALUES
> (?,?,?,?,?,?,?,?)");
> 				
> 				pst.setString(1, login);
> 				
> 				pst.setString(2, password);
> 			
> 				pst.setString(3, teamname);
> 				
> 				pst.setString(4, role);
> 				
> 				pst.setString(5, firstName);
> 				
> 				pst.setString(6, lastName);
> 			
> 				pst.setString(7, city);
> 				
> 				pst.setDate(8, dataReg);
> 				
> 				
> 				pst.executeUpdate();
> 	}			
> 
> 
> danielitob wrote:
>> Hi guys,
>> i was surprising to note how difficult is using an inputDate of
>> Tomahawk...
>> i've read many examples but i need a simplest solution...
>> i've used in my jsf page
>>
>> <h:outputText value="Data"/>
>> <t:inputDate value="#{user.dataReg}">
>> 					
>> </t:inputDate>
>>
>> and i've a date columns in a mysql table.
>> I've to read this value entered in my page and putting it into database...
>> i do it in this manner
>>
>> pst.setDate(12, dataReg);
>>
>> (i've 12 fields in my table).
>> When i do it i've
>>
>> java.lang.IllegalArgumentException: argument type mismatch 
>>
>> How can i solve it?
>> I need a converter?
>> Please help me with code......thanks very much
>>
> 



Re: Date component

Posted by Gerald Müllan <bi...@gmail.com>.
When does the exception takes place?

I guess before coming into the actionListener method; Try to remove
the "throws exception" declaration, and move the prepared statement to
another place in code.

In general, you should do the data layer access separately from the
managed beans in another class.

regards,

Gerald

On 10/2/06, danielitob <gb...@aliceposta.it> wrote:
>
> this is my managed bean user,i've declared it in session scope.
> I've posted you only important code..i hope you help me,thanks.
>
>
> public class User extends Visit {
> private Date dataReg;
> public void setDataReg(Date dataReg) {
>                 this.dataReg = dataReg;
>         }
>
>         /**
>          * @return Returns the teamname.
>          * @uml.property name="teamname"
>          */
>         public Date getDataReg() {
>                 return dataReg;
>         }
>
> public void AddNewUser(ActionEvent e) throws Exception {
> pst = conn.prepareStatement("INSERT INTO
> utente(username,password,nomegruppo,tipo,nome,cognome,citta,dataReg) VALUES
> (?,?,?,?,?,?,?,?)");
>
>                                 pst.setString(1, login);
>
>                                 pst.setString(2, password);
>
>                                 pst.setString(3, teamname);
>
>                                 pst.setString(4, role);
>
>                                 pst.setString(5, firstName);
>
>                                 pst.setString(6, lastName);
>
>                                 pst.setString(7, city);
>
>                                 pst.setDate(8, dataReg);
>
>
>                                 pst.executeUpdate();
>         }
>
>
> danielitob wrote:
> >
> > Hi guys,
> > i was surprising to note how difficult is using an inputDate of
> > Tomahawk...
> > i've read many examples but i need a simplest solution...
> > i've used in my jsf page
> >
> > <h:outputText value="Data"/>
> > <t:inputDate value="#{user.dataReg}">
> >
> > </t:inputDate>
> >
> > and i've a date columns in a mysql table.
> > I've to read this value entered in my page and putting it into database...
> > i do it in this manner
> >
> > pst.setDate(12, dataReg);
> >
> > (i've 12 fields in my table).
> > When i do it i've
> >
> > java.lang.IllegalArgumentException: argument type mismatch
> >
> > How can i solve it?
> > I need a converter?
> > Please help me with code......thanks very much
> >
>
> --
> View this message in context: http://www.nabble.com/Date-component-tf2369054.html#a6605484
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Re: Date component

Posted by danielitob <gb...@aliceposta.it>.
this is my managed bean user,i've declared it in session scope.
I've posted you only important code..i hope you help me,thanks.


public class User extends Visit {
private Date dataReg;
public void setDataReg(Date dataReg) {
		this.dataReg = dataReg;
	}

	/**
	 * @return Returns the teamname.
	 * @uml.property name="teamname"
	 */
	public Date getDataReg() {
		return dataReg;
	}

public void AddNewUser(ActionEvent e) throws Exception {
pst = conn.prepareStatement("INSERT INTO
utente(username,password,nomegruppo,tipo,nome,cognome,citta,dataReg) VALUES
(?,?,?,?,?,?,?,?)");
				
				pst.setString(1, login);
				
				pst.setString(2, password);
			
				pst.setString(3, teamname);
				
				pst.setString(4, role);
				
				pst.setString(5, firstName);
				
				pst.setString(6, lastName);
			
				pst.setString(7, city);
				
				pst.setDate(8, dataReg);
				
				
				pst.executeUpdate();
	}			


danielitob wrote:
> 
> Hi guys,
> i was surprising to note how difficult is using an inputDate of
> Tomahawk...
> i've read many examples but i need a simplest solution...
> i've used in my jsf page
> 
> <h:outputText value="Data"/>
> <t:inputDate value="#{user.dataReg}">
> 					
> </t:inputDate>
> 
> and i've a date columns in a mysql table.
> I've to read this value entered in my page and putting it into database...
> i do it in this manner
> 
> pst.setDate(12, dataReg);
> 
> (i've 12 fields in my table).
> When i do it i've
> 
> java.lang.IllegalArgumentException: argument type mismatch 
> 
> How can i solve it?
> I need a converter?
> Please help me with code......thanks very much
> 

-- 
View this message in context: http://www.nabble.com/Date-component-tf2369054.html#a6605484
Sent from the MyFaces - Users mailing list archive at Nabble.com.