• 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 bean

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Iam unable to setProperty for the method Hm(String st,Stirng st) pl help me the code is:
import java.util.*;
public classs beanclass
{
private HashMap hm=new HashMap();
public void setHm(Stirng st,String st1)
{
hm.put(st,st1);
}
public Map getHm()
{
return hm;
}
}
The jsp code is:
<html>
<body>
<jsp:useBean id="be" class = beanclass/>
<jsp:setProperty name="be" property=("first", "secon")/>
</body>
</html>
Thanks in advance
sankar
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Where did you get that notation from ? Look in the spec about the setProperty action, and especially on how to use the "property" attribute. You'll discover several misconceptions.
 
sundar sankar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Christophe Verre,
Thanks i will look the jsp.I got this notation <jsp:setProperty name="be" property=("first", "secon")/> from my imagination with to add a value to hashMap.

Thanks
sankar
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi


i think in order to create the bean and set the properties there should be no argument constuctor in the class.


if i am wrong please help me
 
sundar sankar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi satya gopal,
Yes, bean class should have either default cnstructor (or) no-arg contructor.
 
sundar sankar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Christophe Verre ,
I read jsp spec releted to java Bean ,i think there is no way so add/put a key and value in Map.I need ranchers advice in this regard.
Thanks in advance
sankar
 
reply
    Bookmark Topic Watch Topic
  • New Topic