0

I'm trying to get a simple query returned on a JSP with very limited data, say about 20-25 rows max being returned.

I am somewhat new to using JSTL but I was wondering in the JSP with the tags, does something like var="{time_req_date}" replace the scriptlet, or request.getParamter variable, for example?

<c:set var="time_req1" value="<=${time_req_date}>"/>
<c:set var="time_req2" value="<=${time_req_date2}>"/>
<sql:query var="sqlresult" sql="select * FROM FORM_REDUCVU WHERE 
to_date(TIME_REQ,'mm/dd/yyyy') >= ? AND to_date(TIME_REQ,'mm/dd/yyyy') 
<=  ?  ORDER BY ID DESC" maxRows="25" dataSource="jdbc/myoracledev">
<sql:param value="1110484" ></sql:param>
</sql:query>

I've got two text fields from a search form page and I'm just trying to get that data returned. I wasn't even sure if I was going to need to use the format tag lib for the date. Maybe I am, but if you can point me in the proper direction I'd appreciate it. I realize this data normally shouldn't go in the JSP and I am working on building a separate DAO class to compartmentalize that code. Just for the short term I'd like to know what is missing or incorrect.

Errors seemed to imply the following:

18-Feb-2019 11:57:32.502 SEVERE [http-nio-20000-exec-6] 
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() 
for servlet [jsp] in context with path [/useragent] threw exception 
[javax.servlet.ServletException: javax.servlet.jsp.JspException: select 
* FROM FORM_REDUCVU WHERE to_date(TIME_REQ,'mm/dd/yyyy') >= ? AND 
to_date(TIME_REQ,'mm/dd/yyyy') <=  ?  ORDER BY ID DESC: Missing IN or 
OUT parameter at index:: 2] with root cause
java.sql.SQLException: Missing IN or OUT parameter at index:: 2

Thanks!

Barry P
  • 91
  • 1
  • 10

1 Answers1

1

It is complaining because you said there were two parameters (the question marks) but you didn't provide values for both.

Andrianekena Moise
  • 1,018
  • 7
  • 16
  • I'm editing the above to see if it looks correct. Well,it won't let me, and I can't format this comment. { } – Barry P Feb 18 '19 at 22:08