【发布时间】:2016-11-05 23:49:22
【问题描述】:
我有一个网络应用程序http://localhost:8080/TestWeb/ .我想在我的spring mvc控制器中获取url和数据 例如
http://tech.bg7.com/college/home.html?sn=S1&token=01535141444B88
我的弹簧控制器示例
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@ModelAttribute("login") Users usr,
BindingResult result, Model model, HttpSession session,
HttpServletRequest request) {
//business logic
return "login";
}
调度程序-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">
<context:component-scan base-package="com.tech.testWeb.*" />
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/resources/*"
cache-period="31556926"/>
<import resource="classpath:springmvc-resteasy.xml"/>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/views/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
如何从 tes.bg7.com 服务器获取请求 url 到 spring mvc 控制器中?
提前致谢
【问题讨论】:
标签: java spring spring-mvc