Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Calling functions in a Bean from a JSP page?

shine_onshine_on Member Posts: 24
Hi,
I have to implement an online Address book and am having a problem.
What I need to do is delete an entry in a database when the user clicks an HTML form button on the page. Thing is, how do you make the action of clicking the button call a funtion in the bean I am using.
I understand how to use setProperties from a jsp to a bean, but cant seem to figure out how to call a function by clicking a form button.
eg:



...


//want to call a function in the bean by click the button

thanks :)

Comments

  • treshrtreshr Member Posts: 326
    I think you dont really understand JavaBeans yet.
    When you use a JavaBean, you create a instance of that JavaBean. It works the same like creating an instance in Java.
    So youre also able to call the methods that are in the JavaBean you just created.

    So if you have this JavaBean:


    You can call a mthod like this:

    guestData.methodName();


    The methodname would have to be the method that would delete the entry.
    If I was you I would use a separate JSP page to call the specific method.

    Jope I helped you enouph and success.

    --=][tReShR][=--

Sign In or Register to comment.