I' new to java programming. I used to do .NET
. In my new project which is using java, I want to read the database and load some data into the texboxes
in my jsp
page.
I used to do this using pageload
method in .NET
development. I can't find a propper way to do this in jsp
.
For now I used the below code samples and it did not work as I wanted.
in servelet
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//processRequest(request, response);
request.setAttribute("username", "Uditha");
request.getRequestDispatcher("/WEB-INF/Download.jsp").forward(request, response);
}
In JSP
<jsp:include page="/PageLoad" />
<a id="btnUserAccount" type="submit" class="btn btn-default">${result}</a>
It would be very helpful is someone can help me do this. Thank you.