а запиту Всі запити для перерахованих у таблиці 2 URL відображаються в Web-компонент dispatcher, який реалізується сервлетом Dispatcher:
class Dispatcher extends HttpServlet {
public void doPost (HttpServletRequest request,
HttpServletResponse response) {
...
String selectedScreen = request.getServletPath ();
request.setAttribute ("selectedScreen", selectedScreen);
BeanManager beanManager = getServletContext (). getAttribute (
"beanManager");
...
if (selectedScreen.equals ("/ accountHist")) {
...
} else if (selectedScreen.equals ("/ transferAck")) {
String fromAccountId =
request.getParameter ("fromAccountId");
String toAccountId =
request.getParameter ("toAccountId");
if ((fromAccountId == null) | | (toAccountId == null)) {
request.setAttribute ("selectedScreen", "/ error");
request.setAttribute ("errorMessage",
messages.getString ("AccountError"));
} else {
TransferBean transferBean = new TransferBean ();
request.setAttribute ("transferBean",
transferBean);
transferBean.setMessages (messages);
transferBean.setFromAccountId (fromAccountId);
transferBean.setToAccountId (toAccountId);
transferBean.setBeanManager (beanManager);
try {
transferBean.setTransferAmount (new
BigDecimal (request.
getParameter ("transferAmount")));
String errorMessage = transferBean.populate ();
if (errorMessage! = null) {
request.setAttribute ("selectedScreen", "/ error");
request.setAttribute ("errorMessage",
errorMessage);
}
} catch (NumberFormatException e) {
request.setAttribute ("selectedScreen", "/ error");
request.setAttribute ("errorMessage",
messages.getString ("AmountError"));
}
}
...
try {
request.getRequestDispatcher ("/ template.jsp").
forward (request, response);
} catch (Exception e) {
}
}
}
<...