Tag: struts validation

FreeMarker模板错误! 在struts2中

我在我的课堂上使用sturts 2注释validation,而在显示操作错误时,我得到了这个奇怪的“FreeMarker模板错误!” 这是我的实体类。 @Entity public class User implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long userid; private String userPhoneNumber; private String userName; private String password; private String full_name; private String useremail; @OneToOne private userType usertypeid; public Long getUserid() { return userid; } public void setUserid(Long userid) { […]

struts2 convention插件无法正常工作

我试图用常规插件Struts2运行应用程序。 使用如下配置的struts.xml ,应用程序很好: /index.jsp hey 现在我删除了struts.xml并添加了一些这样的注释: @Namespace(“/”) @ResultPath(value=”/”) public class CountryAction extends ActionSupport implements ModelDriven{ private List worldCountry; private Country country = new Country(); public Country getCountry() { return country; } public void setCountry(Country country) { this.country = country; } // HttpServletRequest request; @Action(value=”/hey”,results={@Result(name=”success”,location=”/index.jsp”)}) public String get() throws SQLException { CountryService cs = new CountryService(); […]

struts教程或示例

我正在尝试在Struts中创建一个登录页面。 想法是validation用户是否存在等,然后如果有错误,返回到登录页面,错误为红色(典型登录或任何表单页面validation)。 我想知道是否有人知道Struts中的错误管理教程。 我正在寻找专门的教程(或示例) 标签,我认为这将解决我的问题。

Struts 2 – 重用自定义表达式validation器

在struts 2中,我们可以开发@CustomValidator ,它可以在应用程序范围内使用 @CustomValidator(type = “CustomerNumberValidator”, fieldName = “customerNo”) 为了validation@ExpressionValidator一个FIELD我们使用@ExpressionValidator @ExpressionValidator(expression = “( (!”.equals(account.firstName) && (!”.equals(account.lastName) ) || (presonalAccount == false)”, key = “validate.account.name”) 如果表达式太复杂并且需要在MORE THAN ONE FIELD上工作,我们使用OGNL来调用静态方法。 静态方法将执行validation并返回一个boolean @ExpressionValidator(expression = “@foo.bar.CalendarUtil@compareDates(fromDate,toDate)”, key = “validate.date.before”) 以上是自定义表达式validation器的一些方法! 我们在应用程序范围内使用@foo.bar.CalendarUtil@compareDates来为我们进行此validation。 还有另一种方法可以让我们使用自定义宽validation器吗?! 是否有任何可以添加到struts的自定义表达式validation器,我们可以按照我们使用@CustomValidator的方式调用它