You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Toby Saville <To...@lands.nsw.gov.au> on 2003/12/01 00:30:12 UTC

Representing Existing Objects In Forms

hello all,

I am wanting to represent an existing object using a form and was wondering how to do this. 

My situation is displaying a customer's details in a form for the purpose of allowing them to update them.

I cant think how I can populate the form tho.

Im new to struts and this list so i apolagise if this has already been answered. 

Thanks, 

toby

-----Original Message-----
From: David Friedman [mailto:humble@ix.netcom.com]
Sent: Monday, 1 December 2003 8:35 AM
To: Struts Users Mailing List
Subject: RE: org.apache.struts.legacy.GenericDataSource


Rajat,

I haven't had any problems with DBCP.  It's just that a different pool came
with Hibernate that I used in production by default.  I'm using DBCP in
testing but I always close my development computer (my desktop) down at
night so I have no comments on how DBCP works in reality.  I'm sure it's
fine in production.

Regards,
David

-----Original Message-----
From: Rajat Pandit [mailto:rajatp@centergroupinc.com]
Sent: Sunday, November 30, 2003 1:13 AM
To: Struts Users Mailing List
Subject: Re: org.apache.struts.legacy.GenericDataSource


hey david,
thanks a lot!, just one last question, what kind of troubles did u have
with DBCP. coz this will be used in production so i want to know what to
expect, however a refactoring is schedule anyway but not anytime sooner.
thanks once again!


David Friedman wrote:
> Rajit,
>
> I don't use the Struts DataSource because I had to much trouble with it a
> few months ago.  However, the commons DBCP expains all parameters here:
> http://jakarta.apache.org/commons/dbcp/configuration.html
>
> You should be able to set any of them in your struts-config.xml
data-source
> entry with this syntax:
>
> <set-property
>       property="minIdle"
>       value="XXX" />
>
> I checked my testing and production environments and I forgot I've
switched
> away from DBCP to C3P0 (it comes with Hibernate).  However, I'd recommend
> the options (listed in the above mentioned web page):
>
> validationQuery set to "select 1+1" works in MySQL and returns 1 row
> testWhileIdle set to "true"
> timeBetweenEvictionRunsMillis set to "1800000" (1000 miliseconds * 60
> seconds * 30 minutes)
> testOnBorrow set to "true"
> minIdle set to "2" (or higher)
>
> Regards,
> David
>
> -----Original Message-----
> From: Rajat Pandit [mailto:rajatp@centergroupinc.com]
> Sent: Saturday, November 29, 2003 2:14 PM
> To: Struts Users Mailing List
> Subject: Re: org.apache.struts.legacy.GenericDataSource
>
>
> hello david,
> thanks for the quick reply, could u pls mail me the extract of the
> <data-source which worked fr u. along all with the settings. (u can
> ofcourse remove the l/p :P )
> this would be a great help! and have u have the kind of sucess with DBCP
> in dealing with connection pool and idle connections?
> thanks!
>
> David Friedman wrote:
>
>
>>Rajat,
>>
>>I've had that type of disconnect problem using Hibernate (a product
>
> roughly
>
>>like Ibatis).  My problem was one of the DBCP settings: minIdle.  MySQL
>>wasn't seeing any activity on some pool connections overnight, so it was
>>disconnecting them.  Lowering the minIdle setting seemed to cause DBCP to
>>test each pool connection by performing a simple select automatically.
>
> The
>
>>query seems to be a non-table select, along the lines of a 'select 1+1;'.
>>That allowed MySQL to keep each connection active and not disconnect any
>>overnight after being idle for hours.
>>
>>Regards,
>>David
>>
>>-----Original Message-----
>>From: Rajat Pandit [mailto:rajatp@centergroupinc.com]
>>Sent: Saturday, November 29, 2003 12:44 PM
>>To: Struts Users Mailing List
>>Subject: org.apache.struts.legacy.GenericDataSource
>>
>>
>>hello gurus,
>>i have an terrible terrible problem with my application, after hosting
>>this application it stops to work after 8-10hrs of idle state. then the
>>server has to restart and then its fine again.
>>
>>i learnt that the mysql driver disconects after 8hrs of an idle
>>connection so i addred autoreconnect=true to the connection url. however
>>the problem doesnt seem to get sovled. just extended fro another another
>>and then the same problem again.
>>i need to  know how to remove org.apache.struts.legacy.GenericDataSource
>>and use the connection from DBCP (commons lib ie.) and will i need to
>>change the settings in the code (struts-config.xml) i also am thinking
>>of refactoring the entire codebase usng iBatis. will it solve this issue?
>>
>>pls help! i need this project to be up and running in the next week.
>>thanks once again
>>the logs follows.
>>
>>
>>
>>NFO:    Return allocated connection, activeCount=2, useCount=1
>>Nov 28, 2003 8:00:15 PM com.hedging.HedgeUser validUser
>>INFO: --> Error: Communication link failure: java.io.IOException<--
>>Nov 28, 2003 8:00:15 PM org.apache.struts.legacy.GenericDataSource
>>returnConnection
>>INFO:   releaseConnection(), activeCount=2, useCount=0
>>Nov 28, 2003 8:00:30 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 28, 2003 8:00:33 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 28, 2003 8:00:35 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 28, 2003 8:00:36 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 29, 2003 12:33:42 AM org.apache.jk.common.ChannelSocket
>>processConnection
>>INFO: connection timeout reached
>>Nov 29, 2003 12:33:47 AM org.apache.jk.common.ChannelSocket
>>processConnection
>>INFO: connection timeout reached
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:   getConnection()
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:    Check for timeout, activeCount=2, useCount=0
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:    Found available connection
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:    Return allocated connection, activeCount=2, useCount=1
>>Nov 29, 2003 12:33:58 AM com.hedging.HedgeUser validUser
>>INFO: --> Error: No operations allowed after connection closed<--
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>returnConnection
>>INFO:   releaseConnection(), activeCount=2, useCount=0
>>Nov 29, 2003 12:34:18 AM org.apache.jk.common.ChannelSocket
>>processConnection
>>--
>>
>>
>>Rajat Pandit | rajatp@centergroupinc.com
>>+91 612 3117606
>>[ Developer and Part Time Human Being]
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> --
>
>
> Rajat Pandit | rajatp@centergroupinc.com
> +91 612 3117606
> [ Developer and Part Time Human Being]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>

