Spring MMVC如何重新加载动态视图

时间:2016-07-12 05:49:17

标签: spring-mvc dynamic view reload

我使用Spring MVC

我有两个观点

actualizarCorreoB.jsp

actualizarCorreoB是一个动态的jsp。我通过查询数据库oracle获取数据

enter image description here

actualizarCorreo.jsp

当我点击actualizarCorreoB中的链接时,第二个视图正在加载。

enter image description here

我想在第二个视图中单击按钮时重新加载第一个视图。

这是我的控制器

package eusurvey.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.support.RequestContextUtils;
import org.springframework.web.bind.annotation.ModelAttribute;

import eusurvey.auxiliar.ConsultaAriel;
import eusurvey.auxiliar.Correo;
import eusurvey.auxiliar.DatosRemitentes;
import eusurvey.auxiliar.FechasEncuesta;
import eusurvey.modelA.daos.Encuestado;
import eusurvey.modelA.daos.Preferencia;
import eusurvey.services.ActualizacionesCorreoService;
import eusurvey.services.ConsultasArielService;
import eusurvey.services.PreferencesService;
import eusurvey.utils.DateUtils;

@Controller
@RequestMapping("/correos")
public class CorreosController {
    private static final Logger logger = Logger
            .getLogger(CorreosController.class);

    @Resource(name = "consultasArielService")
    private ConsultasArielService consultasArielService;

    @Resource(name = "actualizacionesCorreoService")
    private ActualizacionesCorreoService actualizacionesCorreoService;

    @RequestMapping(value = "/corregir", method = RequestMethod.GET)
    @Transactional(readOnly = true)
    public String corregirCorreos(HttpServletRequest request, final Model model) {


        return "/encuesta/actualizarCorreoB";


    }

    @RequestMapping(value = "/corregir/corregir", method = RequestMethod.GET)
    @Transactional(readOnly = true)
    public String modificarCorreo(
            @RequestParam(value = "idUsuario", required = false) String idUsuario,
            @RequestParam(value = "mailUsuario", required = false) String mailUsuario,
            @RequestParam(value = "nombreUsuario", required = false) String nombreUsuario,
            @RequestParam(value = "apellido1Usuario", required = false) String apellido1Usuario,
            @RequestParam(value = "apellido2Usuario", required = false) String apellido2Usuario,
            HttpServletRequest request, final Model model) {


        return "/encuesta/actualizarCorreo";

    }

    @RequestMapping(value = "/grabar", method = RequestMethod.POST)
    @Transactional(readOnly = true)
    public void grabarCorreo(HttpServletRequest request, final Model model) {



    }


}

如何重新加载第一个视图?

1 个答案:

答案 0 :(得分:0)

不确定你真正想做什么,也许在代码工作之后,尝试一下。

@RequestMapping(value = "/grabar", method = RequestMethod.POST)
@Transactional(readOnly = true)
public String grabarCorreo(HttpServletRequest request, final Model model) {
    ... ...

    return "redirect:/corregir";
}