Hello there. I have written a Bean that checks on a form validation and
then writes appropriate error messages in a hashtable. I have declared the
hashtable as :

private Hashtable errorMessages = new HashTable().

I call the proper setter and getter methods:

if (something)
{
    setErrorMessage("error", "test error message");
}

public void setErrorMessage(String aKey, String aValue)
{
    errorMessages.put(aKey, aValue);
}

public String getErrorMessage(String message)
{
   String error = (String) errorMessages.get(message.trim())
   return error;
}

  The thing is that every time I call the getErrorMessage("error") from
inside a jsp page - lets say my instance of the bean is called Error: I then
use
<%=Error.getErrorMessage("error")%>

it returns nothing. The hashtable has no values at all. If I write two test
lines like:

System.out.println("Hashtable :" + errorMessages);

then the one in the setter method returns:

Hashtable {error=test error message}

while the one in the getter method returns:

Hashtable {}

Something must be happening between the setting and the getting of the error
message. Can it be possible that a new instance of the hashtable is being
created every time? Is there any way to get the hashtable's id?Any
suggestions are more than welcome.

  Thank you.

  Panos
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to