spring-mvc

Spring WebContent Resources - Access outside ServletContext

I have a Spring Web MVC application that I'd like to serve a large, partially generated file. I've added that file to my WebContent directory and all works fine there. However, I'd also like to access that file from my various build/deploy scripts, which read and parse the file. My current approach is to keep a copy of the file under t...

Streaming Dynamic Files from Spring MVC

I've got a Spring Web MVC application (and also a BlazeDS application, though not as relevant) where files are dynamically generated based on certain client actions. I'd like to just map a certain directory on the file system to Spring MVC (or the app server) url and let it serve the files in that directory (with streaming and standard ...

sample_en.jsp and sample_fr.jsp in Spring MVC

I am trying to setup Spring MVC 3.0 to support localization. The messages are in messages_en.properties and messages_fr.properties. It works, but I cannot figure out how to support localized JSP pages. I have tried naming them sample_en.jsp for example, but it does not work. I use ControllerClassNameHandlerMapping, BeanNameViewResolver ...

How to output something before i return the view?

Hi. I'm working with the spring mvc, and have the following problem: This is for a specific view: The controller instansiates an object (from now on, called listenObject) which runs a thread that listens for a response from a server. Right now, the controller returns a json object (to the view) if the listenObject have received a resp...

How to write a Spring/JavaEE/web application installer?

I am in the process of converting a legacy system into a Spring JavaEE application and have gotten stuck trying to design the install process. Basically when the application starts up, it needs to check whether the database schema exists and other settings and prompt the user to set them step-by-step until everything is setup. (User is a...

Spring and view resolvers

Hi, is it possible to use InternalResourceViewResolver and BeanNameViewResolver together in the same web app? I mean InternalResourceViewResolver to resolve my jsp. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp"/> and instead BeanNameViewResolver to resolve my...

spring roo excel view

Hi I am trying to output an Excel file as the view in Spring Roo 1.0.2 What is the quickest way to do this? (Do I have to add new mapping etc?) At the moment I am using the default Roo AjaxUrlBasedViewResolver. Thanks ...

Spring MVC 3: How do I construct a form action restfully?

Given some typical search form, I can't construct this form action when submitting a form: /myapp/orders/${orderId) Because the user is typing in orderId, so I can't include it in the form action. Is there a slick way to do this in Spring MVC 3? What about using an Interceptor to construct this? Is that a good solution? Otherwise I...

Re-use Sitemesh layout

I have a few webapps that I want to reuse an identical layout for. I was hoping I could bootstrap the layout via dependency consumption with the simplest method being: <sitemesh> <property name="decorators-file" value="classpath:path/to/decorators.xml"/> <excludes file="${decorators-file}"/> But that throws an exception. I...

Spring MVC 2.5, JsonView, and ModelMap

I want many of my controllers to create and return ModelMaps and to have these ModelMaps subsequently sent to/processed by a JsonView. (These controllers will service AJAX requests.) I assume I need setup a ViewResolver; what is the best way to do this? Is there a better alternative to Spring-Json View? EDIT: How do I wire a view w...

using http request parameters in spring mvc

I am generating a table of data from a simple list of objects that I am displaying in a jsp page. Each row has a View hyper link attached to it. When the user clicks on the hyper link I need to send them to another controller (hooked up via a bean) to display more detailed information. I am trying to pass a unique id but in the controlle...

Spring-Security 3/Spring MVC and the dreaded @Secured/RequestMapping

i had lots of problems adding Secured annotations to my Controllers. it turns out letting my Controller implement an InitializingBean was a bad idea. public class MyController implements InitializingBean { @Secured(value="ROLE_ADMIN") @RequestMapping(method = RequestMethod.GET, value = "/{id}/edit") public String getView(M...

FileSytemResources in Spring Framework

Hi, I am trying to retrieve xml file (containing bean definition) in my Spring MVC project. If I have the xml file under WEB-INF directory, then what path should I put into FileSystemResource in my servlet to retrieve the xml? i.e. BeanFactory factory = new XmlBeanFactory(new FileSystemResource("xml")); Thanks ...

What is wrong about my embedded jetty spring web application configuration?

I have a spring application that uses an embedded Jetty instance. Since I am programmatically defining my web.xml, here is how I am adding the dispatcher. DispatcherServlet dispatcherServlet = new DispatcherServlet(); dispatcherServlet.setContextClass( AnnotationConfigWebApplicationContext.class); ServletHolder ...

Portlet Page Navigation with Parameters - Sping MVC, WebSphere Portal, & JSR 286

Here is the scenerio: We have an application running on Webphere Portal Server 6.1 and Spring MVC. There is a page with a single portlet that shows a grid full of records. Once one of those records is clicked, it must navigate to another portlet that resides on a different page - possibly even a different portlet application on the same ...

Initialize Spring beans packaged inside a jar file

In a web-app, we define the context config location for spring to initialize all the beans like this <!-- Spring Application Configuration --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring/ctx-*.xml</param-value> </context-param> <listener> <description>Spring Context Listener</des...

What is the best view layer for Spring 3 ?

I'm investigating presentation layers to be used with spring in our new project. I'm coming from PHP+Prado and want to move to something what is as simple as Prado and more powerfull than PHP. I like Spring 3 and Spring MVC. It's very simple to learn and start working with. But I'm looking for "view framework" better than simple jsp. I ...

changing spring jsp date input bind in a form to use freemarker

I´m trying to change a spring jsp example to use freemarker. I changed all fields in a form with something like this: <@spring.formInput "account.name" /> Everything worked nicely. Form binded to the object and everything was validated, but I can`t get this part to work. <@spring.formInput "account.renewalDate" /> In jsp it was ren...

spring-security problem with loged user

Hi, i've got problem with my app, as usual.. I use Spring MVC [version: 2.5] and Security[version: 2.0.4]. My problem looks like that: First login into my app with UserA login and Password -> OK Logout UserA, UserB is login in. UserB login + password works fine, i'm in app and UserB ROLE is on. [no access for admin s...

Spring MVC Date and CustomDateEditor problem on simple text Field.

Hello I have a problem with Spring MVC 3.0 + CustomDateEditor and one field of type java.util.Date In my controller I have : protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { DateFormat df = new SimpleDateFormat("hh:mm MM/dd/yyyy"); df.setLenient(false); CustomDat...