I have a database setup with hibernate, and I want to call a search on the table in my JSP page. How to I call my java function with the jsp page and store the results, then print them on the jsp page?
Search function (Search by subject)
public Iterable<Layouts> getSelectedLayouts(String subjectName){}
I have the class containing this method in my jsp page as a spring bean
custom:useSpringBean var="layoutManager" bean="LayoutManager"
where LayoutManager is the class
I don’t know how to call the method in the jsp page and output the results
I’m using a spring/hibernate to connect to the database, and running my jsp on a local tomcat server
Since it’s not clear from your question as to what framework you’re using. I will just give you a very general and simple answer but you can use the same idea in any framework you use.
You probably have a button in your jsp page which when clicked will invoke a servlet. Inside the servlet, you will have access to the fields that were submitted via the jsp page. Use the fields to create a search object(DAO) and query the database with it.
When you get results from the database, save it in session scope. So now in your jsp page, you can access the object and display it. You can use jstl to access the fields of the object.