RE: XMLForm and dates

2002-11-14 Thread Sylvain.Thevoz
Hello Jan,

Thank you for your reply.

Yes, your understanding is right. The problem appears because I want to display the 
date in the form. But the date in the form isn't really useful and I could cancel the 
idea to display it.

I'm trying to insert/update database with an DatabaseAccess layer written in Java. 
This layer includes one Java class for each database table and each class has getter, 
setter and query method to access to the database.

But I'm really interested how you do that with XMLForm and modular database actions. 
Could you provide me some information?

Thank you
Sylvain

-Message d'origine-
De: Jan [mailto:juyttenh;pandora.be]
Date: mercredi, 13. novembre 2002 20:04
À: [EMAIL PROTECTED]
Objet: Re: XMLForm and dates


Hi,

I'm currently using a combination of XMLForms and modular database 
actions to insert and update db data. I don't understand what exactly is 
your problem.

Some of my beans contain Date or TimeStamp attributes, containing the 
current date. I don't need a String representation of the dates, as I 
don't display the dates, I just need them to be available for update or 
insert. But if I'm not mistaken, calling a Date using jxpath should 
invoke toString()... ?

The only problem I had was inserting the date or timestamp in the 
database (datetime column). I'm using the modular database actions, and 
an InputModule to access the bean in the session. If this is what you're 
trying to do, you should modify the JDBCTypeConversions, because the 
most simple mapping (in my case TimeStamp to Types.TIMESTAMP is not 
provided).

But besides that, it works very well. So if you want to display the 
data, jxpath should take care of the toString() I think. Or am I missing 
something here?
And for the actual database actions: how are you trying to insert/update 
the database? ESQL, modular database actions?

Hope this helps you any further. Feel free to ask more information, 
perhaps I should write a howto or tutorial about the integration of 
XMLForms and modular database actions, if anyone is interested and if I 
find the time for it :-)

In the meantime: is anyone working on the (input)modules right now? I 
think I read something on the mailinglist a while ago, but I don't know 
what the current status is. To use XMLForms with modular database 
actions, an XMLFormInputModule is a nice and easy way to work...

Jan


Ivelin Ivanov wrote:

Try the following:

Use a Date property with its own getter and setter for the database access.
Implement an extra property named dateString.
Then write the getter of the property to convert the Date object into String
when invoked.
Also write a setter to convert a string to a date. The Java DateFormat class
can help.
http://java.sun.com/j2se/1.3/docs/api/java/text/DateFormat.html


In your XMLForm documents refer to the dateString property, instead of the
date property.
In your Java code, use the date property.


Hope this helps.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 12, 2002 8:00 AM
Subject: XMLForm and dates


Hello,

I use XMLForm and I want to put the today date in a form.
The problem is that the today date has to be a String because the XMLForm
simply display the value of the Bean class attribute. If this value is not a
String, the date can't be read!
But I want to store the today date in a Date format (because I have a
timestamp format in my database).

How to store the date in a Date type and display it like a String?
How to do this??

Thank you
Sylvain

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]



-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]


  




-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XMLForm and dates

2002-11-13 Thread Jan
Hi,

I'm currently using a combination of XMLForms and modular database 
actions to insert and update db data. I don't understand what exactly is 
your problem.

Some of my beans contain Date or TimeStamp attributes, containing the 
current date. I don't need a String representation of the dates, as I 
don't display the dates, I just need them to be available for update or 
insert. But if I'm not mistaken, calling a Date using jxpath should 
invoke toString()... ?

The only problem I had was inserting the date or timestamp in the 
database (datetime column). I'm using the modular database actions, and 
an InputModule to access the bean in the session. If this is what you're 
trying to do, you should modify the JDBCTypeConversions, because the 
most simple mapping (in my case TimeStamp to Types.TIMESTAMP is not 
provided).

But besides that, it works very well. So if you want to display the 
data, jxpath should take care of the toString() I think. Or am I missing 
something here?
And for the actual database actions: how are you trying to insert/update 
the database? ESQL, modular database actions?

Hope this helps you any further. Feel free to ask more information, 
perhaps I should write a howto or tutorial about the integration of 
XMLForms and modular database actions, if anyone is interested and if I 
find the time for it :-)

In the meantime: is anyone working on the (input)modules right now? I 
think I read something on the mailinglist a while ago, but I don't know 
what the current status is. To use XMLForms with modular database 
actions, an XMLFormInputModule is a nice and easy way to work...

Jan


Ivelin Ivanov wrote:

Try the following:

Use a Date property with its own getter and setter for the database access.
Implement an extra property named dateString.
Then write the getter of the property to convert the Date object into String
when invoked.
Also write a setter to convert a string to a date. The Java DateFormat class
can help.
http://java.sun.com/j2se/1.3/docs/api/java/text/DateFormat.html


In your XMLForm documents refer to the dateString property, instead of the
date property.
In your Java code, use the date property.


Hope this helps.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 12, 2002 8:00 AM
Subject: XMLForm and dates


Hello,

I use XMLForm and I want to put the today date in a form.
The problem is that the today date has to be a String because the XMLForm
simply display the value of the Bean class attribute. If this value is not a
String, the date can't be read!
But I want to store the today date in a Date format (because I have a
timestamp format in my database).

How to store the date in a Date type and display it like a String?
How to do this??

Thank you
Sylvain

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]



