Giriş
Şu satırı dahil ederiz
import org.springframework.web.servlet.mvc.AbstractController;
Örnek
Şöyle yaparız
public class HelloWorldController extends AbstractController { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)throws Exception { String name = request.getParameter("name"); //ModelAndView Object contains the logical view to return,And data model ModelAndView mv = new ModelAndView(); //Set view name,Can be a string or a view object mv.setViewName("hello"); //Set up data model mv.addObject("name", name); return mv; } }
XML şöyledir
<bean name="/hello" class="com.briup.web.controller.HelloWorldController"> <property name="synchronizeOnSession" value="true"></property> </bean>
Hiç yorum yok:
Yorum Gönder