Tamino API4Java and JSP

Hi all, I’ve been doing a few things with the Tamino API for Java, and it works perfectly, but I would like to know if there is any problem using this API in a JSP file.

I have created a JSP filed, and this is part of the code:


<%@ page contentType=“text/html;” language=“java” import =“com.softwareag.tamino.db.API.accessor.TXMLObjectAccessor,com.softwareag.tamino.db.API.accessor.TQuery,com.softwareag.tamino.db.API.connection.,com.softwareag.tamino.db.API.accessor.TXQuery,com.softwareag.tamino.db.API.accessor.TQueryException,com.softwareag.tamino.db.API.accessor.TAccessorException,com.softwareag.tamino.db.API.accessor.TSystemAccessor,com.softwareag.tamino.db.API.accessor.TInsertException,com.softwareag.tamino.db.API.accessor.TDeleteException,com.softwareag.tamino.db.API.accessor.TAccessLocation,com.softwareag.tamino.db.API.connection.,com.softwareag.tamino.db.API.objectModel.,com.softwareag.tamino.db.API.objectModel.jdom.,com.softwareag.tamino.db.API.response.,org.jdom.,org.jdom.input.,org.jdom.output.,java.io.,java.util.”%>

<%

String anyo=request.getParameter(“anyo”);
String mes=request.getParameter(“mes”);
String dia=request.getParameter(“dia”);
String dirVentas=request.getParameter(“dirVentas”);
String comercial=request.getParameter(“comercial”);
String empresa=“1”;
String level=“any”;
String leveli=“1”;
String qmes=“”;
String qdia=“”;
String UrlBase = “”;

String DATABASE_URI=“http://localhost:8787/tamino/texsamart”;
String COLLECTION = “XMLMart”;

TConnection connection = TConnectionFactory.getInstance().newConnection(DATABASE_URI);

(…more code…)

%>





Hi,
It is definitely possible to use the TaminoAPI4J in a JSP page, but you need the correct jar files in your webapp’s WEB-INF/lib directory. Specifically you need:
jdom, log4j, TaminoAPI4J, TaminoJCA, xercesImpl and xmlParserAPIs jar files. This little test page works for me - could you please try it.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;" language="java" 
  import="com.softwareag.tamino.db.api.connection.*" %>
<%
String connected = "Not connected"; 
String DATABASE_URI="http://localhost:1080/tamino/employeedb";
String COLLECTION = "Tax";
try {
  TConnection connection = TConnectionFactory.getInstance().newConnection(DATABASE_URI);
  connected = "Connected"; 
}
catch (Exception e) {
  out.write ("Exception: " + e);
  e.printStackTrace();
}  
%>
Status:
<%= connected %>
</body>
</html>  

Could anyone help me with my problem? Thank you in advance.

I have included the following statement in my jsp:
TConnection connection = TConnectionFactory.getInstance().newConnection(DATABASE_URI, USERNAME, PASSWORD);

I have imported the following: com.softwareag.tamino.db.API.connection.*

But the JSP generated the following error:
org.apache.jasper.JasperException
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:534)