java - Spring MVC having trouble getting JSP to display Controller Value -
i new spring mvc have setup test db try single flow through , have table displayed in jsp page. assume have configured wrong cannot find it. maybe naming convention.
i have mysql db dao class select * table works can step it.
my controller gets list of run models. no errors thrown jsp simple loads empty table. controller seems have correct info in it.
model (snippet getters , setters seem work controller gets list of them fine)
public class qamodel { private int idrun; private string suiteid; private string run_name;
controller code
@requestmapping(value="/runlist") public modelandview listrun(modelandview model) throws ioexception{ //@modelattribute system.out.println("**** controller ******"); list<qamodel> listrun = rundao.list(); model.addobject("runlist", listrun); model.setviewname("runlist"); return model; }
that list of run model objects contain correct db info can see them if step it. jsp loads blank table.
jsp code (i assume i'm missing mapping or naming convention?)
<%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>contact manager home</title> </head> <body> <div align="center"> <h1>contact list</h1> <h3><a href="/newrun">new run</a></h3> <table border="1"> <th>no</th> <th>suite id</th> <th>run name</th> <c:foreach var="qamodel" items="${runlist}" varstatus="status"> <tr> <td>${status.index + 1}</td> <td>${qamodel.suiteid}</td> <td>${qamodel.run_name}</td> <td> <a href="/editrun?id=${run.id}">edit</a> <a href="/deleterun?id=${run.id}">delete</a> </td> </tr> </c:foreach> </table> </div> </body> </html>
if not able print jstl variable 1 possible reason can jstl core tag not added.
add begining of jsp file.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Comments
Post a Comment