• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invoke a class from a JSP?

 
Darko Markovic
Greenhorn
Posts: 16
C++ Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to get some information from a database in my application. I have a class with an execute method that uses request.getParameter("username"). The problem is, I don't know how to invoke the class directly from the JSP. I know that in Struts, I use an action path in a form, and I need an actionform class, and an action class that uses the form information. In this case, I only need the information from the request, and not a form, So I don't want an empty form in my application. To sum up, I need a way to invoke a class with an execute method that uses request information directly from the JSP.

Thanks in advance,
Darko
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Modern JSPs do not contain Java code. Rather, your class should be called by the page controller for the JSP, and any data that the JSP needs be placed in request scope so that, on the JSP, the JSTL and EL can be used to display it.

Please read this article to understand how modern web applications are structured.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic