Well you can use 2 qeual length arrays
String[] fldName = {"userName","userMail","userAddress"};
String[] fldValue= new String[3];
// now fill up the fldValue
for (int i = 0; i <fldName.length;i++ )
{
if (fldValue[i].equals(""))
{
out.println("<b>You did not fill in "+ fldName[i] + "</b>");
break;
}
}
Sam Rose wrote:
> Help,
> I'm going crazy over this,
> I'm doing a few else if statements, but for each one i need the some
> of same lines of Java in each of the clauses, is there a way in which I
> can do this without making it look messy??
>
> e.g. this is what I've got,
>
> if (newfirstname.equals("")){
> out.println("<b>You did not fill in your name</b>");
>
> }
> else if (newsurname.equals("")){
> out.println("<b>You did not fill in your surname</b>");
>
> }
>
> and I need the same bit's of java in each of them (there are more else
> if's as well)
>
> cheers
>
> Sam Rose
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html