Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 80582 invoked from network); 25 Oct 2005 16:00:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Oct 2005 16:00:42 -0000 Received: (qmail 63195 invoked by uid 500); 25 Oct 2005 15:59:37 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 63164 invoked by uid 500); 25 Oct 2005 15:59:36 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 63142 invoked by uid 99); 25 Oct 2005 15:59:36 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2005 08:59:36 -0700 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_WHOIS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of Joshua.Davies@travelocity.com designates 151.193.220.17 as permitted sender) Received: from [151.193.220.17] (HELO sgtulmg01-out.sabre.com) (151.193.220.17) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2005 08:59:30 -0700 Received: from unknown (HELO sghdqbh01.Global.ad.sabre.com) ([10.12.64.16]) by sgtulmg01-out.sabre.com with ESMTP; 25 Oct 2005 10:59:11 -0500 X-ExtLoop1: From 10.12.64.16 X-IronPort-AV: i="3.97,250,1125896400"; d="scan'208,217"; a="710754705:sNHT61997120" Received: from sghdqms02.Global.ad.sabre.com ([10.12.64.8]) by sghdqbh01.Global.ad.sabre.com with Microsoft SMTPSVC(6.0.3790.0); Tue, 25 Oct 2005 10:59:10 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: help in using a custom API Date: Tue, 25 Oct 2005 10:59:09 -0500 Message-ID: <06CCD285B81FAA48AE6A8BE92E2BD87B081B7CB0@sghdqms02.Global.ad.sabre.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: help in using a custom API Thread-Index: AcXZGsoj0wrfa9QRR1GLzPLEZrBYDwAYA4Kw From: "Davies, Joshua" To: "Tomcat Users List" X-OriginalArrivalTime: 25 Oct 2005 15:59:10.0251 (UTC) FILETIME=[0971A7B0:01C5D97D] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I'd avoid calling a third-party API from a JSP at all. Instead, I'd recommend using an MVC-style approach (http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html), like this: public class ApiCallingServlet extends HttpServlet { public void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { try { ApiResults results =3D api.call( req.getParameter( "apiParam1" ), =09 req.getParameter( "apiParam2" ) ); =09 req.setAttribute( "meaningfulParameter1", results.getMeaningfulParameter1( ) ); req.setAttribute( "meaningfulParameter2", results.getMeaningfulParameter2( ) ); ServletContext sc =3D getServletContext( ); RequestDispatcher rd =3D sc.getRequestDispatcher( "/jsp/api/ApiUser.jsp" ); rd.forward( req, res ); } catch ( ApiGeneratedException e ) { throw new ServletException( e ); } } }=20 /jsp/api/ApiUser.jsp: ...

The API gave meaningful result 1 of <%=3D request.getAttribute( "meaningfulParameter1" ) %>

The API gave meaningful result 2 of <%=3D request.getAttribute( "meaningfulParameter2" ) %>

... =20 This way the example code can be pretty much copied directly into the servlet's doGet or doPost method and modified from there. -----Original Message----- From: Jayel Villamin [mailto:jayel@deakin.edu.au]=20 Sent: Monday, October 24, 2005 11:15 PM To: users@tomcat.apache.org Subject: help in using a custom API Hi. We have bought an IT customer management system to management the=20 helpdesk. It came with a JAVA API. Here are is thin POS guide and some examples. The problem with the=20 examples is that is uses plain Java (Java run from the commandline).=20 But I need to use it from within a browser. Since my Java is at a=20 beginner's level, I have been reading some online books were my work=20 has accessed to (like O'rielly's JavaServer Pages, 3rd Edition). I=20 have put the API jar file in /shared/lib but I cannot find a way on=20 how to access it from a jsp page. If anyone can point me to the right direction on how to use this API=20 from within a JSP. I would really appreciate it. Thank you. Jayel Villamin, Web Programmer, Information Technology Services Division + Deakin University Geelong Victoria 3217 Australia. ( 03 5227 8688 International: +61 3 5227 8688 ( 03 5227 8866 International: +61 3 5227 8866 + jayel@deakin.edu.au : http://www.deakin.edu.au Deakin University CRICOS Provider Code 00113B ##################################### Important Notice: The contents of this email transmission, including=20 any attachments, are intended solely for the named addressee and are=20 confidential; any unauthorized use, reproduction or storage of the=20 contents and any attachments is expressly prohibited. If you have=20 received this transmission in error, please delete it and any=20 attachments from your system immediately and advise the sender by=20 return email or telephone. Deakin University does not warrant that=20 this email and any attachments are error or virus free. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org