Author: gawor Date: Thu Aug 2 18:52:02 2007 New Revision: 562310 URL: http://svn.apache.org/viewvc?view=rev&rev=562310 Log: show results on the same page Removed: geronimo/samples/trunk/samples/jaxws-calculator/jaxws-calculator-war/src/main/webapp/addResult.jsp Modified: geronimo/samples/trunk/samples/jaxws-calculator/jaxws-calculator-war/src/main/webapp/add.jsp Modified: geronimo/samples/trunk/samples/jaxws-calculator/jaxws-calculator-war/src/main/webapp/add.jsp URL: http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/jaxws-calculator/jaxws-calculator-war/src/main/webapp/add.jsp?view=diff&rev=562310&r1=562309&r2=562310 ============================================================================== --- geronimo/samples/trunk/samples/jaxws-calculator/jaxws-calculator-war/src/main/webapp/add.jsp (original) +++ geronimo/samples/trunk/samples/jaxws-calculator/jaxws-calculator-war/src/main/webapp/add.jsp Thu Aug 2 18:52:02 2007 @@ -16,7 +16,7 @@ --> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> -<%@ page import="java.net.URL,javax.xml.namespace.QName,javax.xml.ws.Service,org.apache.geronimo.samples.jws.Calculator"%> +<%@ page import="javax.naming.InitialContext,javax.xml.ws.Service,org.apache.geronimo.samples.jws.Calculator"%> Apache Geronimo Sample Application - JAX-WS Calculator @@ -27,10 +27,38 @@

This is a JAX-WS web service sample application. Please type the value 1 and value 2 below to see the add result.

-
- Input 1: + Input 2: + + Value 1: Value 2:
+
+<% + String value1 = request.getParameter( "value1" ); + String value2 = request.getParameter( "value2" ); + System.out.println(value1 + " " + value2); + + if (value1 != null && value1.trim().length() > 0 && + value2 != null && value2.trim().length() > 0) { + + out.println("

"); + + try { + int v1 = Integer.parseInt(value1); + int v2 = Integer.parseInt(value2); + + InitialContext ctx = new InitialContext(); + Service service = (Service)ctx.lookup("java:comp/env/services/Calculator"); + Calculator calc = service.getPort(Calculator.class); + int sum = calc.add(v1, v2); + out.println("Result: " + v1 + " + " + v2 + " = " + sum); + } catch ( Exception e ) { + e.printStackTrace(); + out.println("Error: " + e.getMessage()); + } + + out.println("

"); + } +%>