使用hibernate作为表单vaildation时引用符号预期错误

时间:2015-04-25 19:45:06

标签: java spring

我收到的错误是:

/WEB-INF/jsps/createoffer.jsp (line: 29, column: 67) quote symbol expected  

从我在java spring文档中读到的内容,下面的内容是正确的。应用程序一直运行,直到我在index.jsp页面上选择指向表单的链接。

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<!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">
<link href="${pageContext.request.contextPath}/static/css/main.css"
    rel="stylesheet" type="text/css" />

<title>My form</title>
</head>
<body>

    <sf:form method="post"
        action="${pageContext.request.contextPath}/docreate" commandName="offer">

        <table class="formtable">
            <tr>
                <td class="label">Name:</td>
                <td><sf:input class="control" path="name" name="name" type="text" /></td>
            </tr>
            <tr>
                <td class="label">email:</td>
                <td><sf:input class="control" path="email" name="email" type="text" /></td>
            </tr>
            <tr>
                <td class="label">your offer:</td>
                <td><sf:textarea class="control" path="text" name="text" rows=10 cols=10 /></td>
            </tr>
            <tr>
                <td></td>
                <td><input name="Create Offer" type="submit" /></td>
            </tr>
        </table>

    </sf:form>

</body>
</html>
来自OffersController.java的

@RequestMapping("/createoffer")
public String createOffer(Model model) {

model.addAttribute("offer", new Offer());

/*List<Offer> offers = offersService.getCurrent();

model.addAttribute("offers", offers);
*/
return "createoffer";

}

提供Bean

@Component
public class Offer {

    private int id;
    @Size(min = 5, max = 25, message = "Name is not vaild")
    private String name;
    @NotNull
    @Email(message = "Is not a vaild email address")
    private String email;
    private String text;

    public Offer() {

    }

1 个答案:

答案 0 :(得分:0)

我没有足够的积分来添加评论。你能仔细检查一下row = 10与row =&#34; 10&#34;在那个jsp文件中?错误消息似乎是jsp中的语法问题。