Monday, February 13, 2012

Check Portlet Form submit

The first way to determine the submit of a portlet is by using the default technique,i.e the code provided by the basic portlet on creation.We just need to perform following tasks.
1) Change the button name to some custom value like "btn1"
2) Change the following line in portlet.java as

public static final String FORM_SUBMIT   = "btn1";

Above mentioned changes will allow,process action method to determine the submit of form.Following is the check put in processAction method.

public void processAction(ActionRequest request, ActionResponse response) throws PortletException, java.io.IOException {
        if( request.getParameter(FORM_SUBMIT) != null ) {

Custom code goes here................

}
}




No comments:

Post a Comment