最近学习了controller,以下实现,Controller如何接收请求,以及进行页面重定向
import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class TestController { //test //example http://127.0.0.1/test.do?param1=12¶m2=23 @RequestMapping(value = "test.do",//可修改成自己想要的名称 method = { RequestMethod.GET,RequestMethod.POST }) public String test(HttpServletRequest request,Model model){ String param1 = request.getParameter("param1");//从请求中获取值,获取值为12 String param2 = request.getParameter("param2");//从请求中获取值,获取值为23 //将获取的参数值放到model中,放到页面的form表单中 /** * <form action="跳转的地址" method="post"> * <input type="hidden" name="param1" value="${param1}" /> * <input type="hidden" name="param2" value="${param2}" /> * </form> */ model.addAttribute("param1", param1); model.addAttribute("param2", param2); return "test";//跳转到test.jsp页面 } //当接收到其他平台的请求后再将页面跳转到另外的平台 @RequestMapping(value = "/receive.do", method = { RequestMethod.GET,RequestMethod.POST }) public String redirect(HttpServletRequest request){ String url="http://www.baidu.com";//修改成需要跳转平台的url //获取参数 String param1 = request.getParameter("param1"); String param2 = request.getParameter("param2"); //拼接重定向参数,参数名可以修改 String redirect=url+"?param1="+param1+"¶m2="+param2; return "redirect:"+redirect; } }
相关推荐
DSI controller example design for FPGA/CPLD, you can refer for DSI interface design.
Objective of this example is to demonstrate how to design and model adaptive controller, tune and analyse its performance using Simulink® . For this example we have used direct adaptive method ...
UART controller example design for your own design reference for FPGA/CPLD. This design very simple and easy for read.
PIC based PWM controller example
UISearch Controller Example Minimal-master . zip
Slotine Applied Nonlinear Control, sliding mode control example 7.10
Slotine Applied Nonlinear Control, sliding mode control EXAMPLE 2
THIRD EXAMPLE CONTROLLER CODE
NetworkWatcher Example In this simple program I show how you can use the NetworkWatcher class to discover controllers on the network. It can be a complement to the NetworkScanner class as it will ...
Node.js By Example covers Node.js fundamentals and teaches you how to use its technology to architect a project. It shows you how to manage an application's assets and how to implement the Model-View-...
请参阅Git仓库的基本用法要获取母版的本地副本,请执行以下操作: git clone https://github.com/flashdave1973/AngularJS-Directive-Controller-Component-Example.git建立网路应用程式下载到本地主机上的某个位置...
Node.js By Example 英文pdf + 源码 What You Will Learn Get to know the fundamentals of Node.js Understand why architecting is important and what the planning of a typical Node.js application looks...
为 Spring-Boot 的 @RestController 编写单元测试我最近一直在接触 Spring-Boot。 如果你问Google Sensei如何使用Spring-Boot本身,我会告诉你,所以我会写@RestController控制器的单元测试。 我认为“单元测试”是...
a good example of flywheel controlled by model predictive controller
spring-boot-tdd-example:tdd学习spring入门demo
bootstrap table合集(bootstrap-table bootstrap-table-editable bootstrap-editable) ...该合集还包含表格相关行内编辑js(适用于bootstrap3) bootstrap-editable、bootstrap-table-editable具体使用可参考其他博客
TLS-LibreSSL示例 如何使用模块的示例项目。...项目布局|- CMakeLists.txt // projects CMakeLists.txt|- src/| || |- controller/ // Folder containing Controller where all endpoints are declared| |- client/ // ...
Node.js By Example covers Node.js fundamentals and teaches you how to use its technology to architect a project. It shows you how to manage an application's assets and how to implement the Model-View-...
此示例的目的是演示如何使用 Simulink:registered: 设计和建模自适应控制器、调整和分析其性能。... 每个元素及其工作在“Adaptive Controller Example.pdf”(附件文件夹的一部分)中进行了解释。
Working With the Domain Controller Diagnostic Utility (Part 1)This article explains how the Domain Controller Diagnostic Utility can be used to troubleshoot problems with the Active Directory....