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

时间:2022-04-04 13:17:37

I work with Spring MVC

我使用Spring MVC

I have two views

我有两个观点

actualizarCorreoB.jsp

actualizarCorreoB is a dynamic jsp. I get data with a query to database oracle

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

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

And

actualizarCorreo.jsp

When I click a link in actualizarCorreoB, second view is load.

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

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

I want to reload first view when I click in a button the second view.

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

This is my controller

这是我的控制器

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) {



    }


}

How can I reload first view?

我怎样才能重新加载第一个视图?

1 个解决方案

#1


0  

Not sure what you really want to do, maybe following code works, try it.

不知道你真正想做什么,也许下面的代码工作,尝试一下。

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

    return "redirect:/corregir";
}

#1


0  

Not sure what you really want to do, maybe following code works, try it.

不知道你真正想做什么,也许下面的代码工作,尝试一下。

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

    return "redirect:/corregir";
}