> I have a business rule which reads "If (the customer is from AZ,
> CA, MS, NE, or WA), and (either their total sales or total credits are
> greater than zero) then display the following paragraph."
...
> I can't find an efficient way to do this with struts as the equals and
> match tags only take one value at a time. I have read that JSTL might
> be a way to do this (ie <c:if test = ${...}>) but can't find
> sufficient documentation Any help greatly appreciated.
The nearest you would get would be the choose tag in JSTL. See
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL4.html#wp74001
BUT if this is a business rule, it should be implemented in your
business layer rather than in your presentation layer.
Looking at your description I can't see what "location in (AZ, CA, MS,
NE, WA) and (sales > 0 or credits > 0)" means from a business logic
point of view. You'd probably comment it in your JSP.
For the sake of argument, lets say it means it's an "important"
customer. If you gave your customer bean a method like this:
public boolean isImportant() {
return ("AZ".equals(location) || ...
}
You get to (a) code your logic in Java, (b) keep your business logic in
the model where it belongs, (c) re-use your logic elsewhere and (d)
create a much more readable view:
<c:if test="${customer.important}">
... do something important!
</c:if>
Regards,
Richard