EJB Example With JSP and Servlet
EJB Example With JSP and Servlet
@Stateless
public class SessionBean implements SessionBeanRemote {
File -> New Project -> Java Web -> Web Application
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>EJB Example</title>
</head>
<body>
<form action="use_ejb.do" method="post">
</form>
</body>
</html>
Then go to Servlet and send the received value from textbox to the RemoteBean
method to get result from the RemoteBean.
String str1=request.getParameter("nm");
String str2=sessionBean.businessMethod(str1);
response.setContentType("text/html;charset=UTF-8");
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet UseBean</title>");
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
Output :