表单

<h:form>
    <s:validateAll>
        <f:facet name="beforeInvalidField">
            <s:div styleClass="errors">
                <s:message //>
            <//s:div>
        <//f:facet>

        <table>
   
            <tr>
                <td>Product name:</td/>
                <td>
                    <s:decorate id="nameDecorate">
                        <h:inputText id=Name value="#{product.name}"/>
                    <//s:decorate>
                <//td>
            <//tr>
        <//table>
        <h:commandButton type="submit" value="Save Product" action="#{productService.saveProduct}" />

    <//s:validateAll>
<//h:form>

后端Bean

@NotNull @Length(min=3, max=20)
private String name;

// getters and setters
...


返回顶部