• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java Programmers HEEEELP!

halik

Lifer
Alright,
is there any way to invoke/call a servlet function from within a jsp page?

I wanna write a servlet that logs all page accesses into sql along with the session username etc and i need some way to have the jsp call the servlet function. The main reason for this setup is the advantage of the servlet being run continously - that way i can keep one sql link open at all time rather than connection and disconnecting to the sql and taxing it for every page hit.
 
You can embed arbitrary Java code using a scriptlet in your JSP page. You will need to wrap your Java code in <% and %> tags, and add <%@ page import %> directives for any classes you refer to.

I don't actually advise doing this extensively, as it reduces the reuse and maintainability of your JSPs, but this is probably the most expedient way of doing what you want.
 
Back
Top