本文整理汇总了Java中play.data.Form.form方法的典型用法代码示例。如果您正苦于以下问题:Java Form.form方法的具体用法?Java Form.form怎么用?Java Form.form使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.data.Form
的用法示例。
在下文中一共展示了Form.form方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: debtTypePresent
import play.data.Form; //导入方法依赖的package包/类
public static F.Promise<Result> debtTypePresent() {
JsonNode key = keystoreConnector.getKey(session("uuid")).get(SsttpFrontendConfig.timeout);
Form<EligibilityDebtType> form = Form.form(EligibilityDebtType.class);
if(Optional.ofNullable(key).isPresent()) {
if(Optional.ofNullable(key.get("data").get("service-start")).isPresent()) {
JsonNode debtType = key.get("data").get("eligibility-debt-type-form");
if(Optional.ofNullable(debtType).isPresent()) {
return F.Promise.promise(() -> ok(debt_type.render(Form.form(EligibilityDebtType.class)
.fill(fromJson(debtType, EligibilityDebtType.class)))));
} else return F.Promise.promise(() -> ok(debt_type.render(form)));
} else
return F.Promise.promise(() -> redirect(routes.SelfServiceTimeToPayController.serviceStart()));
} else return F.Promise.promise(() -> ok(debt_type.render(form)));
}
示例2: existingTtpPresent
import play.data.Form; //导入方法依赖的package包/类
public static F.Promise<Result> existingTtpPresent() {
JsonNode key = keystoreConnector.getKey(session("uuid")).get(SsttpFrontendConfig.timeout);
Form<EligibilityExistingTTP> form = Form.form(EligibilityExistingTTP.class);
if(Optional.ofNullable(key).isPresent()) {
JsonNode debtType = key.get("data").get("eligibility-debt-type-form");
JsonNode existingTtp = key.get("data").get("eligibility-existing-ttp-form");
if(Optional.ofNullable(debtType).isPresent()) {
if(Optional.ofNullable(existingTtp).isPresent())
return F.Promise.promise(() ->
ok(existing_ttp.render(Form.form(EligibilityExistingTTP.class).fill(fromJson(existingTtp, EligibilityExistingTTP.class)))));
else return F.Promise.promise(() -> ok(existing_ttp.render(form)));
} else
return F.Promise.promise(() -> redirect(routes.EligibilityController.present()));
} else return F.Promise.promise(() -> ok(existing_ttp.render(form)));
}
示例3: validateExistingTTPValue
import play.data.Form; //导入方法依赖的package包/类
@Test
public void validateExistingTTPValue() {
Map<String, String> formData = Maps.newHashMap();
formData.put("existingTTP", "false");
Form<EligibilityExistingTTP> eligibilityForm = Form.form(EligibilityExistingTTP.class);
eligibilityForm = eligibilityForm.bind(formData);
assertEquals(eligibilityForm.hasErrors(), false);
}
示例4: errorOnInvalidTtpValue
import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnInvalidTtpValue() {
Map<String, String> formData = Maps.newHashMap();
formData.put("existingTTP", "I don't know");
Form<EligibilityExistingTTP> eligibilityForm = Form.form(EligibilityExistingTTP.class);
eligibilityForm = eligibilityForm.bind(formData);
assertEquals(eligibilityForm.hasErrors(), true);
}
示例5: errorOnMissingTtpValue
import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnMissingTtpValue() {
Map<String, String> formData = Maps.newHashMap();
Form<EligibilityExistingTTP> eligibilityForm = Form.form(EligibilityExistingTTP.class);
eligibilityForm = eligibilityForm.bind(formData);
assertEquals(eligibilityForm.hasErrors(), true);
}
示例6: validateSelfAssessmentValue
import play.data.Form; //导入方法依赖的package包/类
@Test
public void validateSelfAssessmentValue() {
Map<String, String> formData = Maps.newHashMap();
formData.put("selfAssessmentDebt", "true");
Form<EligibilityDebtType> eligibilityForm = Form.form(EligibilityDebtType.class);
eligibilityForm = eligibilityForm.bind(formData);
assertEquals(eligibilityForm.hasErrors(), false);
}
示例7: validateOtherTaxDebtValue
import play.data.Form; //导入方法依赖的package包/类
@Test
public void validateOtherTaxDebtValue() {
Map<String, String> formData = Maps.newHashMap();
formData.put("otherTaxDebt", "true");
Form<EligibilityDebtType> eligibilityForm = Form.form(EligibilityDebtType.class);
eligibilityForm = eligibilityForm.bind(formData);
assertEquals(eligibilityForm.hasErrors(), false);
}
示例8: errorOnInvalidData
import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnInvalidData() {
Map<String, String> formData = Maps.newHashMap();
Form<EligibilityDebtType> eligibilityForm = Form.form(EligibilityDebtType.class);
eligibilityForm = eligibilityForm.bind(formData);
assertEquals(eligibilityForm.hasErrors(), true);
}
示例9: succeedWithValidData
import play.data.Form; //导入方法依赖的package包/类
@Test
public void succeedWithValidData() {
Map<String, String> formData = Maps.newHashMap();
formData.put("initialPayment", "5000");
formData.put("paymentFrequency", "MONTHLY");
Form<CalculatorInput> calculatorForm = Form.form(CalculatorInput.class);
calculatorForm = calculatorForm.bind(formData);
assertEquals(calculatorForm.hasErrors(), false);
}
示例10: errorOnInvalidData
import play.data.Form; //导入方法依赖的package包/类
@Test
public void errorOnInvalidData() {
Map<String, String> formData = Maps.newHashMap();
Form<CalculatorInput> calculatorForm = Form.form(CalculatorInput.class);
calculatorForm = calculatorForm.bind(formData);
assertEquals(calculatorForm.hasErrors(), true);
// add more scenarios here for data type errors
}