file:1.jsp
InitialContext ic = new InitialContext();
Object obj = initialcontext.lookup("ejb/ShoppingCart");
ShoppingCartHome sch = (ShoppingCartHome)
PortableRemoteObject.narrow(obj, abayi.ShoppingCartHome.class);
ShoppingCart sc=sch.create();
/
*sc.begin() this method is include the jta "UserTransaction
*Object in internal" and this begin method will invoke the
*UserTransaction.begin this method
/
sc.begin();
session.setAttribute("sc",sc);
response.sendRedirect("2.jsp");
file:2.jsp
ShoppingCart sc=(ShoppingCart)session.getAttribute("sc");
String data=request.getParameter("item");
if(data!=null)
sc.add(data);
%>
<%
file:3.jsp
<%
ShoppingCart sc=(ShoppingCart)session.getAttribute("sc");
if(request.getParameter("COMMAND").equals("COMMIT"))
{
/
*this commit method is include the jta commit method.
*
/
sc.commit();
}
else
{
//this method is invoke the jta rollback method.
sc.rollback();
}
response.sendRedirect("index.html");
%>
==========================================================
my problem is will this code will get error .