Struts 2 : Unable to access Model properties in JSP

后端 未结 2 795
深忆病人
深忆病人 2021-01-28 04:51

I have problem with accessing Model properties (ProcessSolution) in my JSP , I\'m not getting what is wrong with my following codes :

This is my model Class

2条回答
  •  花落未央
    2021-01-28 05:49

    When you use ModelDriven interface, the model type should be initialized in the action. In your case, change ProcessSolutionAction, line:

    private ProcessSolution processSolution;
    

    to

    private ProcessSolution processSolution = new ProcessSolution();
    

    Initializing the model type in prepare() method is not applicable with ModelDriven because they are invoked from two different interceprtors. And Model Driven Interceptor must become first. Here is some documentation: Model Driven Interceptor

提交回复
热议问题