Java Reference
In-Depth Information
L ISTING 6.6
Continued
// Read the stored object and downcast it back to
// a Order
order = (Order)is.readObject();
is.close();
}
catch (IOException e) {
System.err.println(e.getMessage());
}
catch (ClassNotFoundException ce) {
System.err.println(ce.getMessage());
}
return order;
}
void jGetStatusButton_actionPerformed(ActionEvent event) {
try {
// This is where the OrderStatus Transaction begins
Order order = new Order();
order.setOrder(jOrderTextField.getText());
// create our URL
URL url = new URL(“http://localhost/djs” +
“/servlet/OrderStatusServlet”);
// Open our URLConnection
System.err.println(“Opening Connection.”);
URLConnection con = url.openConnection();
// Write the Order
writeOrder(con, order);
// Get the Order from the response,
// after the status has been checked, and print it out.
Order response_order = readOrder(con);
if ( response_order != null ) {
// Put the status String returned from the
// OrderStatusServlet into the jTextArea Object
jStatusResultTextArea.setText(
Search WWH ::




Custom Search