Java Reference
In-Depth Information
// display the create new account form
} else
if(request.getParameter("action").equals("accountCreate")) {
response.sendRedirect("/accountCreate.jsp");
// process the new account creation and send the user to the
account display page
} else
if(request.getParameter("action").equals("accountCreateDo")) {
// create the new account
Account a = new Account(
request.getParameter("name"),
request.getParameter("billingCity"),
request.getParameter("billingState"),
request.getParameter("phone"),
request.getParameter("website")
);
// persist the entity
try {
pm.makePersistent(a);
} finally {
pm.close();
}
response.sendRedirect("telesales?action=accountDisplay&accountId="+a.getId(
));
// display the account details and opportunities
} else
if(request.getParameter("action").equals("accountDisplay")) {
// fetch the account
Key k =
KeyFactory.createKey(Account.class.getSimpleName(), new
Integer(request.getParameter("accountId")).intValue());
Account a = pm.getObjectById(Account.class, k);
// query for the opportunities
Search WWH ::




Custom Search