MySQL总是填充NULL值,我缺少什么(Play 1.2框架)?

时间:2012-04-20 23:21:51

标签: mysql playframework playframework-1.x

view.html看起来像这样,我缺少什么因为表中填充了空值?

                <form class="form-inline form-fields" action="SubmitArticle" method="POST">

                    <fieldset>
                    <div class="control-group success">
                    <label class="control-label" for="input01"><a>Author Name</a></label>
                    <div class="controls">
                    <input type="text" class="input-xlarge" id="input01" name="${article?.author}">
                    </div>
                    </div>


                    <div class="form-actions">
                    <button class="btn btn-success btn-large span2" type="submit" name="commit"> Submit </button>
                    </div>      




                    <div class="control-group right-area success">
                    <label class="control-label" for="input01"><a>Abstract</a></label>
                    <div class="controls">
                    <textarea id="textarea" class="input-xlarge" rows="3" style="width: 498px; height: 283px;" name="${article?.abstract}"></textarea>
                    </div>
                    </div>




                </fieldset>

           </form>

,我的控制器中的操作如下所示:

 public static void SubmitArticle(String article_name, User author, String         article_abstract) {

        Article article = new Article(article_name, author, article_abstract);
        article.save();
              }

1 个答案:

答案 0 :(得分:0)

<input type="text" class="input-xlarge" id="input01" name="${article?.author}">

名称字段不正确,名称字段应与其在对象中映射到的属性相同。您设置为${article?.author}的内容应该是有价值的。在Form to Object绑定上阅读更多内容。