• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doubt in jsp:useBean

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class attribute, or type attribute, or beanName must specify a bean with all properties of type string??
for example supose the BeanX:
public class BeanX implements java.io.Serializable{
private Integer i;
private java.util.Date d;
public void setI(Integer i){this.i=i;}
public Integer getI(){return this.i;}
public void setD(java.util.Date d){this.d=d;}
public java.util.Date getD(){return this.d;}
}
if used in test.jsp this way:
<%!--code for test.jsp--%>
<jsp:useBean id='x' class='BeanX'/>
<jsp:setProperty name='x' property='*'/>
if you request test.jsp?i=2&d=02/02/2003
you're going to face lots of exceptions...
is this normal?
Thanks, in advance...
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at the JSP Spec JSP.2.13.2.1 Conversions from String values. For a java.util.Date, you must have a PropertyEditor defined for the Bean. The int param should work fine, as should an primitive or String value.
[ February 22, 2004: Message edited by: Michael Morris ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic