Toby,

In your action, you can cast the ActionForm to the right type of form, then
use the set/get methods.

If your ActionForm is of type "eg.FirstForm", in your Action's execute (or
perform if you're using an older verions of Struts) you can:

eg.FirstForm myForm = (eg.FirstForm) form;
myForm.setPassword( someFunctionThatReturnsTheUsersPassword() );

That stores the password for display using the <html:form ... /> tag
<html:text property="password"/>, ASSUMING your eg.FirstForm ActionForm has
a getPassword property.  There should be good examples in the struts example
.wars.

Regards,
David

-----Original Message-----
From: Toby Saville [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 30, 2003 8:20 PM
To: Struts Users Mailing List
Subject: RE: Representing Existing Objects In Forms


David,

Thanks for your assistance.

I suppose im wondering if there is a way to set the values of my ActionForm
implementation variables(CustomerForm in my case) before the form is
displayed, thus automatically populating the form when it is displayed.

I am able to set the values of my form bean (CustomerForm) in its
constructor. But to do what i want, i need to have access to the request
object in order to get a cookie value.

Perhaps I should just use your first suggestiong in order to achieve this.
-----Original Message-----
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Monday, 1 December 2003 12:03 PM
To: Struts Users Mailing List
Subject: RE: Representing Existing Objects In Forms


Toby,

You could:

a) Have a Password field in your ActionForm.  Then, you could lookup the
password, copy it into the ActionForm, and have the ActionForm display it in
your JSP when you show a <html:text property="password"/> field.

b) Save the password in a bean and print it out with a <bean:write ... />
statement so it is only viewable (read-only)

c) use an <html:text name="someRequestOrSessionBean" property="password" />
so you could save your own bean into the request or session scope then
display it as a text box.  If you want it to be submitted to a form, you
probably want to make sure that whatever action it submits to has a field
with the same "property" name (in this case "password").

I think there are other methods but these are the ones I know and use.
Probably because the Struts examples showed me how (hint, hint!). :)

Regards,
David

-----Original Message-----
From: Toby Saville [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 30, 2003 7:35 PM
To: Struts Users Mailing List
Subject: RE: Representing Existing Objects In Forms


David,

Perhaps I dont understand the full capabilities of ActionForms.

I am fine with creating a new customer from the contents of a form. But
after this is done (and, for eg, the user has used parts of the site) and
they decide to change their email address, how can i display (in the form)
the password they entered when they registered in order to let them modify
it?

thanks,

toby.

-----Original Message-----
From: David Friedman [mailto:[EMAIL PROTECTED]
Sent: Monday, 1 December 2003 11:25 AM
To: Struts Users Mailing List
Subject: RE: Representing Existing Objects In Forms


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:[EMAIL PROTECTED]
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:[EMAIL PROTECTED]
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:[EMAIL PROTECTED]
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:[EMAIL PROTECTED]
> 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:[EMAIL PROTECTED]
>>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 | [EMAIL PROTECTED]
>>+91 612 3117606
>>[ Developer and Part Time Human Being]
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
> --
>
>
> Rajat Pandit | [EMAIL PROTECTED]
> +91 612 3117606
> [ Developer and Part Time Human Being]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

--


Rajat Pandit | [EMAIL PROTECTED]
+91 612 3117606
[ Developer and Part Time Human Being]



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


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



***************************************************************
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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



***************************************************************
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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



***************************************************************
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to