spring io(gradle)前端angularjs单身形式不起作用

时间:2017-09-13 14:54:21

标签: java angularjs forms spring-mvc

The error and the code Bellow我粘贴弹簧工具套件错误消息 -

  

2017-09-13 17:11:18.375 ERROR 6472 --- [nio-8080-exec-3]   org.thymeleaf.TemplateEngine:   [THYMELEAF] [http-nio-8080-exec-3]异常处理模板   "注册":异常解析文档:template =" register",第6行 -   第3栏

     

2017-09-13 17:11:18.375 ERROR 6472 --- [nio-8080-exec-3]   o.a.c.c.C。[。[。[/]。[dispatcherServlet]:Servlet.service()for   在path []的上下文中的servlet [dispatcherServlet]引发了异常   [请求处理失败;嵌套异常是   org.thymeleaf.exceptions.TemplateInputException:异常解析   document:template =" register",第6行 - 第3列],有根本原因。



var app = angular.module('myApp', []);

app.controller('MinMaxCtrl', function ($scope){
	$scope.formModel ={};
	
});

<!DOCTYPE html>
<html ng-app="myApp">
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <meta charset="utf-8"/>
</head>
<body>
    <div class="container main-content" ng-controller="MinMaxCtrl">
        <form>
            <div class="form-group">
                <label for="email">email</label>
                <input type="email" class="form-control" ng-model="formModel.email" id="email" required="required" />
            </div>
            <div class="form-group">
                <label for="name">name</label>
                <input type="text" class="form-control" ng-model="formModel.name" id="name" required="required" />
            </div>
            <div class="form-group">
                <label for="password">password</label>
                <input type="password" class="form-control" ng-model="formModel.password" id="password" required="required" />
            </div>
            <div class="form-group">
                <label for="age">age</label>
                <input type="number" class="form-control" ng-model="formModel.age" id="age" required="required" />
            </div>
            <div class="form-group">
                <label for="gender">gender</label>
                <select class="form-control" ng-model="formModel.gender" id="gender" required="required" />
                <option value="">Please Choose</option>
                <option value="male">Male</option>
                <option value="female">Female</option>
                <option value="other">Other</option>
                </select>
            </div>
            <div class="form-group">
                <label for="weight">weight (kg)</label>
                <input type="number" class="form-control" ng-model="formModel.weight" id="weight" required="required" />
            </div>
            <div class="form-group">
                <label for="height">height (cm)</label>
                <input type="number" class="form-control" ng-model="formModel.height" id="height" required="required" />
            </div>
            <div class="form-group">
                <button class="btn btn-primary" type="submit">Register</button>
            </div>
<pre>{{ formModel | json }}</pre>

        </form>
    </div>
    
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular-resource.min.js">
    </script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular-route.min.js"></script>
    <script src="main.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

    <!-- Latest compiled JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
&#13;
&#13;
&#13;

The js fidle site. 所以我去接受了这份工作的采访,他们给了我一个任务,我必须创建一个网站:java + angularjs,带有java spring framework +一个mysql数据库。

基本上我拥有的是这些编辑:1个项目中的3个*链接

spring io / guides / gs / secured-web /

spring io / guides / gs / access-data-mysql /

spring io / guides / gs / handling-form-submission /

加上单身网站的链接。 无法获得加载注册网站的弹簧。

为清楚起见:

  1. 如何加载单身网站?

  2. 如何将弹出文件上传到mysql(我知道它是如何在php中完成的,但不是在这里)

1 个答案:

答案 0 :(得分:0)

要将填好的表单连接到数据库,可以使用Hibernate和JPA查询。您可以为表单字段创建实体或POJO类,创建存储库和服务实现类。 例如,您可以获取“http://www.codejava.net/frameworks/spring/spring-mvc-form-handling-tutorial-and-example”此链接的帮助。