3

I recently upgraded Spring framework from 3.1.2 to 4.1.1. Also upgraded to Tomcat 8 and Java 8. I am also using Tiles 2.2.2.

My web page loads fine using Spring 4 and problem comes when I do a form submission. The URL request changes and leaves out the webapp name.

For e.g., when I do a form submission, the URL that is expected is supposed to be http://xx.xx.xx.xx/webappname/createuser/submit.

But the URL changes to http://xx.xx.xx.xx/createuser/submit. And thus, throws a "Requested resource is not available " error.

I did not have this problem when I was using Spring 3.1.2, Tomcat 7, Java 7.

May I know what I am missing?

Thank you, Whiskers

EDIT :

My jsp view goes like

<form:form method="post" action = "/createuser/submit" commandName = "createForm" >
 ..... 
< /form>  
Yagnesh Agola
  • 4,556
  • 6
  • 37
  • 50

2 Answers2

0

Prepend your hyperlinks with:

${pageContext.request.contextPath}

See the accepted answer here

Community
  • 1
  • 1
ConMan
  • 1,642
  • 1
  • 14
  • 22
  • As mentioned in my previous comment, I wasn't expecting code changes since it works in Spring 3. And I don't wish to have this context path variable repeated for every form that I'm going to create. Any other suggestion? – whiskersruffles Jan 07 '15 at 15:38
0

Your action URL is start with root change your action URL to

action = "createuser/submit"   

Or used <c:url ... /> tag to create URL and give it to action as shown below

<c:url value="createuser/submit" var="myActionUrl" />
<form:form action="${myActionUrl}" .... >   

May this will help you.

Yagnesh Agola
  • 4,556
  • 6
  • 37
  • 50
  • Your suggestion to change action = "createuser/submit " works for some views. I'm not sure why the upgrade caused this issue. I didn't use to have this problem when I was using Spring 3.1.4. When I changed my libs to Spring 4, I wasn't expecting code changes. Is this expected? – whiskersruffles Jan 07 '15 at 15:35