Suggested Pages

Thursday, January 19, 2017

Example of Controller Spring Portlet MVC

Example of Controlle Portlet MVC

...

import javax.portlet.RenderResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


import org.springframework.web.portlet.bind.annotation.ActionMapping;
import org.springframework.web.portlet.bind.annotation.RenderMapping;
import org.springframework.web.portlet.bind.annotation.ResourceMapping;

@RequestMapping(value = "VIEW")
@Controller
public class HelloPortletController {

 
 @RenderMapping
 public String renderPage(RenderResponse response) {
     return "view";
 }

 
 @ActionMapping(params = "myaction=sayHello")
 public void actionMethod(@RequestParam("nome") String nome, @RequestParam("cognome") String cognome) {
     System.out.println("actionMethod() - start");
     System.out.println("nome:" + nome);
     System.out.println("nome:" + cognome);
     System.out.println("actionMethod() - end ");
 }

 @ResourceMapping(value = "refresh")
 public String refresh() {
     return "ajax";
 }

}


No comments :

Post a Comment

Suggested Pages