Hi,

In the following (SEE CODE BELOW) when I attempt to inititialize

getDataSource(request) in the Tiles Controller execute method it
causes a null in the fowarding JSP which looks for the string "TEST"
initialized by this:

 tilesContext.putAttribute("TEST" , "TEST");

If I remove the getDataSource(request) then the "TEST" string
 tilesContext.putAttribute("TEST" , "TEST");
displays correctly in the fowarding jsp.

It appears that the getDataSource(request); does not work
in the tilesController execute but works in the action execute.

Does anyone know why?

In addition the problem I have is I want to query the database for data
and put it in the tiles controller execute so I can pass it to the fowarding
JSP.

So I could query the database in the Action execute() and pass the data to
the
tiles controller execute() and display in the fowarding jsp.

I have tried declaring a:
static private String mystring;  outside the Action execute() and the tiles
controller execute()

but when I try to update the string in the Action execute() the string
(mystring) does not show
the new string value in the tiles controller execute() method.


In summary either the database query is performed in the Action execute and
data fowarded in the Tiles Controller execute()

or

The database query is performed in the Tiles Controller execute() and the
query results will already by available to be fowarded to the JSP.

 BOTH DO NOT WORK!


HERE IS THE CODE:

public class LoadUserCategoriesController extends Action implements
Controller{

            static private String myString = "string";

public ActionForward execute( ComponentContext tilesContext,
                        ActionMapping mapping,
                        ActionForm form,
                        HttpServletRequest request,
                        HttpServletResponse response) throws Exception
{
                //Data source works here but require results to be in
Controller execute
                myString = "newstring";



}
        public void execute(ComponentContext tilesContext,
                HttpServletRequest request,
                HttpServletResponse response,
                ServletContext servletContext)throws Exception{

                Statement stmt = null;
                ResultSet rs = null;
                DataSource dataSource;
                Connection conn=null;

                try {
                        dataSource = getDataSource(request);
                }.............................


                //myString does not show "newString" here.

                 tilesContext.putAttribute("TEST" , "TEST");   //only works
if I remove the dataSource = getDataSource(request) statement.




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

Reply via email to