91-9990449935 0120-4256464 |
Struts 2 Fetching all records of a tableTo fetch all the records, we have stored all the records in a collection (using List), and displaying the data of the collection using the iterator tag of struts2. Here, we assume that you have a table in oracle database named user3333 that contains records. The table query is: Example to fetch all the records of the tableIn this example, we are creating 5 pages :
1) Create index.jsp for invoking action (optional)This jsp page creates a link to invoke the action. But you can direct invoke the action class. index.jsp2) Create the action classThis action class contains ArrayList object as the datamember and execute method. Register.java3) Create the class to represent tableThis is the simple bean class containing 4 fields. User.java4) Create struts.xmlThis xml file defines action and result. struts.xml5) Create view componentIt is the simple jsp file displaying the information of the user. welcome.jsp
Next TopicStruts Quiz
|