how to display the data from the mysql table in the html table in jsp

advertisements

I want to fetch rows from a mysql database using a servlet and display in an html table in a jsp. How can that be? some code if possible. just need the part of how the values are retrieved, how they are sent to the jsp and how the html table containing the values is generated? I want to display data from database via servlet to jsp but should be displayed in table format. Any help welcome


While geting the data from the database,store that in the DTO(design pattern). and add that object to the arraylist. and return that arralist.now you just set this arraylist object in the setAttribute. in jsp you need to get this by using the getAttribute. Next you create the simple html table and using for loop you have to typecasting to dto class, and iterate this .you will see the data.