Hi all, I know that this goes against the idea of Struts , but 
nevertheless please help if possible.

I have created a web service for a particuler department. that calls 
from a Postgresql Database details pertaining to Planning Applications 
 as follows >

Planningdb.jsp > retrivieve data form database for viewing and a 
comments tab .
Submit.jsp > from the comments tab the Public enters there details and 
comment on the App Form .
UserInfoValid > from the Submit.jsp this page verifies the fields are 
completed and forwards to ProcessForm.jsp if valid and pass it back to 
the Database and if incorrect back to Submit.jsp for re-submission.

Thus i have created a bean named PlanBean  with the required getters and 
setters plus a StatusMsg  Method.

private String  firstName,etc etc etc

private String statusMsg ;

public String getStatusMsg () {
        return statusMsg;
    }

    public void setStatusMsg (String statusMsg) {
        this.statusMsg = statusMsg;
    }
       
    public boolean isValid() {
        boolean valid =true;
        statusMsg="";
      
        if  (true ) {
            statusMsg += ("Hi there must be working!!");
            valid = false;
        }
        if (lastName.equals("")) {
            statusMsg += ("Last Name is Blank");
            valid = false;
        }
        if (address.equals("")) {
            statusMsg += ("Address is Blank");
            valid = false;
        }
        if (postCode.equals("")) {
            statusMsg += ("Post Code is Blank");
            valid = false;
        }
        if (email.equals("")) {
            statusMsg += ("Email is Blank");
            valid = false;
        }
        if (observation.equals("")) {
            statusMsg += ("Observations is Blank");
            valid = false;
        }
      return valid ;
   }

Thus in my UserInfoValid.jsp i have the below scriplet nevertheless i a 
unable to to get the validation to prompt a StatusMsg as required .


<jsp:useBean id="planBean" scope="session" class="PlanBean" />
<%-- Output list of value with invalid format , if any!! --%>
<font color="red">
<jsp:setProperty name="planBean" property="*"/>
</font>

<%! boolean valid = true ;  %>

<%  if ((planBean.getFirstName()).equals("")) { valid = false ;
        planBean.setStatusMsg(planBean.getStatusMsg() + "Please enter 
your First Name "); } %>

<%  if ((planBean.getLastName()).equals("")) { valid = false;
        planBean.setStatusMsg(planBean.getStatusMsg() + "Please enter 
your Last Name ");  } %>

<%  if ((planBean.getAddress()).equals("")){valid = false;
        planBean.setStatusMsg(planBean.getStatusMsg() +"Please enter 
your Address "); }  %>

<%  if ((planBean.getEmail()).equals("")){ valid = false;
        planBean.setStatusMsg(planBean.getStatusMsg() +"Please enter 
your Email Address "); } %>

<%  if ((planBean.getObservation()).equals("")){ valid = false;
        planBean.setStatusMsg(planBean.getStatusMsg() +"Please enter 
your Comments "); } %>

<%  if (valid) { %>
          
            <jsp:forward page="ProcessForm.jsp" />
       
<%  } else { %>
            <jsp:forward page="Submit.jsp" />
<% } %>
 Everthing pass thru but if  purposly leave out a field no action is 
taken by the PlanBean.

 Please help as this is stalling me.
Cheers Chuck Amadi
IT Systems Programmer




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

Reply via email to