It worked!

Thanks for all the help.
It seems that my pages were coming from my cache.
I did set the accountsList in the request.
I had to restart my system to get  it to work.

Thanks a lot.

Richie

At 11:12 AM 1/28/2004 +0100, you wrote:
accountsList is a local variable in your ActionClass.
At the end of the action, you should store it in an attribute under one
of the available scope to make it available to your target page.

So add something like
request.setAttribute("accountsList", accountsList);
at the end of your action.
This will make your beans available in request scope, which is the one
making the most sense here as the beans should only stay available for
your target jsp to render and not afterwards.

Eric.

> -----Original Message-----
> From: shankarr [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, January 28, 2004 8:44 AM
> To: [EMAIL PROTECTED]
> Subject: resultset data not obtained
>
> Hi!
>
> I am making my db queries in a helper class(AccountService) and
sending
> the
> storing the data in an arraylist. I send the arraylist back to the
action
> file.
>
> Snippet from helper file
>
> ArrayList accountsList = new ArrayList();
>    while( rs.next() )
>          {
>                           acc = new AccountDO();
>                                  acc.setAccountname(rs.getString(1));
>                                  acc.setAccountowner(rs.getString(2));
>                            accountsList.add(acc);
>          }
>
> Snippet from the action file
>
> ArrayList accountsList = null;
>
>          try
>          {
>              ServletContext servletContext =
servlet.getServletContext();
>              DataSource dataSource =
> (DataSource)servletContext.getAttribute(Action.DATA_SOURCE_KEY);
>              Connection conn = dataSource.getConnection();
>              Statement stmt = conn.createStatement();
>              AccountService account = new AccountService(conn, stmt,
> session, dataBaseName);
>              accountsList = account.retreiveAccount();
>          }
>
> But , when I try to retrieve the data in my jsp, I always get the
>
>
> "Cannot find bean accountsList in any scope" exception.
>
>
> This is what I have in my jsp code
>
> <logic:iterate id="acc" name="accountsList">
> <tr align="left">
> <td>
> <bean:write name="acc" property="accountname" />
> </td>
> <td>
> <bean:write name="acc" property="accountowner" />
> </td>
> </tr>
> </logic:iterate>
>
> Any help appreciated.
>
> TIA
> Richie
>
> "To achieve all that is possible, one must attempt the impossible"




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

"To achieve all that is possible, one must attempt the impossible"




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



Reply via email to