I have the below code in the script-let. How can rewrite it using JSTL?
<%
int Queryid = new Integer(request.getParameter(" QueryNo"));
Queries query = QueriesUtil.findByQid(Queryid);
%>
I have the below code in the script-let. How can rewrite it using JSTL?
<%
int Queryid = new Integer(request.getParameter(" QueryNo"));
Queries query = QueriesUtil.findByQid(Queryid);
%>
Your request here should first hit a Servlet that invokes the QueriesUtil
(Business/DAO classes in general) to retrieve the Query
object as before
Queries query = QueriesUtil.findByQid(Qid);
Then the Servlet needs to make it available in the right scope (say, request for eaxmple)
request.setAttribute("query", Query);
before forwarding it to target JSP using a RequestDispatcher
.
RequestDispatcher view = request.getRequestDispatcher("target.jsp");
view.forward(request, response);
Now, assuming Query
has a value
property it can be retrieved in target.jsp
as
<c:out value="${query.value}" />