File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to invoke a class from a JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to invoke a class from a JSP?" Watch "How to invoke a class from a JSP?" New topic
Author

How to invoke a class from a JSP?

Darko Markovic
Greenhorn

Joined: Sep 15, 2013
Posts: 16

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


One cannot simply use scriptlets in JSP. And also, mycaruba.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to invoke a class from a JSP?
 
Similar Threads
How to servlet invoked secured EJB in JBOSS
Form Submitted Twice
calling a action class method from JSP in struts
Struts + I18N
First struts app help! Drop-down lists