Skip to content

Commit

Permalink
refactor: ModelAndView render 메서드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
somsom13 committed Sep 25, 2023
1 parent 725e03d commit 798690c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ protected void service(final HttpServletRequest request, final HttpServletRespon
private void render(final ModelAndView modelAndView, final HttpServletRequest request,
final HttpServletResponse response)
throws Exception {
final View view = modelAndView.getView();
view.render(modelAndView.getModel(), request, response);
modelAndView.render(modelAndView.getModel(), request, response);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package webmvc.org.springframework.web.servlet;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -19,6 +21,11 @@ public ModelAndView addObject(final String attributeName, final Object attribute
return this;
}

public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response)
throws Exception {
view.render(model, request, response);
}

public Object getObject(final String attributeName) {
return model.get(attributeName);
}
Expand Down

0 comments on commit 798690c

Please sign in to comment.