Solved

Invoke Method in Servlet

Posted on 2006-11-13
2
394 Views
Last Modified: 2006-11-27
I am implementing MVC model, so I separate the business login from the presentation. I don't want to write code in the JSP page to retrieve data from the database, But invoke method in the Servlet. Can I call method in the JSP page from the Servlet without invoking cadoPost or doGet?
0
Comment
Question by:Sh_Rashed
2 Comments
 
LVL 11

Expert Comment

by:Manish
ID: 17936259
Basically get all the values from db, store it in viewBean and forward it to jsp and locate bean in jsp(use useBean tag)  and show it.
0
 
LVL 12

Accepted Solution

by:
enachemc earned 125 total points
ID: 17963506
the JSP code you write will be called automatically from doGet and doPost. You can make methods and global variables (to the generated servlet class) in your JSP

instead of <% %> use <%! %>
This will instruct the JSP parser to put all the content of <%! %> at the class level of the servlet.
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question