http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

But, the particular error you are currently getting is your web.xml is not valid with respect to the dtd.

-Tim

Terje Hops� wrote:
Hi, I am trying to setup Tomcat according to the book "JavaServer Pages" page
157. But all I get when starting up tomcat is errors. I also tried JNDI but
that was less understandable so I will first try this simple setup, which I
cant understand why failes.
Anyone got a hint on what I have to to? I have a standard Tomcat 4.1.18 and JSTL installed.
- Terje
Here is my setup in web.xml:
-------------------------
<context-param>
<param-name>
javax.servlet.jsp.jstl.sql.DataSource
</param-name>
<param-value>
jdbc:mysql://db.server.no:3306/myuser,com.mysql.jdbc.Driver,myusername,mypas
sword
</param-value>
</context-param>
-------------------------
The error when starting tomcat is:
Starting service Tomcat-Standalone
Apache Tomcat/4.1.18
29.mai.2003 13:28:37 org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 28 column 11: The content of element type
"web-app" must match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref
*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must
match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,fil
ter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mappin
g*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,se
curity-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-loca
l-ref*)".
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHand
lerWrapper.java:232)
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHand
lerWrapper.java:232)
at
org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:17
3)
at
org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:37
1)
....
----------------------------------
In my jsp-file this works fine but I want to put the datasource parameters
into web.xml instead of each jsp-file where I access a database.
---
<sql:setDataSource var="ex" scope="application"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://db.server.no:3306/myuser"
user="myusername"
password="mypassword"
/>
<sql:query var="init"
dataSource="${ex}"
sql="select name from adress"
/>
<c:forEach items="${init.rows}" var="row">
<c:out value="${row.name}" /><br>
</c:forEach>
---




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to