Search code examples
javafunctionjspbuttoncall

call java function from JSP page's button on click event


There is an application that stores photos in oracle db (oracle multimedia format). There is a JAVA servlet page that handle the connection and the SQLs ..., and there are JSP pages to show the images in browser.

There is a delete function in the JAVA page, when i click one thumbnail it navigates to the an other JSP and show the full size image. Here i would like to call the public void deleteRowById( String selectId ) function which is in the JAVA servlet page. i would like to use a button, and i'm not realy know what is the proper way to call this function.

Any suggestions are welcome.


Solution

  • In the mean time i solved the situation. There is a java class that contains SQL statements -taht's what i would like to call with a form button.

    1st JSP page show the button like delete, it navigates to an other JSP page via passing a parameter with post method, in this 2nd JSP page i call the main java class method that execute a delete statement then from the 2nd JSP page i navigate back with <jsp:forward page="1st_page.jsp"/>

    Maybe not a cutting edge solution but works like charm :)