1
感謝您閱讀我的問題。如何使用表單數組的響應?[PlayFramework]
如何使用表單數組的響應?
請仔細閱讀printSystem.scala.html
public class Test extends Controller {
static int form_max_length = 100;
static Form<Torque> torqueForm;
static Torque[] torque = new Torque[form_max_length];
static int checkData = 0;
public static Result completeData() {
torqueForm = form(Torque.class).bindFromRequest();
for (int checkData=0; checkData<form_max_length; checkData++) {
if (torque[checkData] != null) {
checkData++;
} else {
torque[checkData] = torqueForm.get();
torque[checkData].save();
break;
}
}
return TODO;
}
public static Result printData() {
return ok(printSystem.render(torqueForm));
}
}
torqueSystem.scala.html
@main("") {
<form action="/test" method="POST">
<div>
<label> Title </label>
<input type="text" name="title">
</div>
<div>
<label> Contents </label>
<input type="text" name="contents">
</div>
<div>
<input type="submit" value="submit">
</div>
</form>
}
printSystem.scala.html
@(form: Form[Torque]) main("") { @form.field("id").value() @form.field("title").value() @form.field("contents").value() }
請幫助我。
謝謝.i我將使用此源^^♥ – toyou04net