Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

a jsp beginner question  RSS feed

 
Manoj Zachariah
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a java class and a jsp file with a text box and a button, how can i call a method in the java class when the button is pressed. thanks
class : borrower.class
method: getDetail(String name)
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might be better off posting a JSP question in the JSP forum since a lot of people in here will have never touched a JSP.
Anyway, make sure you understand that JSPs (server-side code--it gets run on the server and then the resulting HTML is sent to the user's browser) are not like Javascript (client-side code, so it gets run in the web browser).
When you click a button in the webpage, it should be a submit button in a form that then gets posted back up to the server. Anywhere you have JSP tags in the page you can insert Java code that will get run on the server. Maybe you should try reading up here:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro.html
http://www.jsptut.com/
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, you might want to take a look at the Servlets assignment section of the JavaRanch Cattle Drive for a nice, easy introduction to Servlets (and by extension, JSPs).
Moving this to the JSP forum...
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!