Java Reference
In-Depth Information
com.acme.conversion.currency.Currency,
java.text.DecimalFormat"%>
<%
String startCurrStr = request.getParameter("startingCurrency");
String endCurrStr = request.getParameter("endingCurrency");
String amountStr = request.getParameter("amount");
double amount = Double.parseDouble(amountStr);
DecimalFormat df = new DecimalFormat("0.00");
CurrencyExchangeService service =
CurrencyExchangeServiceFactory.getService();;
double rate = service.requestCurrentRate(startCurrStr,
endCurrStr);
%>
<html>
<head>
<title>ACME Currency Converter - Results</title>
</head>
<body>
<h1>ACME Currency Converter - Results</h1>
<p>
Here are the results of your currency conversion. Enjoy!
</p>
<p>
Starting currency: <%= startCurrStr %><br>
Ending currency: <%= endCurrStr %><br>
Amount converted: <%= df.format(amount) %><br>
Exchange rate: <%= df.format(rate) %><br>
Amount after exchange: <%= df.format(amount * rate) %><br>
</p>
<p>
<a href="index.jsp">Return to main page</a>
</p>
</body>
</html>
With this JSP implemented, you should have a working web application front end.
Running and debugging an application like this are covered later in this chapter.
11.2 Working with EJBs
The J2EE platform provides clear separation of architectural elements of the
enterprise application; it consists of the client layer, web layer, and EJB layer.
IDEA supports specific module types for each of the layers. In previous chap-
ters, we discussed using Java modules, which can be used for development of
 
 
 
Search WWH ::




Custom Search