• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error: beans.property.conversion  RSS feed

 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to submit data in a form, which is then stored in a database. I have a number of different types of fields, but my error is occuring with my date fields (a text field that accepts dates in the form of yyyy-MM-dd). When I comment out those fields it submits fine. When I set a value to the field initally and disable the field the value passes just fine, this is what is really throwing me off. The bean accepts a Date value (java.util.Date). If the value is null it works.

My error message is as follows:
org.apache.jasper.JasperException: jsp.error.beans.property.conversion
org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)
org.apache.jasper.runtime.JspRuntimeLibrary.convert(JspRuntimeLibrary.java:267)
org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:353)
 
Rusty Smythe
Ranch Hand
Posts: 93
Mac Objective C Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would be more helpful for you to provide the code so we can see what's going on.

However, I've run into Conversion Problems enough that I'm going to make a guess.

I'm assuming that the value you're getting from the form is a String, because all data on the form are strings (view souce and prove it to yourself).

When you try to shove a String into a Date, you get an exception, like trying to pound a square peg into a round hole.

To get around that, simply convert the String to a Date, then you're done.
You can use SimpleDateFormat to parse the string, then convert from Calendar to Date (if you don't know how to do any of this, Google is your friend).

Something to note: [bold]always[bold] assume that any data you get from the user is going to be bad, and take the appropriate precautions (exception handling, reject bad dates, whatever), or expect to be hacked. NEVER EVER set yourself up for SQL Injections!
 
nizams uddin
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rusty,

i too was expected to say the same stuff what you have informed.
i think Chris got around the prob till now
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!