• Post Reply Bookmark Topic Watch Topic
  • New Topic

call java class in jsp

 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have a jsp file which collects the students details.
when i click the submit button it should access a java file which calculates the total and average and display it in another jsp file.
i don not want to view the java file. when submit is clicked on the first page it should directly go to another java page( to view)

can any one give me a small example code of the three files.

thanks in advance
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a servlet where you post the data on submit click. Servlet gets the data, invokes the java class which does the necessary computation. Now store the class object in request attribute, forward the request to jsp where you want to display the result. In the resulting jsp retrieve the java object from request attribute and display the result.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!