我正在使用模态 ui 组件。并且无法在 servlet 中获取 textarea 的值,下面是代码:index.html:
<div modal="shouldBeOpen" close="close()" options="opts">
<div class="modal-header">
<h4>Text Editor</h4>
</div>
<div class="modal-body">
<div class="boxes">
<textarea ui:tinymce name="textBody" ng:model="textBody"></textarea>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success submit" ng-click="submit()" >Submit</button>
<button class="btn btn-warning cancel" ng-click="close()">Cancel</button>
</div>
控制器:
var ModalDemoCtrl = function ($scope,$http,$location) {
$scope.open = function () {
$scope.shouldBeOpen = true;
};
$scope.close = function () {
$scope.closeMsg = 'I was closed at: ' + new Date();
$scope.shouldBeOpen = false;
};
$scope.submit = function () {
$http.post("/FormSubmitServlet",$scope.textBody).
success(function(data) {
});
$scope.shouldBeOpen = false;
};
$scope.opts = {
backdropFade: true,
dialogFade:true
};
};
小服务程序(FormSubmitServlet):
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String textAreaValue = request.getParameter("textBody");
System.out.println(textAreaValue);
System.out.println(request.getAttribute("textBody"));
}
请检查此代码有什么问题。提前致谢。