[问题] java spring RequestMapping问题

楼主: uioty (uioty)   2016-02-25 09:06:18
各位好,最近接触到了java spring
因为这对我来讲是很新的工具,有些地方实在想不通怎么用...
目前我想试着由使用者输入然后用RequestMapping产生一个页面
简单来讲,我的问题是
有没有可能这样做:
@RequestMapping(value = "/user/{userInput}", method = RequestMethod.GET)
其中userInput是从另外的页面读取使用者输入的资料这样
比如说,使用者在另外的页面输入:books
然后可以产生一个页面 网址是localhost/user/books
不好意思大概问了很粗浅的问题...>_<
谢谢
作者: swallowcc (guest)   2016-02-25 10:57:00
可以啊你拿到值以后ModelAndView设一下viewName跟处理过得到的资料,就可以导向你要去的页面了
作者: yyc1217 (somo)   2016-02-27 14:03:00
请用@PathVariable

Links booklink

Contact Us: admin [ a t ] ucptt.com