You must not have any scriptlet/direct Java code in your JSP. Please avoid its usage. More info on this: How to avoid Java code in JSP files? (no need to explain one more time all the problems you get when using scriptlets).
You should use a Servlet that will handle the GET request for your JSP and the Servlet (Controller) will be the link between your View and your Model (Service, Dao, etc). This is a very basic example:
@WebServlet("/viewuser.jsp")
public class HelloServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int empid = (Integer)request.getSession().getAttribute("empid");
//assuming EmployeeService is a service class that has a getEmployee method
//that will handle the work to a dao to retrieve data from database
//or another data source and will return an Employee object
Employee employee = new EmployeeService().getEmployee(empid);
request.setAttribute("employee", employee);
request.getRequestDispatcher("/viewuser.jsp").forward(request, response);
}
}
And then in your viewuser.jsp file (shortened code):
<p>
Name: <c:out value="${employee.name}" />
</p>