Java Reference
In-Depth Information
String query = "select from " +
Opportunity.class.getName() + " where accountId ==
"+request.getParameter("accountId");
List<Opportunity> opportunities = (List<Opportunity>)
pm.newQuery(query).execute();
// pass the list to the jsp
request.setAttribute("account", a);
// pass the list to the jsp
request.setAttribute("opportunities", opportunities);
// forward the request to the jsp
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/accountDisplay.jsp");
dispatcher.forward(request, response);
// display the create new opportunity form
} else
if(request.getParameter("action").equals("opportunityCreate")) {
Key k =
KeyFactory.createKey(Account.class.getSimpleName(), new
Integer(request.getParameter("accountId")).intValue());
Account a = pm.getObjectById(Account.class, k);
// pass the account name to the jsp
request.setAttribute("accountName", a.getName());
// forward the request to the jsp
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("/opportunityCreate.jsp");
dispatcher.forward(request, response);
// process the new opportunity creation and send the user to
the account display page
} else
if(request.getParameter("action").equals("opportunityCreateDo")) {
Date closeDate = new Date();
// try to parse the date
try {
DateFormat df = DateFormat.getDateInstance(3);
Search WWH ::




Custom Search