--


Rajat Pandit | rajatp@centergroupinc.com
+91 612 3117606
[ Developer and Part Time Human Being]



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



***************************************************************
This message is intended for the addressee named and 
may  contain confidential information. If you are not the 
intended recipient, please delete it and notify the sender. 
Views expressed in this message are those of the 
individual sender, and are not necessarily the views of 
the Department of  Lands.

This email message has been swept by MIMEsweeper 
for the presence of computer viruses.
***************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Representing Existing Objects In Forms

Posted by David Friedman <hu...@ix.netcom.com>.
Toby,

Where is your trouble?  Do you not understand ActionForms?  Are you worried
about how to transfer the data submitted and auto-populated into the
ActionForm into your business logic?  Or is something else confusing you?

Regards,
David

-----Original Message-----
From: Toby Saville [mailto:Toby.Saville@lands.nsw.gov.au]
Sent: Sunday, November 30, 2003 6:30 PM
To: Struts Users Mailing List
Subject: Representing Existing Objects In Forms


hello all,

I am wanting to represent an existing object using a form and was wondering
how to do this.

My situation is displaying a customer's details in a form for the purpose of
allowing them to update them.

I cant think how I can populate the form tho.

Im new to struts and this list so i apolagise if this has already been
answered.

Thanks,

toby

-----Original Message-----
From: David Friedman [mailto:humble@ix.netcom.com]
Sent: Monday, 1 December 2003 8:35 AM
To: Struts Users Mailing List
Subject: RE: org.apache.struts.legacy.GenericDataSource


Rajat,

I haven't had any problems with DBCP.  It's just that a different pool came
with Hibernate that I used in production by default.  I'm using DBCP in
testing but I always close my development computer (my desktop) down at
night so I have no comments on how DBCP works in reality.  I'm sure it's
fine in production.

Regards,
David

-----Original Message-----
From: Rajat Pandit [mailto:rajatp@centergroupinc.com]
Sent: Sunday, November 30, 2003 1:13 AM
To: Struts Users Mailing List
Subject: Re: org.apache.struts.legacy.GenericDataSource


hey david,
thanks a lot!, just one last question, what kind of troubles did u have
with DBCP. coz this will be used in production so i want to know what to
expect, however a refactoring is schedule anyway but not anytime sooner.
thanks once again!


