使用链接<a href="">

时间:2017-04-12 05:17:41

标签: java css eclipse user-interface servlets

I'm implementing MVC using JAVA. I want to display the details from db. I'm passing the value using link which direct to the servlet page. The details from the db come out on the screen but the problem is the user interface does not appear. I have already include all of my CSS style files in jsp pages. But when I run the page itself without connecting to servlet, the UI appear nicely.(but without it data from db)

How can I solve this? Help me.

Here are the codes;
1.jsp file(where the input value):

' Search Patient :

                                    <div class="col-sm-9">
                                        <input type="text" id="empid" name="empid" placeholder="ID" class="col-xs-10 col-sm-5" />
                                    </div>
                                </div>

                                <div class="space-4"></div>

                                <div class="clearfix form-actions">
                                    <div class="col-md-offset-3 col-md-9">
                                        <a href="" onclick="this.href='../SearchEmpServlet?action=view&empid='+document.getElementById('empid').value">Search</a>

                                        &nbsp; &nbsp; &nbsp;
                                        <button class="btn" type="reset">
                                            <i class="ace-icon fa fa-undo bigger-110"></i>
                                            Reset
                                        </button>
                                    </div>
                                </div>
                            </form>'
  1. Servlet

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        System.out.println("13124124");
        String forward="";
        String action = request.getParameter("action");

    if (action.equalsIgnoreCase("view")){ System.out.println("sdfvdsdsg"); forward = "/cms/viewempdetail.jsp"; int empid = Integer.parseInt(request.getParameter("empid")); Employee employee = empdao.EmployeebyId(empid); System.out.println(employee.getEmpName()); request.setAttribute("employee", employee); } RequestDispatcher view = request.getRequestDispatcher(forward); view.forward(request, response);

    }

    }

} '

0 个答案:

没有答案