Oh geez. All of the indentation got waxed when I sent this. Sorry about that. It looked a lot neater when I composed it.

David C. Hicks wrote:
We are not overriding the validate() method of ActionSupport. I double-checked to be sure of that.

CustomerController (is an extension of a couple of base classes but eventually extends ActionSupport): public class CustomerController extends AbstractCrudController<Customer> {
private static final long serialVersionUID = 1L;

public CustomerController(GenericDao<Customer, Long> dao) {
super(Customer.class, dao);
}

public List<Customer> getCustomers() {
return getPersistentEntityList();
}

public Customer getCustomer() {
return getPersistentEntity();
}

public void setCustomer(Customer customer) {
setPersistentEntity(customer);
}

@Override
protected void performPreCreateOperations() {
}

@Override
protected boolean performPreAddOperations() {
return true;
}

@Override
protected void performPreUpdateOperations() {
}

@Override
protected void performPrepareOperations() {
}

@Override
protected Privilege crudPrivilege() {
return Privilege.CRUD_CUSTOMER;
}
}

Customer action configuration:
<struts>
<package name="customer" namespace="/customer" extends="harvey">
<action name="list" method="list" class="customerController">
<result name="success" type="tiles">customer.list</result>
</action>
<action name="view" method="view" class="customerController">
<result name="success" type="tiles">customer.view</result>
</action>
<action name="create" method="create" class="customerController">
<result name="success" type="tiles">customer.create</result>
</action>
<action name="add" method="add" class="customerController">
<result type="redirectAction">list</result>
<result name="input" type="tiles">customer.create</result>
</action>
<action name="edit" method="edit" class="customerController">
<result name="success" type="tiles">customer.edit</result>
</action>
<action name="update" method="update" class="customerController">
<result type="redirectAction">list</result>
<result name="input" type="tiles">customer.edit</result>
</action>
<action name="delete" method="delete" class="customerController">
<result type="redirectAction">list</result>
</action>
</package>
</struts>

Customer validation configuration:

<validators>
<field name="customer.name">
<field-validator type="requiredstring">
<message>You must enter a value for Customer Name.</message>
</field-validator>
<field-validator type="stringlength">
<param name="min">4</param>
<message>Customer name must be at least ${min} characters long.</message>
</field-validator>
<field-validator>
<param name="max">20</param>
<message>Customer name may not be longer than ${max} characters.</message>
</field-validator>
</field>
</validators>

Customer Create JSP:
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
<div class="body">
<h1>Create Customer</h1>
<s:form namespace="/customer" action="add" validate="false" method="POST">
<tiles:insertAttribute name="form" />
</s:form>
</div>

And here is the form.jsp that provides the fields for this form:
<%@ taglib prefix="s" uri="/struts-tags"%>
<div class="dialog">
<table>
<tbody>
<tr class="prop">
<td valign="top" class="name required">
<label for="description">Name:</label>
</td>
<td valign="top">
<s:textfield id="name" name="customer.name"/>
</td>
</tr>
<tr class="prop">
<td>
<span class="button"><s:submit/></span>
</td>
</tr>
</tbody>
</table>
</div>

Dave Newton wrote:
--- On Wed, 10/15/08, David C. Hicks wrote:
I can't really tell if validation is even being called.
If by "is workflow" you mean is it in the interceptor stack,
Yes. It is in the stack immediately following validation.

I'll be happy to provide whatever information you need.
I would be considered a "newbie". So, I'm not really
sure what information is helpful.

The code (if applicable, like are you defining your own validate()), configuration (action, validation), and possibly the JSP (showing things like the action being submitted to, and an example field for which validation is failing). And the version of Struts 2.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to