任何人都可以帮助我......?实际上我无法在jsp页面中显示我的数据库值...!我在这里分享我的所有代码...... !!请找到并帮助我....我做得很好。实际上它没有给出任何错误。所以我太混淆了。所以任何人都可以帮助我...请。谢谢。
My Dao Class看起来像
package com.mvn.blog.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.mvn.blog.domain.UserDomain;
import com.mvn.blog.dto.UserDto;
import com.mvn.blog.service.IUserMaintenance;
import com.mvn.blog.utility.CommonUtils;
@Controller
public class HomeController {
@Autowired
IUserMaintenance userMaintenance;
@RequestMapping("/home")
public String home(){
return "index";
}
@RequestMapping(value = "/userlist" , method = RequestMethod.GET)
public ModelAndView getUserList() throws Exception{
List<UserDto> userList = userMaintenance.getUserList();
//System.out.println(userList);
for(UserDto users : userList){
System.out.println(users.getUsername()+" "+ users.getEmail()+" "+users.getPassword());
}
return new ModelAndView("viewuser", "userList" , userList);
}
}
My Jsp File
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h2>User List</h2>
<table border="2">
<tr><th>Name</th><th>Email</th><th>Password</th><th>Edit</th><th>Delete</th></tr>
<c:forEach items="${userList}" var="user">
<tr>
<td><c:out value="${user.username}"/></td>
<td><c:out value="${user.email}"/></td>
<td><c:out value="${user.password}"/></td>
<td><a href="edituser/${user.userid}">Edit</a></td>
<td><a href="deleteuser/${user.userid}">Delete</a></td>
</tr>
</c:forEach>
</table>
<br/>
</body>
</html>
我的controllerClass
Erro no processamento de XML: formatação incorreta Posição: http://localhost/prj/js/templates/template.tpl?s=1517784777473 Número da linha 1, coluna 1:
答案 0 :(得分:0)
这是bcoz您正在使用由DTD定义的旧JSP 1.2描述符 默认情况下禁用或忽略EL,您必须手动启用它 使用标准的JSP 2.0或更高版本的描述符,由w3c schema定义。
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
/...
</web-app>
看看这个reference