我正在尝试在 Spring Boot 中实现自定义密码匹配验证。但我收到如下错误:-
PasswordMatch 包含 Constraint 注释,但不包含消息参数
我正在关注此链接https://www.baeldung.com/registration-with-spring-mvc-and-spring-security进行自定义验证。问题是我收到了这样的错误。
javax.validation.ConstraintDefinitionException: HV000074: com.bikram.booking.validation.PasswordMatch 包含约束注释,但不包含消息参数。在 org.hibernate.validator.internal.metadata.core.ConstraintHelper.assertMessageParameterExists(ConstraintHelper.java:915)
我在网上搜索了解决方案,但找不到合适的解决方案。
我的模态是
package com.bikram.booking.dto;
import com.bikram.booking.validation.PasswordMatch;
import com.bikram.booking.validation.ValidEmail;
import javax.validation.constraints.*;
@PasswordMatch
public class UserDto {
@NotNull
@Size(min = 6, message = "Password should be more than 6 characters")
@NotEmpty(message = "Please provide a password")
private String password;
@NotNull
@Size(min = 6, message = "Password should be more than 6 characters")
private String confirmPassword;
}
Run Code Online (Sandbox Code Playgroud)
我的界面是
package com.bikram.booking.validation;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import …Run Code Online (Sandbox Code Playgroud) 我有一个 UITextView,其中包含大量文本,末尾有一个数字。我试图检测文本视图中的数字,但无法实现。我只能找到链接才找到解决方案。
我正在使用 NSAttributedString 来显示文本。
.dataDetectorTypes 似乎不起作用。谁能帮我
我正在这样尝试。
let middleTextView: UITextView = {
let tv = UITextView();
let attributedText = NSMutableAttributedString(string: "Your NetCode will be sent to", attributes: [NSAttributedStringKey.font : UIFont.systemFont(ofSize: 14)]);
attributedText.append(NSAttributedString(string: "\n\nXXXX XXX 252", attributes: [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 16)]));
attributedText.append(NSMutableAttributedString(string: "\n\n To update you mobile number call tel://13 2221", attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: 12)]));
// let url = NSURL(string: "tel://\(1234)");
// tv.text = url;
tv.attributedText = attributedText;
tv.textAlignment = .center
tv.backgroundColor = UIColor.clear;
tv.dataDetectorTypes = .phoneNumber;
tv.isEditable = false;
tv.isSelectable …Run Code Online (Sandbox Code Playgroud) 我正在构建一个应用程序,它将根据特定条件显示图像。目前,我的数据显示在 JavaFX 上的表格视图中。我的可观察模型类仅包含有关用户输入信息的信息。我需要比较表视图类中的信息并在称为状态的指定列之一内显示图像。
TableColumn<StudentRecord, ImageView> statusCol = new TableColumn<>("Status");
Run Code Online (Sandbox Code Playgroud)
我遵循了不同的答案,但找不到合适的解决方案。我这样做是为了循环遍历所有对象并显示图标。但这种方法会在每一行上显示图标。
dataController.getAllData().forEach(studentRecord -> {
if (studentRecord.getDate().equalsIgnoreCase("some date")) {
statusCol.setCellValueFactory(c -> new SimpleObjectProperty<ImageView>(new ImageView("/images/tick.png")));
}else{
statusCol.setVisible(false);
}
}
);
Run Code Online (Sandbox Code Playgroud)
我尝试了 StackOverflow 的不同答案,但无法正确实现它。知道如何解决这个问题吗?
我正在尝试将字符串;用作分隔符。
我的输出很奇怪,为什么返回数组的末尾有一个空字符串?
string emails = "bitebari@gmail.com;abcd@gmail.com;";
string[] splittedEmails = emails.TrimEnd().Split(';');
foreach (var email in splittedEmails)
{
Console.WriteLine("Value is :" + email);
}
Run Code Online (Sandbox Code Playgroud)
控制台输出如下所示:
值为:bitebari@gmail.com
值为:abcd@gmail.com
价值是:
c# ×1
imageview ×1
ios ×1
java ×1
javafx ×1
split ×1
spring-boot ×1
spring-mvc ×1
swift ×1
swift4 ×1
tableview ×1
uitextview ×1