HELP - weird thing happening with spring mvc
Need help, this made my head spin. Look at the code
This does not work
Code:
@Controller
public class EmployeeProfileController {
@RequestMapping("/expenses_employee")
public Object index(HttpSession session) {
ModelAndView mv = new ModelAndView("home");
return mv;
}
}
However, this does
Code:
@Controller
public class EmployeeProfileController {
@RequestMapping("/expenses_employee")
public Object index(HttpSession session) {
return "home";
}
}
I used this as resolver
Code:
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
<property name="order" value="1" />
</bean>
The weird thing is that 2 of my controllers having EXACTLY the same code, works for both cases.
The problem is that I need to pass variables to the View from the Controller.
Note that this is only a sample code, if the code logic did not make sense just ignore it. I just want to know why it does not work.
I am becoming desperate here:confused::confused:
Please I need help.
Thank you for any help you can provide.