You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mickael Cappozzo <m....@netunion.com> on 2003/09/04 10:49:38 UTC
dbtags and tomcat 4.1
Hello,
We wanted to migrate from tomcat 4.0 to tomcat 4.1.24, but we encoutered
the following problem:
When a query return nothing, the query's body is displayed on the JSP
page if the page contains another query returning something.
example:
In the table Users, we don't have user with username "toto" and with
have a user with username "test" if we write the following in a jsp page:
<sql:statement id="getUserTest" conn="myConn">
<%-- THIS QUERY RETURNS THE UserID --%>
<sql:query>
SELECT UserID
FROM Users
WHERE username = 'test'
</sql:query>
<sql:resultSet id="getUserIDTest">
<sql:getNumber position="1" to="userIDTest"/>
</sql:resultSet>
</sql:statement>
<sql:statement id="getUserToto" conn="myConn">
<%-- THIS QUERY IS EMPTY --%>
<sql:query>
SELECT UserID
FROM Users
WHERE username = 'toto'
</sql:query>
<sql:resultSet id="getUserIDToto">
<sql:getNumber position="1" to="userIDToto"/>
</sql:resultSet>
</sql:statement>
On the page we saw:
SELECT UserID FROM Users WHERE username = 'toto'
We noticed the following: if we add an attribute: loop, scope or another
existing attribute in the resultSet tag in the empty query, the query is
not displayed on the JSP page. However if we add this attribute to each
resultSet tag, the query is displayed...
Any idea???
--
Mickaël Cappozzo
m.cappozzo@netunion.com
-------------------------------------------
NetUnion SARL
Avenue de Villamont, 19
1005 Lausanne
SWITZERLAND
Phone: (+41) 21 351 53 66
http://www.netunion.com
-------------------------------------------
Re: dbtags and tomcat 4.1
Posted by Mickael Cappozzo <m....@netunion.com>.
Hello,
Thank you for your replies. I will have a look to Struts later, I think
it is too late for this project. Furthermore, I got a solution to my
problem, and the solution was to set the parameter enablePooling to
false in my config file. But I still have a problem: we followed the
steps in the following page:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html to
pre-compile all the JSP files using ant before deploying our web
application, in this case do you know how I can set the enablePooling to
false in order to compile the files correctly? Or is there a way to do
the same thing but with tomcat 4.0.x ?
Regards.
Mickaël.
Nikola Milutinovic wrote:
>>You could use jstl instead, but from my experience SQL in the jsp is
>>more trouble then it is worth and causes imense headaches
>>when you want to do something complicated. Just a suggestion but it
>>could be a good time for you to have a look at migrating to Struts or
>>some other framework which suits your needs :D
>>
>>
>
>In other words, when JSP becomes too complex, it is time to transform your design into J2EE blueprint (which is endorsed by Struts). Each request can have three components handling it:
>
>- incoming JSP: packaging of request parameters into beans, attaching them to request scope
>- main servlet: does all the work of "business logic" and attaches resulting beans/variables to request scope
>- outgoing JSP: performs "presentation logic", based on data supplied to it via request scope.
>
>Nix.
>
Re: dbtags and tomcat 4.1
Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
> You could use jstl instead, but from my experience SQL in the jsp is
> more trouble then it is worth and causes imense headaches
> when you want to do something complicated. Just a suggestion but it
> could be a good time for you to have a look at migrating to Struts or
> some other framework which suits your needs :D
In other words, when JSP becomes too complex, it is time to transform your design into J2EE blueprint (which is endorsed by Struts). Each request can have three components handling it:
- incoming JSP: packaging of request parameters into beans, attaching them to request scope
- main servlet: does all the work of "business logic" and attaches resulting beans/variables to request scope
- outgoing JSP: performs "presentation logic", based on data supplied to it via request scope.
Nix.
Re: dbtags and tomcat 4.1
Posted by Kwok Peng Tuck <pe...@makmal.net>.
If you poke around in the mailling list for the taglib project you will
find a mail or two about this,
if I remember correctly had something to do with the tag not confrming
to the taglib specification that tomcat provides.
You could use jstl instead, but from my experience SQL in the jsp is
more trouble then it is worth and causes imense headaches
when you want to do something complicated. Just a suggestion but it
could be a good time for you to have a look at migrating to Struts or
some other framework which suits your needs :D
Mickael Cappozzo wrote:
> Hello,
>
> We wanted to migrate from tomcat 4.0 to tomcat 4.1.24, but we
> encoutered the following problem:
> When a query return nothing, the query's body is displayed on the JSP
> page if the page contains another query returning something.
>
> example:
> In the table Users, we don't have user with username "toto" and with
> have a user with username "test" if we write the following in a jsp page:
>
> <sql:statement id="getUserTest" conn="myConn">
> <%-- THIS QUERY RETURNS THE UserID --%>
> <sql:query>
> SELECT UserID
> FROM Users
> WHERE username = 'test'
> </sql:query>
> <sql:resultSet id="getUserIDTest">
> <sql:getNumber position="1" to="userIDTest"/>
> </sql:resultSet>
> </sql:statement>
>
> <sql:statement id="getUserToto" conn="myConn">
> <%-- THIS QUERY IS EMPTY --%>
> <sql:query>
> SELECT UserID
> FROM Users
> WHERE username = 'toto'
> </sql:query>
> <sql:resultSet id="getUserIDToto">
> <sql:getNumber position="1" to="userIDToto"/>
> </sql:resultSet>
> </sql:statement>
>
> On the page we saw:
> SELECT UserID FROM Users WHERE username = 'toto'
>
> We noticed the following: if we add an attribute: loop, scope or
> another existing attribute in the resultSet tag in the empty query,
> the query is not displayed on the JSP page. However if we add this
> attribute to each resultSet tag, the query is displayed...
>
> Any idea???
>