Hi ,
In my program which i am trying to implement with MVC (
Struts)
i have created an Action class that fetches the data from database and then puts it on request using setAttribute on Request object and forwards it to my View which is a
jsp file. The reason why i am using Action class is so as to get the DataSource object thats been configured in my struts-config.xml file easily. Is it okay to do it like this?
So the flow of this module is like this:
<html:link> calls Action class which setAttributes the data onto request and then forwards it to the next jsp using mapping.findForward("res"); method.
-----
Then in the same program i have another Action class which actually updates the same database but after updating the database is supposed to again get data from the database and display the existing data plus the new data in that same jsp .
how can i call the my first Action class which gets data from database from my second Action class which updates the data ?
And so i wanted to know if i should use a
Java class for getting /setting data from/to the database? and call these from the Actions ? but then how will i get my DataSource object which is defined in struts-config.xml file, in this helper java class?
-thanks