David Friedman wrote:
> Rajit,
>
> I don't use the Struts DataSource because I had to much trouble with it a
> few months ago.  However, the commons DBCP expains all parameters here:
> http://jakarta.apache.org/commons/dbcp/configuration.html
>
> You should be able to set any of them in your struts-config.xml
data-source
> entry with this syntax:
>
> <set-property
>       property="minIdle"
>       value="XXX" />
>
> I checked my testing and production environments and I forgot I've
switched
> away from DBCP to C3P0 (it comes with Hibernate).  However, I'd recommend
> the options (listed in the above mentioned web page):
>
> validationQuery set to "select 1+1" works in MySQL and returns 1 row
> testWhileIdle set to "true"
> timeBetweenEvictionRunsMillis set to "1800000" (1000 miliseconds * 60
> seconds * 30 minutes)
> testOnBorrow set to "true"
> minIdle set to "2" (or higher)
>
> Regards,
> David
>
> -----Original Message-----
> From: Rajat Pandit [mailto:rajatp@centergroupinc.com]
> Sent: Saturday, November 29, 2003 2:14 PM
> To: Struts Users Mailing List
> Subject: Re: org.apache.struts.legacy.GenericDataSource
>
>
> hello david,
> thanks for the quick reply, could u pls mail me the extract of the
> <data-source which worked fr u. along all with the settings. (u can
> ofcourse remove the l/p :P )
> this would be a great help! and have u have the kind of sucess with DBCP
> in dealing with connection pool and idle connections?
> thanks!
>
> David Friedman wrote:
>
>
>>Rajat,
>>
>>I've had that type of disconnect problem using Hibernate (a product
>
> roughly
>
>>like Ibatis).  My problem was one of the DBCP settings: minIdle.  MySQL
>>wasn't seeing any activity on some pool connections overnight, so it was
>>disconnecting them.  Lowering the minIdle setting seemed to cause DBCP to
>>test each pool connection by performing a simple select automatically.
>
> The
>
>>query seems to be a non-table select, along the lines of a 'select 1+1;'.
>>That allowed MySQL to keep each connection active and not disconnect any
>>overnight after being idle for hours.
>>
>>Regards,
>>David
>>
>>-----Original Message-----
>>From: Rajat Pandit [mailto:rajatp@centergroupinc.com]
>>Sent: Saturday, November 29, 2003 12:44 PM
>>To: Struts Users Mailing List
>>Subject: org.apache.struts.legacy.GenericDataSource
>>
>>
>>hello gurus,
>>i have an terrible terrible problem with my application, after hosting
>>this application it stops to work after 8-10hrs of idle state. then the
>>server has to restart and then its fine again.
>>
>>i learnt that the mysql driver disconects after 8hrs of an idle
>>connection so i addred autoreconnect=true to the connection url. however
>>the problem doesnt seem to get sovled. just extended fro another another
>>and then the same problem again.
>>i need to  know how to remove org.apache.struts.legacy.GenericDataSource
>>and use the connection from DBCP (commons lib ie.) and will i need to
>>change the settings in the code (struts-config.xml) i also am thinking
>>of refactoring the entire codebase usng iBatis. will it solve this issue?
>>
>>pls help! i need this project to be up and running in the next week.
>>thanks once again
>>the logs follows.
>>
>>
>>
>>NFO:    Return allocated connection, activeCount=2, useCount=1
>>Nov 28, 2003 8:00:15 PM com.hedging.HedgeUser validUser
>>INFO: --> Error: Communication link failure: java.io.IOException<--
>>Nov 28, 2003 8:00:15 PM org.apache.struts.legacy.GenericDataSource
>>returnConnection
>>INFO:   releaseConnection(), activeCount=2, useCount=0
>>Nov 28, 2003 8:00:30 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 28, 2003 8:00:33 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 28, 2003 8:00:35 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 28, 2003 8:00:36 PM org.apache.jk.common.ChannelSocket
>
> processConnection
>
>>INFO: connection timeout reached
>>Nov 29, 2003 12:33:42 AM org.apache.jk.common.ChannelSocket
>>processConnection
>>INFO: connection timeout reached
>>Nov 29, 2003 12:33:47 AM org.apache.jk.common.ChannelSocket
>>processConnection
>>INFO: connection timeout reached
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:   getConnection()
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:    Check for timeout, activeCount=2, useCount=0
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:    Found available connection
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>getConnection
>>INFO:    Return allocated connection, activeCount=2, useCount=1
>>Nov 29, 2003 12:33:58 AM com.hedging.HedgeUser validUser
>>INFO: --> Error: No operations allowed after connection closed<--
>>Nov 29, 2003 12:33:58 AM org.apache.struts.legacy.GenericDataSource
>>returnConnection
>>INFO:   releaseConnection(), activeCount=2, useCount=0
>>Nov 29, 2003 12:34:18 AM org.apache.jk.common.ChannelSocket
>>processConnection
>>--
>>
>>
>>Rajat Pandit | rajatp@centergroupinc.com
>>+91 612 3117606
>>[ Developer and Part Time Human Being]
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>
>
> --
>
>
> Rajat Pandit | rajatp@centergroupinc.com
> +91 612 3117606
> [ Developer and Part Time Human Being]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>

--


Rajat Pandit | rajatp@centergroupinc.com
+91 612 3117606
[ Developer and Part Time Human Being]



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



***************************************************************
This message is intended for the addressee named and
may  contain confidential information. If you are not the
intended recipient, please delete it and notify the sender.
Views expressed in this message are those of the
individual sender, and are not necessarily the views of
the Department of  Lands.

This email message has been swept by MIMEsweeper
for the presence of computer viruses.
***************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org