2

I was only testing my spring-mvc as a root app on top of tomcat 7.0.50, now however I need to run at under a subfolder of the domain, like www.blabla.com/myapp

Unfortunately it does not work: all the resource files are missing and the application tries to redirect itself to root all the time.

How do i configure a spring mvc application to run under a subfolder?

BanditoBunny
  • 3,658
  • 5
  • 32
  • 40
  • This link can help you and should work with tomcat 7 also, [link](http://stackoverflow.com/questions/7276989/howto-set-the-context-path-of-a-web-application-in-tomcat-7-0) – pk87 Jan 31 '14 at 10:50

2 Answers2

0

I think it depends on your configuration of your HTTP Server (Apache, Nginx) and it has nothing to do with Spring.

Mannekenpix
  • 744
  • 7
  • 15
  • ok but Tomcat exposes your webapp with an url like http://host:8090/webappname. If you want to expose it on the port 80, you need an http server. Otherwhise I think this post may be relevant for you : http://stackoverflow.com/questions/3773687/changing-app-root-for-spring-mvc-app-on-tomcat – Mannekenpix Jan 31 '14 at 11:01
0

The basic problem was that all references (including form actions) in jsp pages are absolute (a least with my current configuration) and I had to c:url them.

static resources:

<link href="<c:url value="/resources/css/bootstrap.css"/>" rel="stylesheet" type="text/css"/>

form actions:

<c:url var="proceedActionUri" value="/user/mainscreen"/>
<form:form method="post" action="${proceedActionUri}" commandName="user" role="form">
BanditoBunny
  • 3,658
  • 5
  • 32
  • 40