-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]


 




-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XMLForm and dates

2002-11-12 Thread Antonio Gallardo Rivera
hat database are you using? I am using PostgreSQL 7.2.

I resolve this problem setting the requiered field in the database with 
default value today.

Antonio Gallardo

El Martes, 12 de Noviembre de 2002 08:00, [EMAIL PROTECTED] 
escribió:
 Hello,

 I use XMLForm and I want to put the today date in a form.
 The problem is that the today date has to be a String because the XMLForm
 simply display the value of the Bean class attribute. If this value is not
 a String, the date can't be read! But I want to store the today date in a
 Date format (because I have a timestamp format in my database).

 How to store the date in a Date type and display it like a String?
 How to do this??

 Thank you
 Sylvain

 -
 Please check that your question  has not already been answered in the
 FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




RE: XMLForm and dates

2002-11-12 Thread Sylvain.Thevoz
I'm using MS SQL Server 2000.

It means that you don't insert the date with the form but your database insert it 
automatically!?

Sylvain

-Message d'origine-
De: Antonio Gallardo Rivera [mailto:agallardo;agsoftware.dnsalias.com]
Date: mardi, 12. novembre 2002 15:14
À: [EMAIL PROTECTED]
Objet: Re: XMLForm and dates


hat database are you using? I am using PostgreSQL 7.2.

I resolve this problem setting the requiered field in the database with 
default value today.

Antonio Gallardo

El Martes, 12 de Noviembre de 2002 08:00, [EMAIL PROTECTED] 
escribió:
 Hello,

 I use XMLForm and I want to put the today date in a form.
 The problem is that the today date has to be a String because the XMLForm
 simply display the value of the Bean class attribute. If this value is not
 a String, the date can't be read! But I want to store the today date in a
 Date format (because I have a timestamp format in my database).

 How to store the date in a Date type and display it like a String?
 How to do this??

 Thank you
 Sylvain

 -
 Please check that your question  has not already been answered in the
 FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XMLForm and dates

2002-11-12 Thread Antonio Gallardo Rivera
El Martes, 12 de Noviembre de 2002 08:43, [EMAIL PROTECTED] 
escribió:
 I'm using MS SQL Server 2000.

 It means that you don't insert the date with the form but your database
 insert it automatically!?

Yes. I mean create a default value for this. Then in the insert I omit to send 
a value for the date field and the database server make it for me.

I am sure that in MS SQL Server must be a similar instruction to do that. Lets 
check the command for CREATE TABLE (or something similar) and how to create a 
default value for a date field.

For example in PostgreSQL I write use:

CREATE TABLE CanjeEstado
  (
can_id   int4not null,
tec_id   int4not null default 1,
usr_id   int4not null,
ces_tiempo   timestamp   not null default now(),

primary key(can_id,tec_id),
unique(can_id,tec_id),
);

As you can see, the ces_tiempo is of type TIMESTAMP can not be null and there 
is a default value for the field tha is defined using the built-in function 
now().

Check for something similar in your database I am sure there must be a similar 
approach.

Regards,

Antonio Gallardo


 Sylvain

 -Message d'origine-
 De: Antonio Gallardo Rivera [mailto:agallardo;agsoftware.dnsalias.com]
 Date: mardi, 12. novembre 2002 15:14
 À: [EMAIL PROTECTED]
 Objet: Re: XMLForm and dates


 hat database are you using? I am using PostgreSQL 7.2.

 I resolve this problem setting the requiered field in the database with
 default value today.

 Antonio Gallardo

 El Martes, 12 de Noviembre de 2002 08:00, [EMAIL PROTECTED]

 escribió:
  Hello,
 
  I use XMLForm and I want to put the today date in a form.
  The problem is that the today date has to be a String because the XMLForm
  simply display the value of the Bean class attribute. If this value is
  not a String, the date can't be read! But I want to store the today date
  in a Date format (because I have a timestamp format in my database).
 
  How to store the date in a Date type and display it like a String?
  How to do this??
 
  Thank you
  Sylvain
 
  -
  Please check that your question  has not already been answered in the
  FAQ before posting. http://xml.apache.org/cocoon/faq/index.html
 
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail:   [EMAIL PROTECTED]

 -
 Please check that your question  has not already been answered in the
 FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]


 -
 Please check that your question  has not already been answered in the
 FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail:   [EMAIL PROTECTED]

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]




Re: XMLForm and dates

2002-11-12 Thread Ivelin Ivanov

Try the following:

Use a Date property with its own getter and setter for the database access.
Implement an extra property named dateString.
Then write the getter of the property to convert the Date object into String
when invoked.
Also write a setter to convert a string to a date. The Java DateFormat class
can help.
http://java.sun.com/j2se/1.3/docs/api/java/text/DateFormat.html


In your XMLForm documents refer to the dateString property, instead of the
date property.
In your Java code, use the date property.


Hope this helps.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 12, 2002 8:00 AM
Subject: XMLForm and dates


Hello,

I use XMLForm and I want to put the today date in a form.
The problem is that the today date has to be a String because the XMLForm
simply display the value of the Bean class attribute. If this value is not a
String, the date can't be read!
But I want to store the today date in a Date format (because I have a
timestamp format in my database).

How to store the date in a Date type and display it like a String?
How to do this??

Thank you
Sylvain

-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]



-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.html

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:   [EMAIL PROTECTED]