Problem with bean error

I have the following code in my jsp.

<logic:messagesPresent>

<html:messages id="error">

'<bean:write name="error" />'

</html:messages>

</logic:messagesPresent>

<logic:messagesNotPresent>''</logic:messagesNotPresent>

Most of the time this works.. but every now and then it will kick off the following error.

ERROR (InsertTag.java:922) ServletException in'/layouts/DetailLayoutGen.jsp': Cannot find bean:"error" in any scope

javax.servlet.ServletException: Cannot find bean:"error" in any scope

at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)

at org.apache.jasper.runtime.PageContextImpl.access$1100(PageContextImpl.java:64)

at org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:745)

at java.security.AccessController.doPrivileged(Native Method)

The error is being thrown on the bean:write... but it should never even get to that line if the error bean doesn't exist? anyone seen this before or have any recomendations.

[1277 byte] By [gmachamera] at [2007-10-3 0:45:18]
# 1

I've noticed another problem that may or may not be related to this.. but if there is a validation problem the correct error message is not displayed.. just an empty pop up box... also if I populate multiple fields with invalid data only the first one is being caught (at least I assume so because an alert I put in the validation javascript method is only fireing once.)

the javascript method itself has not changed so I think it has to be a mapping issue or something.. but I can't figure out what is causing this.

any ideas?

gmachamera at 2007-7-14 17:39:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

ok here is what I see as the problem.

In the snippet below the alert(oDate[x][1]); is undefined... but that is what is used to populate the display message... plus it should be using my

errors.date={0} field is not a valid date. from the application.properties file?

function validateDate(form) {

var bValid = true;

var focusField = null;

var i = 0;

var fields = new Array();

var formName = form.getAttributeNode("name");

//oDate = new DateValidations();

oDate = eval('new ' + formName.value + '_DateValidations()');

for (x in oDate) {

//////////////////////////////////////

if(!(form[oDate[x][0]]))

continue;

////////////////////////////////////

var field = form[oDate[x][0]];

alert("field.name="+field.name);

alert(oDate[x][0]);

alert(oDate[x][1]);

alert(oDate[x][2]);

var value = field.value;

var datePattern = oDate[x][2]("datePattern");

var delim = getDelimChar(datePattern);

if ((form[oDate[x][0]].type == 'text' ||

form[oDate[x][0]].type == 'textarea') &&

(value.length > 0) &&

(datePattern.length > 0)) {

var MONTH = "M";

var DAY = "d";

var YEAR = "y";

var orderMonth = datePattern.indexOf(MONTH);

var orderDay = datePattern.indexOf(DAY);

var orderYear = datePattern.indexOf(YEAR);

if ((orderDay < orderYear && orderDay > orderMonth)) {//MM/dd/yy 1 or 2 digits for date month , 2 or 4 digits for year , and any delimiter

if(delim == ""){

dateRegexp = new RegExp("(^\\d{1,2})(\\d{1,2})(\\d{2}|\\d{4})$");

}else{

dateRegexp = new RegExp("(^\\d{1,2})[" + delim + "](\\d{1,2})[" + delim + "](\\d{2}|\\d{4})$");

}

matched = dateRegexp.exec(value);

if(matched != null) {

if (!isValidDate(matched[2], matched[1], matched[3])) {//validate day month year

if (i == 0) {

focusField = form[oDate[x][0]];

}

fields[i++] = oDate[x][1];

bValid = false;

}

}

else {

if (i == 0) {

focusField = form[oDate[x][0]];

}

fields[i++] = oDate[x][1];

bValid = false;

}

} else if ((orderMonth < orderYear && orderMonth > orderDay)) {//dd MM yy

dateRegexp = new RegExp("(^\\d{1,2})[" + delim + "](\\d{1,2})[" + delim + "](\\d{2}|\\d{4})$");

var matched = dateRegexp.exec(value);

if(matched != null) {

if (!isValidDate(matched[1], matched[2], matched[3])) {

if (i == 0) {

focusField = form[oDate[x][0]];

}

fields[i++] = oDate[x][1];

bValid = false;

}

} else {

if (i == 0) {

focusField = form[oDate[x][0]];

}

fields[i++] = oDate[x][1];

bValid = false;

}

} else if ((orderMonth > orderYear && orderMonth < orderDay)) {// yy/MM//dd

//dateRegexp = new RegExp("(^(\\d{2}|\\d{4})[" + delim + "](\\d{1,2})[" + delim + "]\\d{1,2})$");

if(delim == ""){

dateRegexp = new RegExp("^(\\d{2}|\\d{4})(\\d{1,2})(\\d{1,2})$");

}else{

dateRegexp = new RegExp("^(\\d{2}|\\d{4})[" + delim + "](\\d{1,2})[" + delim + "](\\d{1,2})$");

}

matched = dateRegexp.exec(value);

if(matched != null) {

if (!isValidDate(matched[3], matched[2], matched[1])) {

if (i == 0) {

focusField = form[oDate[x][0]];

}

fields[i++] = oDate[x][1];

bValid = false;

}

} else {

if (i == 0) {

focusField = form[oDate[x][0]];

}

fields[i++] = oDate[x][1];

bValid = false;

}

} else {

if (i == 0) {

focusField = form[oDate[x][0]];

}

fields[i++] = oDate[x][1];

bValid = false;

}

}

}

if (fields.length > 0) {

focusField.focus();

alert(fields.join('\n'));

}

return bValid;

}

gmachamera at 2007-7-14 17:39:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

looks like someone upgraded the validation jar from 1.1.1 to 1.2 without upgrading the DTDs in the xml... from what I read it looks like it should still work... but I would bet this is what is causing the problems.. *sigh* looks like I'm going to have to re write the xml because it crashes if I just change the DTD ... fun stuff.

gmachamera at 2007-7-14 17:39:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

I'm still stuck on this. From what I can tell we have been using the same jars for about 4 months.. this only started breaking a few weeks ago so it shouldn't be the jars.

in the javascript validation if I alert the value of oDate I get the following array

oDate[x]=TRADEDATE,,function anonymous(varName){

this.datePattern="MM/dd/yyyy";

return this[varname];

}

as you will see it looks like array oDate[x][1] is null when it should have a value pulled from the properties file... does anyone know what might cause this to be blank?

thanks

gmachamera at 2007-7-14 17:39:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...