toink
toink

Reputation: 255

passing parameter from jsp to sql query in DAO

I found this link...

Java:how to pass value from class/bean to servlet

I tried it and it works (thanks to BalusC) This was very helpful and answers all my questions that I've been researching for several days now.

However I'm trying to figure our how to pass the parameter from JSP to the sql query in DAO

if for example I want to create a jsp form to filter the result that the servlet will be producing...

Thanks in advance

Upvotes: 0

Views: 1698

Answers (1)

Amir Pashazadeh
Amir Pashazadeh

Reputation: 7302

It depends on how do you want to invoke DAO methods, (please clarify it):

  1. If you want to call DAO methods directly from your JSP (which is a bad practice), I recommend using JSTL's SQL tag library.
  2. If you want you can develop your custom tag-library to invoke your DAOs.
  3. If you are invoking DAO methods from a Servlet (or using an MVC framework), you cant use request.getParameter(paramName) to get what user have filled in the inputs, then call the DAO methods, and set the result of DAO in request attributes.

Upvotes: 1

Related Questions