Display data on jsp

801 views Asked by At
<form method="post" action="paperEditQ.do">
                Please select the subject you want to modify the database of :<select name="category">
                    <%
                        Statement st = DBConnection.DBConnection.DBConnect();
                        ResultSet rs = st.executeQuery("select * from papers");
                        while(rs.next()){
                            String paper = rs.getString(1);
                            out.print("<option>"+paper+"</option>");
                        }
                    %>        
                </select>
                <input type="submit" value="Modify"/>
</form>

This is the first page on my web application. I want to display the data from mySQL on this jsp page using jstl and EL tags (to get rid of the scriplets and strictly follow MVC). How would I do it? ( a little piece of code would really be appreciated).

1

There are 1 answers

2
bcfurtado On

This topic shows some approaches to remove or minimize the use of code in jsp:

How to avoid Java code in JSP files?