| 12 | |
| 13 | public class MethodCall2 { |
| 14 | public static void main(String[] args) throws Exception{ |
| 15 | |
| 16 | Class clazz = Class.forName("com.fastcampus.ch2.YoilTellerMVC"); |
| 17 | Object obj = clazz.newInstance(); |
| 18 | |
| 19 | Method main = clazz.getDeclaredMethod("main", int.class, int.class, int.class, Model.class); |
| 20 | |
| 21 | Model model = new BindingAwareModelMap(); |
| 22 | System.out.println("[before] model="+model); |
| 23 | |
| 24 | // String viewName = obj.main(2021, 10, 1, model); |
| 25 | String viewName = (String)main.invoke(obj, new Object[] { 2021, 10, 1, model }); |
| 26 | System.out.println("viewName="+viewName); |
| 27 | |
| 28 | // Model의 내용을 출력 |
| 29 | System.out.println("[after] model="+model); |
| 30 | |
| 31 | // 텍스트 파일을 이용한 rendering |
| 32 | render(model, viewName); |
| 33 | } // main |
| 34 | |
| 35 | static void render(Model model, String viewName) throws IOException { |
| 36 | String result = ""; |