2014-03-30 5 views
0

프로젝트 페이지에서 이동하여 현재 프로젝트의 작업을 확인합니다.이 표시되지 않습니다 (흰색 페이지)?

선택한 프로젝트의 작업 페이지로 리디렉션해야합니다. ok URL로 리디렉션되지만 페이지가 표시되지 않습니다. 그것은 흰색 페이지를 보여줍니다

tasks table

URL이 정확하고 매개 변수는 올바른 전달됩니다. 여기

projectTable.jsp의 냈다된다

가 브라우저에서 어떻게 보이는지
<form action="${pageContext.request.contextPath}/manager/projectstable" method="post" id="projectstable-form"> 
    <div class="row"> 
     <div class="table-responsive tile col-md-10 col-sm-12 col-xs-12 col-md-offset-1"> 
      <table class="table table-striped table-hover"> 
      <!-- Table --> 
      <thead> 
      <tr> 
       <th></th> 
       <th>#</th> 
       <th><fmt:message key="project.name" /></th> 
       <th><fmt:message key="project.description" /></th> 
       <th><fmt:message key="project.notes"/></th> 
       <th><fmt:message key="project.tasks"/></th> 
      </tr> 
      </thead> 

      <tbody> 
      <c:forEach var="project" items="${requestScope.projects}"> 
       <tr> 
        <td> 
         <label class="checkbox" for="checkbox${project.id}"> 
          <input type="checkbox" name="checkedProjects" value="${project.id}" 
            id="checkbox${project.id}" data-toggle="checkbox"> 
         </label> 
        </td> 
        <td>${project.id}</td> 
        <td>${project.projectName}</td> 
        <td>${project.description}</td> 
        <td>${project.notes}</td> 
        <td><a href="${pageContext.request.contextPath}/manager/taskstable?project_id=${project.id}" 
         class="btn btn-info btn-xs"><fmt:message key="project.see.tasks"/></a> 
        </td> 

:

projects table

및 이동이 링크 버튼으로 구현 - See tasks. 여기

TasksTableServlet의 조각입니다 :

@WebServlet("/manager/taskstable") 
@MultipartConfig 
public class TasksTableServlet extends HttpServlet { 
    private static Logger log = Logger.getLogger(AddTaskServlet.class); 
    private TaskService taskService; 
    private List<Task> tasks; 
    private static final String DATE_FORMAT = "MM/dd/yyyy"; 

    public static final String ATTRIBUTE_TO_MODEL = "tasksList"; 
    public static final String PAGE_OK = "/pages/manager/tasksTable.jsp"; 
    public static final String PAGE_ERROR_URL = "error"; 

    @Override 
    public void init() throws ServletException { 
     taskService = new TaskService(); 
    } 

    @Override 
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
     try { 
      if (request.getParameter("project_id") != null) { 
       System.out.println("ID: " + request.getParameter("project_id")); 
       updateTable(request); 
       if (!tasks.isEmpty()) { 
        request.setAttribute(ATTRIBUTE_TO_MODEL, tasks); 
        request.getRequestDispatcher(PAGE_OK); 
        return; 
       } 
      } 
     } catch (Exception e) { 
      log.error(e); 
     } 
     response.sendRedirect(PAGE_ERROR_URL); 
    } 

private void updateTable(HttpServletRequest request) { 
    try { 
     int id = Integer.parseInt(request.getParameter("project_id")); 
     tasks = taskService.getByProjectId(id); 
    } catch (DAOException e) { 
     log.error(e); 
    } 
} 

을 그리고 여기 content of tasksTable.jsp입니다.

이 페이지가 표시되지 않는 이유를 모르겠습니다. 그것은 내 마음에, 작동합니다.

어떻게이 문제를 해결할 수 있습니까?

답변

1

디스패처 요청은 첫 번째 단계 일뿐입니다. 당신은 또한 실제로 전달해야합니다.

request.getRequestDispatcher(PAGE_OK).forward(request, response); 
return; 
관련 문제