I have a flex form which has two httpservice.one which accesses data from the servlet and one which stores data into another servlet. Firstly when im accessing the data from the servlet that is working and the storing part is also working..so when i again call the access servlet im not getting the updated display..the access servlet is not getting called again.. This is my access servlet code
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException
{
PrintWriter out=response.getWriter();
try
{
response.setContentType("text/html");
String gradeName=request.getParameter("tx1");
System.out.println(gradeName);
gradeName=gradeName.toUpperCase();
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
Grade g=new Grade(gradeName);
session.save(g);
tx.commit();
session.close();
//HibernateUtil.shutdown();
out.println("Added Successfully");
}
catch(ConstraintViolationException e)
{
out.println("Grade is already Present");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
this is my display servlet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Session session = HibernateUtil.getSessionFactory().openSession();
Transaction tx=session.beginTransaction();
Query q=session.createQuery("from Grade");
List l=q.list();
Grade t;
PrintWriter out=response.getWriter();
response.setContentType("text/xml");
String str="<?xml version=\"1.0\" encoding=\"utf-8\"?><top>";
for(int i=0;i<l.size();i++)
{
t=(Grade)l.get(i);
str+="<inside><id>"+t.getGradeId()+"</id>";
str+="<name>"+t.getGradeName()+"</name></inside>";
}
str+="</top>";
out.println(str);
System.out.println("yattaa->"+str);
tx.commit();
session.close();
HibernateUtil.shutdown();