JSTL Bean Session
I have a page that display data from my postgresql database in textboxes, that the user can modify. This page also do some user input validation, so if the user dont complete a required field, it goes to a retry page. I store these input fields in a javabean to redisplay in the retry page. The thing is if for example the email address is required, and I am on my retry page that display the data from my bean, and I remove the email address and submit the page again, it dont check if my email fields is empty, as it remember my value from the bean. This is not right. Its as if my bean dont store my fields if its empty. Here is a snippit of my jstl retry page and bean: What must i do for it to see that my field is empty and validate that, or store the empty value if its not required?
JSTL:
<jsp:useBean id="updateUser" class="fnb.esolutions.jsp.internal.mois.ValidateUpdateBean" scope="session"/>
<jsp:setProperty name="updateUser" property="*"/>
<c:set var="email" value='${updateUser.email}'/>
<jsp:expression>updateUser.getErrorMsg("email")</jsp:expression>
<input type="text" size="25" maxlength="35" name="email" value="${email}"/>
BEAN:
public class ValidateUpdateBean {
private String email;
if (email.equals("") || (email.indexOf('@') == -1)) {
errors.put("email","Please enter a valid email address.");
email="";
allOk=false;
}
else {
errors.put("email","");
}
public String getErrorMsg(String s) {
String errorMsg =(String)errors.get(s.trim());
return (errorMsg == null) ? "":errorMsg;
}
public ValidateUpdateBean() {
email="";
public String getEmail() {
return email;
}
public void setEmail(String eml) {
email=eml;
}
public void setErrors(String key, String msg) {
errors.put(key,msg);
}

