com.kalai.controller.AppendGridStoreController.java Source code

Java tutorial

Introduction

Here is the source code for com.kalai.controller.AppendGridStoreController.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kalai.controller;

import com.kalai.MultipleInput;
import com.kalai.MultipleInputFiles;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *
 * @author kalaiselvan.a
 */
@Controller
public class AppendGridStoreController {

    @RequestMapping("/appendgridstore")
    public String appendgridstore(ModelMap map, HttpSession session) {
        String username = (String) session.getAttribute("username");
        if (username != null && !username.equals("") && username.trim().length() != 0) {
            map.addAttribute("Status", "UnSuccess_multiple");
            return "AppendGridStore";
        } else {
            return "index";
        }
    }

    @RequestMapping("/afterappendgridstore")
    public String afterappendgridstore(ModelMap map,
            @ModelAttribute("afterappendgridstore") MultipleInput multipleinputs, HttpSession session) {
        String username = (String) session.getAttribute("username");
        if (!username.equals("") && username.trim().length() != 0) {
            List<MultipleInputFiles> multipleinputfiles = multipleinputs.getMultipleinputfiles();
            map.addAttribute("Status", "Success");
            map.addAttribute("albums", multipleinputfiles);
            return "AppendGridStore";
        } else {
            return "index";
        }
    }

}