Dear All,
I have the following code to read data from database through the Struts. The web page is up and running good but I find problems in displaying the data.
Whenever changes are made to the database, the changes are not reflected on the webpage, so I write a few lines of code to test the HB config and connection, it's fine while running in standalone java application that shows the actual number of returned records.
It seems that the struts caches / always uses the same DAO instance or something else. Please help and thank you very much.
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ItemsDAO itemsDAO = new ItemsDAO();
System.out.println(itemsDAO.findAll().size());
return mapping.findForward("success");
}
public static void main(String[] argv) {
ItemsDAO itemsDAO = new ItemsDAO();
System.out.println(itemsDAO.findAll().size());
}
|