我正在使用Twitter Bootstrap的“模态窗口”功能来显示带有的表单struts 2 framework。提交表单时可以重定向到另一个模型。如何在struts.xml文件中进行配置?
struts 2 framework
struts.xml
如果我正确理解了您要执行的操作,那么您将提交一个位于模态内的表单,然后再以另一个模态显示提交的表单结果。
如果这是您要执行的操作,则根本不需要其他重定向。
您可以做的是代替提交表单,而可以使用jQuery AJAX将表单值发布到您的一个操作中,然后可以将响应填充到另一个模式框并显示模式框。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <a type="button" class="btn btn-primary btn-md" data-toggle="modal" data-target="#gridSystemModal"> Launch demo modal </a> <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel" id="gridSystemModal"> <div class="modal-dialog" role="document" style="width : 60%; height : 200px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> <h4 class="modal-title" id="gridSystemModalLabel">Modal 1</h4> </div> <div class="modal-body"> <form> <div class="form-group"> <label for="email">Field 1:</label> <input type="email" class="form-control" id="email"> </div> <div class="form-group"> <label for="pwd">Field 2:</label> <input type="password" class="form-control" id="pwd"> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" data-dismiss="modal" data-toggle="modal" data-target="#gridSystemModal2">Next</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> <div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel" id="gridSystemModal2"> <div class="modal-dialog" role="document" style="width : 60%"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span> </button> <h4 class="modal-title" id="gridSystemModalLabel">Modal 2</h4> </div> <div class="modal-body"> <form> <div class="form-group"> Response of the form submission </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal" data-toggle="modal" data-target="#gridSystemModal">Previous</button> <button type="button" class="btn btn-primary" data-dismiss="modal">Save</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal -->