重载Post RequestMapping(Overload Post RequestMapping)
我试图重载Spring控制器的RequestMapping。 控制器获取POST作为请求方法,我需要传递不同的参数来重载它。
如何在不更改URL的情况下执行此操作?
@RequestMapping(method = RequestMethod.POST, value = "/windparks/import/error") public ModelAndView handleFileUploadError(Locale locale, @AuthenticationPrincipal SpringUser authenticatedUser, List<RegulationEvent> regList, @RequestParam("regulations") MultipartFile regulations, RedirectAttributes redirectAttributes, @PathVariable String windparkId) throws IOException, WindSpeedInterpolator.TimeSeriesMismatchException, SAXException { ModelAndView view = new ModelAndView("uis/windparks/parkdetail"); view.addObject("failedEvents", regList); view.addObject("windparkId", windparkId); return view; } @RequestMapping(method = RequestMethod.POST, value = "/windparks/import/error") public ModelAndView handleFileUploadError(Locale locale, @AuthenticationPrincipal SpringUser authenticatedUser, RedirectAttributes redirectAttributes, @PathVariable String windparkId) throws IOException, WindSpeedInterpolator.TimeSeriesMismatchException, SAXException { ModelAndView view = new ModelAndView("uis/windparks/parkdetail"); view.addObject("windparkId", windparkId); return view; }
I am trying to overload the RequestMapping of a Spring controller. The Controller got POST as request Method and i need to pass it different params to overload it.
How could i do this, without changing the URL ?
@RequestMapping(method = RequestMethod.POST, value = "/windparks/import/error") public ModelAndView handleFileUploadError(Locale locale, @AuthenticationPrincipal SpringUser authenticatedUser, List<RegulationEvent> regList, @RequestParam("regulations") MultipartFile regulations, RedirectAttributes redirectAttributes, @PathVariable String windparkId) throws IOException, WindSpeedInterpolator.TimeSeriesMismatchException, SAXException { ModelAndView view = new ModelAndView("uis/windparks/parkdetail"); view.addObject("failedEvents", regList); view.addObject("windparkId", windparkId); return view; } @RequestMapping(method = RequestMethod.POST, value = "/windparks/import/error") public ModelAndView handleFileUploadError(Locale locale, @AuthenticationPrincipal SpringUser authenticatedUser, RedirectAttributes redirectAttributes, @PathVariable String windparkId) throws IOException, WindSpeedInterpolator.TimeSeriesMismatchException, SAXException { ModelAndView view = new ModelAndView("uis/windparks/parkdetail"); view.addObject("windparkId", windparkId); return view; }
原文:https://stackoverflow.com/questions/38221665
更新时间:2023-04-07 15:04
最满意答案
您必须先绑定resize事件。
你的代码很乱。 请整理一下,这样你就可以更快地看到错误。
尝试这个:
jQuery(document).ready(function() { function thirty_pc() { var wwidth = jQuery(window).width(); if (wwidth <= 480) { var height = jQuery(window).innerHeight(); var thirtypc = ((95 * height) / 100) - 40; var topmargin = (height - thirtypc - 40) / 2; thirtypc = parseInt(thirtypc) + 'px'; topmargin = parseInt(topmargin) + 'px'; jQuery("#page").css('height',thirtypc); jQuery("#page").css('margin-top',topmargin); console.log('under 480px'); } else { var height = jQuery(window).innerHeight(); var pageheight = jQuery("#page").height(); var thirtypc = (height - pageheight - 60); var topmargin = (thirtypc / 2); thirtypc = parseInt(thirtypc) + 'px'; topmargin = parseInt(topmargin) + 'px'; jQuery("#page").css('margin-top',topmargin); console.log('over 480px'); } } jQuery(window).bind('resize', thirty_pc); });
You have to bind the resize event before.
And your code is a mess. Please tidy it up, so you can see the bugs faster.
Try this:
jQuery(document).ready(function() { function thirty_pc() { var wwidth = jQuery(window).width(); if (wwidth <= 480) { var height = jQuery(window).innerHeight(); var thirtypc = ((95 * height) / 100) - 40; var topmargin = (height - thirtypc - 40) / 2; thirtypc = parseInt(thirtypc) + 'px'; topmargin = parseInt(topmargin) + 'px'; jQuery("#page").css('height',thirtypc); jQuery("#page").css('margin-top',topmargin); console.log('under 480px'); } else { var height = jQuery(window).innerHeight(); var pageheight = jQuery("#page").height(); var thirtypc = (height - pageheight - 60); var topmargin = (thirtypc / 2); thirtypc = parseInt(thirtypc) + 'px'; topmargin = parseInt(topmargin) + 'px'; jQuery("#page").css('margin-top',topmargin); console.log('over 480px'); } } jQuery(window).bind('resize', thirty_pc); });
相关问答
更多-
为什么宽度:0不起作用(Why width: 0 doesn't work)[2022-07-09]
如果您不想使用display: none ,可以添加: @media screen and (max-width: 700px) { aside { opacity: 0; width: 0; border: none; font-size: 0; } } If you don't want to use display: none you can add this: @media screen and (max-width: 700px) { aside { ... -
您必须先绑定resize事件。 你的代码很乱。 请整理一下,这样你就可以更快地看到错误。 尝试这个: jQuery(document).ready(function() { function thirty_pc() { var wwidth = jQuery(window).width(); if (wwidth <= 480) { var height = jQuery(window).innerHeight(); var thirtypc = ((95 * ...
-
问题是你的列被设置为width="Auto"这将让他们按照自己的意愿增长。实际上,这将增长到适应所有内容所需的数量。 你应该改变它:
-
ParentBackground专门用于主题。 如果您没有启用主题,那么它什么都不做。 帮助说: 确定控件是否使用父级的主题背景。 如果ParentBackground为true,则控件使用父级的主题背景绘制自己的背景。 除非启用XP主题,否则ParentBackground无效。 你正在寻找ParentColor 。 A better idea : Using Gradient Panel . i resize it and match it within Toolbar :D [Thank you al ...
-
为什么没有float的标签的宽度CSS属性不起作用?(Why width CSS attribute of label doesn't work without float?)[2023-04-03]
Label元素默认为inline显示模式。 内联元素不接受width属性,它们将以其内容的宽度呈现。 另一方面,浮动元素就像内联块。 他们会接受宽度属性。 通过将float属性应用于元素,您实际上将其display属性更改为(但不完全是) inline-block 。 The Label element is defaulted to inline display mode. Inline elements don't accept a width property, they will be render ... -
我找到了解决方案,并在index.html中添加了下一个代码 function isPhoneGap() { if (navigator.userAgent.match(/(iPhone|iPod|iPad)/)) { return true; } else { return false; } } function openPage(link) { if (isPhoneGap() == true) { var ref = win ...
-
你可以检查一下: 与依赖walker的非托管DLL依赖项。 可能缺少c ++可再发行组件。 查找MSVCR {xxx} .dll,其中{xxx}指定可再发行的版本。 托管应用程序的编译设置,最终加载非托管DLL(任何CPU,x86或x64)。 可能是托管应用程序设置为任何CPU但非托管应用程序是x86,因此非托管DLL的加载失败。 在Windows XP和Windows 7上安装了.NET框架。问题可能是在.NET框架上应用的不同补丁,但这是最不可能成为您的问题。 I solved the problem ...
-
我只是做了以下,它工作正常: 在表单中添加一个面板 将面板Size设置为100x100 将AutoScroll设置为true 将标签拖到面板中 将标签Size设置为50x200 然后运行项目,ScrollBar可见,可以上下拖动。 如果Panel设置为Enabled = false;则不会滚动的唯一原因Enabled = false; 。 I just did the following and it works fine: Add a Panel to the Form Set the Panel Siz ...
-
尝试安装此Windows更新: KB2999226 或者,我认为您需要为Visual Studio 2015安装Visual C ++ Redistributable。 Try to install this windows update: KB2999226 Or, I think you need to install the Visual C++ Redistributable for Visual Studio 2015.
-
好吧,我试图找到一个“正常”的解决方案,但我没有找到,所以这是一个“棘手”的解决方案。 这是一个想法,但我认为你需要自定义它,以便它适合你的项目。 逻辑是创建一个div ,它将占据文档的整个宽度和高度,并根据它设置画布尺寸。 最后一步是恢复元素的状态(html,body等) 所以: $('html, body').css({position: 'relative', height: '100%', overflow:'hidden'}); var tester = $('
相关文章
更多- httpclient post 请求
- howto:solr post.jar使用
- Java 重写(Override)与重载(Overload)
- httpclient post 表单参数请求
- solr java命令行post数据
- struts1 怎么在action中获取页面post的参数
- Extjs 怎样将grid的record转换成Json串,然后post到下个画面?
- 微信开发者-主动请求-准备工作-(1)发送get、post请求,上传文件(C#)
- 微信公共平台接口 使用$GLOBALS["HTTP_RAW_POST_DATA"]收不到信息解决方法
- 微信公共平台php用$GLOBALS["HTTP_RAW_POST_DATA"]收不到信息解决方法
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。