Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <p>Hola bienvenido</p>
- <c:forEach items="${datos}" var="dato">
- <c:out value="${dato.ID}"/>
- </c:forEach>
- </body>
- public DriverManagerDataSource conectar(){
- DriverManagerDataSource dm=new DriverManagerDataSource();
- dm.setDriverClassName("com.mysql.jdbc.Driver");
- dm.setUrl("jdbc:mysql://localhost/gameunity");
- dm.setUsername("root");
- dm.setPassword("");
- return dm;
- }
- @Controller
- public class MainController {
- private JdbcTemplate template;
- public MainController(){
- Conector con=new Conector();
- this.template=new JdbcTemplate(con.conectar());
- }
- @RequestMapping("index.htm")
- public ModelAndView index(){
- ModelAndView res=new ModelAndView();
- String consulta="select * from cliente";
- List datos =this.template.queryForList(consulta);
- res.addObject("datos", datos);
- res.setViewName("index");
- return res;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement