spring-mvc

Spring MVC and Spring Security limit quota requests per IP

Is there a way to limit the number of requests that a user can make in a period of time? Ex: max 200 requests per minute. My environment is Apache Tomcat 7.0 with APR libraries, Spring MVC 3, and Spring Security 3. That feature can be a Tomcat configuration or a Spring configuration. Any suggestions? ...

How can I access a Velocity template from a sub-subdirectory?

I have a velocity template rendering VXML that is located at /billing/billingQuestionsMenu_pp.vm then, in that template, I am forwarding to: <submit next="#springUrl('/billing/billingQuestions/billingQuestionsMenuOption1.vxml')" /> Now in my Controller, I have a mapped method: @RequestMapping(method = RequestMethod.GET) public Str...

formbackingobject method invoking twice in chrome, but in IE,FF once

we are implementing springportletmvc framework, while submitting form formbackingobject method invoking twice in chrome browser, but in IE, FF invoking in once ...

Preserve line breaks in HTML,JAVA,Spring

Hi, i have a web application built with HTML(front-end),java(server-side) and i have a textarea when posting some data with line breaks (pressing enter after a word) the line breaks are not reserved (the data appears next to each other with no line breaks) how to preserve the line breaks ?, note that i am not using the tag when displayi...

Spring MVC 3 servlet.xml .. what is the use of the initial lines ?

In Spring MVC 3, what is the purpose of defining these lines <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/...

Spring tries to bind all fields

Using Spring 3 I have two forms: adding Item and invalidating Item I have ItemAddEditCommand that references Item and some other data. Adding Item works great but I have problem with invalidating Item. In general it is an edit form that contains two form fields - expirationDate and comment. In the controller I'm using the same command...

Custom "Next" Buttons for Spring MVC AbstractWizardFormController

Currently, a spring application I am working on has several wizards that it is using with Spring's AbstractWizardFormController. During the early stages of development(pre-design phase), the type of "next" button did not matter. Just to refresh, the Next and Back button are submit buttons with target attributes. So a next button on the ...

Spring MVC: best way to set global debug flag

I'm using Spring MVC and my jsp's have a <div id="debug"> section that I would like to be able to show/turn off conditionally while we are in development. For example, if I am looking at page www.example.com/main, www.example.com/main?debug=1 would show me the information that is contained under the debug div. Is there an easy way ...

How should you handle exceptions that occur below the level of the Controller in a Spring MVC web app?

Let's say you've got a Spring web app with a structure like this: com/ myapp/ controller/ model/ service/ How should you handle exceptions that occur below the level of the controller? Should you make methods in the Model and Service layers throw their exceptions up to the Controller layer? What to...

passing form values to spring through DWR (no command object)

How can I pass form values to spring controller through DWR for example? I want to be very flexible passing HashMap of name/value pairs representing the name/value of the form's input field instead . I don't want to use command object for the form. ...

how to display an object on jsp page ?

Hi, i m pretty new to Spring MVC, i m trying to setup a page to display user information I have trouble with the controler and the view. Controler (getDetail returns a User object, it has an email field) : @RequestMapping("/{code}") public String get(@PathVariable long code,ModelMap model) throws Exception { model.addAttribute("us...

Submitting / binding partial objects with spring mvc

The Spring MVC binding mechanism is powerful, but I'm now confronted with a trivial issue that I wonder how to resolve: User JPA entity, that is used for the binding and validation as well (i.e. throughout all layers) "Edit profile" page, that is not supposed to change the password or some other entity properties Two ways that I can ...

maven tomcat plugin or cargo plugin ?

The spring source code examples use maven tomcat plugin and i am able to run these projects using the command mvn tomcat:run but what i dont see the application is not deployed in local tomcat server("C:\apache tomcat\webapps\").. And how it is different from cargo plugin? (In this case when i ran the command mvn cargo:redeploy, i see t...

Why the need for a strict enforcement of interfaces for classes in a Spring MVC service layer?

In the Spring web app I am working on, there is a service layer that relates to the rest of the web app structure like this: com/ myapp/ controller/ model/ service/ This service layer is made up of interface and implementation classes. Why is it so important to have interfaces for all of these classe...

Why would a Spring login form not reveal any error information for a failed login?

My Spring MVC app is not allowing any logins and I can't figure out why. I've added logging to the Login Controller but nothing is being outputted there. The login page just seems to automatically redirect to the error page without going through the Login Controller. Any ideas how to debug this problem? <http auto-config="false" acce...

How do i get the requestmapping value in the controller ?

In the controller , i have this code, somehow, i want to get the request Mapping value "search". How is it possible ? @RequestMapping("/search/") public Map searchWithSearchTerm(@RequestParam("name") String name) { // more code here } Thank you. ...

Using both @RequestBody and normal parameters

Hi, I am using spring 3 controllers with a flex client. I am now using @RequestBody in order to pass xml's to the server. How can i pass additional parameters? Thank you. ...

why setDisallowedFields for id? -- Spring petclinic example

From the Spring API, i understood that @InitBinder is used to initialize some binding rules.. In the petclinic example why we have setdisallowed("id")? when the id is not displayed on the form? @InitBinder public void setAllowedFields(WebDataBinder dataBinder) { dataBinder.setDisallowedFields("id"); } The id field is not displaye...

Catch Spring MVC No Mapping Error

Hi, I configured below exception resolver in my web configuration file but I am not sure why it cannot handle errors such as this 'No Matching error found for servlet request: path '/etc' <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="exceptionMappings"> <props> ...

How to handle when javascript is turned off

Hi, My first web application relies heavily on Javascript and AJAX application. Other than my Login Page, majority of the pages relies on Javascript and Ajax when submitting data to the server. I have been thinking about this, if user disables his/her javascript then my app does not behave accordingly. I used this code in my Login pag...