You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Michael R. Schwab" <Mi...@qcc.ca> on 2002/09/03 19:55:57 UTC
error accessing a context-param from web.xml
Hi,
I am fairly new to using Tomcat. I am attempting to use a centralized
location to define the MySQL access configuration info. It is my
understanding that the /WEB-INF/web.xml is the best location to store
this info.
I have defined a set of JDBC parameters such as the driver info shown
below in my web.xml file for the web app:
<context-param>
<param-name>jdbc.driver</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</context-param>
...
Within a JSP file, I attempt to get the parameter via the implicit
application variable:
<sql:setDataSource
driver="<%= application.getInitParameter("jdbc.driver") %>"
url="<%= application.getInitParameter("jdbc.url") %>"
user="<%= application.getInitParameter("jdbc.username")" %>"
password="<%= application.getInitParameter("jdbc.password")" %>"
var="db" />
Unfortunately, I receive the following error:
org.apache.jasper.compiler.ParseException:
/search-all-cables.jsp(10,56) Attribute jdbc.driver has no value
at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563)
...
FYI, I am using Tomcat 4.0.4 with J2SDK 1.4.0_01.
Thank you,
Michael
--
Michael R. Schwab
Design Engineer
QCC Communications Corp.
Michael.Schwab-tomcat-user@qcc.ca
Voice: (306) 249-0220
Fax: (306) 249-5128
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: error accessing a context-param from web.xml
Posted by Irina Lishchenko <il...@lishchenko.de>.
Probably your task is better to accomplish with JNDI Resources,
http://localhost:8080/tomcat-docs/jndi-resources-howto.html
That is more "elegant" solution, and that is for what JNDI Resources are
designed
Or are there any other reasons why do you want to carry out this
context-param way?
ilis
On Tuesday 03 September 2002 19:55, you wrote:
> Hi,
>
> I am fairly new to using Tomcat. I am attempting to use a centralized
> location to define the MySQL access configuration info. It is my
> understanding that the /WEB-INF/web.xml is the best location to store
> this info.
>
> I have defined a set of JDBC parameters such as the driver info shown
> below in my web.xml file for the web app:
>
> <context-param>
> <param-name>jdbc.driver</param-name>
> <param-value>com.mysql.jdbc.Driver</param-value>
> </context-param>
> ...
>
>
> Within a JSP file, I attempt to get the parameter via the implicit
> application variable:
>
> <sql:setDataSource
> driver="<%= application.getInitParameter("jdbc.driver") %>"
> url="<%= application.getInitParameter("jdbc.url") %>"
> user="<%= application.getInitParameter("jdbc.username")" %>"
> password="<%= application.getInitParameter("jdbc.password")" %>"
> var="db" />
>
> Unfortunately, I receive the following error:
>
> org.apache.jasper.compiler.ParseException:
> /search-all-cables.jsp(10,56) Attribute jdbc.driver has no value
> at
> org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563
>) ...
>
> FYI, I am using Tomcat 4.0.4 with J2SDK 1.4.0_01.
>
> Thank you,
> Michael
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: error accessing a context-param from web.xml
Posted by "Michael R. Schwab" <Mi...@qcc.ca>.
Thanks ilis and jon,
I'll take a look at JNDI.
Michael
On Wed, Sep 04, 2002 at 10:34:10AM +0100, jon wingfield wrote:
> The error you are getting is the JSP parser mistaking the data "<%=
> application.getInitParameter(" as the value for the driver parameter of the
> sql:setDataSource tag. Then it reports a parsing error as the next parameter
> is sees is jdbc.driver with no '=', and hence no value, after it.
>
> If you really want to set up a datasource this way try:
>
> <sql:setDataSource
> driver='<%= application.getInitParameter("jdbc.driver") %>'
> url='<%= application.getInitParameter("jdbc.url") %>'
> user='<%= application.getInitParameter("jdbc.username")" %>'
> password='<%= application.getInitParameter("jdbc.password")" %>'
> var='db' />
>
>
> Note the single quotes. This should work as there's nothing wrong with how
> you are accessing the init params.
>
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html
>
> -----Original Message-----
> From: Michael R. Schwab [mailto:Michael.Schwab-tomcat-user@qcc.ca]
> Sent: 03 September 2002 18:56
> To: Tomcat Users List
> Subject: error accessing a context-param from web.xml
>
>
> Hi,
>
> I am fairly new to using Tomcat. I am attempting to use a centralized
> location to define the MySQL access configuration info. It is my
> understanding that the /WEB-INF/web.xml is the best location to store
> this info.
>
> I have defined a set of JDBC parameters such as the driver info shown
> below in my web.xml file for the web app:
>
> <context-param>
> <param-name>jdbc.driver</param-name>
> <param-value>com.mysql.jdbc.Driver</param-value>
> </context-param>
> ...
>
>
> Within a JSP file, I attempt to get the parameter via the implicit
> application variable:
>
> <sql:setDataSource
> driver="<%= application.getInitParameter("jdbc.driver") %>"
> url="<%= application.getInitParameter("jdbc.url") %>"
> user="<%= application.getInitParameter("jdbc.username")" %>"
> password="<%= application.getInitParameter("jdbc.password")" %>"
> var="db" />
>
> Unfortunately, I receive the following error:
>
> org.apache.jasper.compiler.ParseException:
> /search-all-cables.jsp(10,56) Attribute jdbc.driver has no value
> at
> org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563)
> ...
>
> FYI, I am using Tomcat 4.0.4 with J2SDK 1.4.0_01.
>
> Thank you,
> Michael
> --
> Michael R. Schwab
> Design Engineer
> QCC Communications Corp.
> Michael.Schwab-tomcat-user@qcc.ca
> Voice: (306) 249-0220
> Fax: (306) 249-5128
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
--
Michael R. Schwab
Design Engineer
QCC Communications Corp.
Michael.Schwab@qcc.ca
Voice: (306) 249-0220
Fax: (306) 249-5128
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: error accessing a context-param from web.xml
Posted by jon wingfield <jo...@mkodo.com>.
The error you are getting is the JSP parser mistaking the data "<%=
application.getInitParameter(" as the value for the driver parameter of the
sql:setDataSource tag. Then it reports a parsing error as the next parameter
is sees is jdbc.driver with no '=', and hence no value, after it.
If you really want to set up a datasource this way try:
<sql:setDataSource
driver='<%= application.getInitParameter("jdbc.driver") %>'
url='<%= application.getInitParameter("jdbc.url") %>'
user='<%= application.getInitParameter("jdbc.username")" %>'
password='<%= application.getInitParameter("jdbc.password")" %>'
var='db' />
Note the single quotes. This should work as there's nothing wrong with how
you are accessing the init params.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html
-----Original Message-----
From: Michael R. Schwab [mailto:Michael.Schwab-tomcat-user@qcc.ca]
Sent: 03 September 2002 18:56
To: Tomcat Users List
Subject: error accessing a context-param from web.xml
Hi,
I am fairly new to using Tomcat. I am attempting to use a centralized
location to define the MySQL access configuration info. It is my
understanding that the /WEB-INF/web.xml is the best location to store
this info.
I have defined a set of JDBC parameters such as the driver info shown
below in my web.xml file for the web app:
<context-param>
<param-name>jdbc.driver</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</context-param>
...
Within a JSP file, I attempt to get the parameter via the implicit
application variable:
<sql:setDataSource
driver="<%= application.getInitParameter("jdbc.driver") %>"
url="<%= application.getInitParameter("jdbc.url") %>"
user="<%= application.getInitParameter("jdbc.username")" %>"
password="<%= application.getInitParameter("jdbc.password")" %>"
var="db" />
Unfortunately, I receive the following error:
org.apache.jasper.compiler.ParseException:
/search-all-cables.jsp(10,56) Attribute jdbc.driver has no value
at
org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:563)
...
FYI, I am using Tomcat 4.0.4 with J2SDK 1.4.0_01.
Thank you,
Michael
--
Michael R. Schwab
Design Engineer
QCC Communications Corp.
Michael.Schwab-tomcat-user@qcc.ca
Voice: (306) 249-0220
Fax: (306) 249-5128
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>