I am new to spring frame. I am trying to setup the project by downloading the spring framework-4.1.6.and Tomcat-7 however I am getting the below error, even tough I have added the portal-impl-6.1.0.jar file in the build path.
Please let me know how to resolve this.
Error :[The type javax.portlet.PortletContext cannot be resolved. It is indirectly referenced from required .class files]
package com.gontuseries.hellocontroller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.mvc.AbstractController;
public class HelloController extends AbstractController {
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,HttpServletResponse response) throws Exception
{
ModelAndView modelandview = new ModelAndView("HelloPage");
modelandview.addObject("welcomeMessage","Hi User, welcome to the first spring MVC Application");
return modelandview;
}
}
Thanks for your help. Regards, Sumit
Change these two lines:
import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.mvc.AbstractController;
to this:
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
Notice that I changed "portlet" to "servlet".
Following lines will resolve the problem:
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With