tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Nelson" <Andrew.Nel...@hsc.utah.edu>
Subject Re: Search Engine Queries
Date Fri, 04 Jun 2004 15:04:51 GMT
If you don't know java it could be a bit painful but there is a really
cool example in a jdbc book I just read.  Database Programming with JDBC
and Java   published by O'Reilly.  In chapter 10 near the end there is a
section on searches.

I think I've seen the same thing on the web somewhere as an example
chapter.

Anyhow I think it is really cool.  You could probably extend it one
more step and make a tag of it.  I might even be willing to help with
this task.

//Andy 

>>> werner@sonoma.edu 6/3/2004 9:29:50 AM >>>
I know this might not be a pure JSTL thing, but if anyone could offer 
some pointers, I'd appreciate it:


I've got a search page thing going on in JSP (JSTL), and I want to be 
able to search on any of the fields that are entered, basically an AND

filter. So as to not create dynamic SQL queries, I use the below SQL
code:

<query part here.......>
and nvl(d.cable,' ') like nvl(?,'%')  and
nvl( d.pair , ' ') like nvl(?,'%')  and
nvl( to_char(d.prefix) , ' ') like nvl(?,'%')  and
nvl( upper(d.lname) , ' ') like upper(nvl(?,'%')) and
nvl( upper(d.fname) , ' ') like upper(nvl(?,'%')) and
nvl( to_char(d.DN) , ' ') like nvl(?,'%')   and
nvl( to_char(d.TN) , ' ') like nvl(?,'%')    and
nvl( upper(d.DEPT_CD) , ' ') like  nvl(?,'%')
<JSTL PARAMS>
sql:param value="${param.cable}"/>
<sql:param value="%${param.pair}%"/>
<sql:param value="${param.prefix}"/>
<sql:param value="%${param.lname}%"/>
<sql:param value="%${param.fname}%"/>
<sql:param value="%${param.dn}%"/>
<sql:param
value="%${param.tn1}%${param.tn2}%${param.tn3}%${param.tn4}%"/> 
<sql:param value="${param.dept_cd}"/>


This works well, except all the 'like' statements really bog down the 
Oracle system. Can anyone suggest a way to dynamically create the above

query portion, only putting in the statements that actually have data?

     I don't know much Java, but this seems like an applicable language

to create the text, but PL/SQL seems viable also. JSTL might be 
inappropriate for this. Any thoughts? Am I reinventing the wheel?

Thanks,

- Nic.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org 
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org 


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message