Let me tell the scenario. I fill 6 items in a html form with action attribute going to a JSP page 'insertitems.jsp' which retrieves these items using request.getParameter(). These items are put in a HashMap. I wrote a bean class 'mybean' with a set method setFields(HashMap) and a int getInsertedFlag(). In the class a Hashmap is its member variable. The set method sets the hashmap sent by JSP to the beans hashmap. The get method inserts the 6 items in database using JDBC and returns updation status.
'mybean' class has compiled and placed in a package.
The 'insertitems.jsp' uses usebean tag wth id="mybeanid" and then setproperty tag to set the hashmap. Later using the beans id I call the get method in a scriplet like mybeanid.getinsertedFlag() instead of get property tag. Here the Compiler gives error that the id is undefined. 'insertitems.jsp' hasnt got compiled as a result. Cant I use beans id that way.
Hi sandeep, you can invoke the method in scriptlet instead of using the get property tag.why dont u post the code and the exception you are facing
Joined: Dec 06, 2004
Thanks to Rajendra for replying to my query. Actually there was a typing error. Still I had to compromise on 1 matter regarding useBean tag in JSP. The param attribute in setProperty can only be from request parameters. If I want to use my own variable in JSP page such as a HashMap to be passed param does not pass it to the bean. value attribute can have constants as their value. How can I pass my own refernce objects in setProperty tag using either param or value attribute.