0

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();
              }
4

1 回答 1

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

名称字段不正确,名称字段应与将在您的对象中映射到的属性相同。你设置的${article?.author}应该是值。阅读更多关于表单到对象绑定的内容。

于 2012-04-21T07:08:50.910 回答