This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Spring and the fly likes Invalid url path in spring mvc. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Invalid url path in spring mvc." Watch "Invalid url path in spring mvc." New topic
Author

Invalid url path in spring mvc.

Anand Sivathanu
Ranch Hand

Joined: Jun 25, 2010
Posts: 76
Hi friends,

I am new to spring mvc.doing a sample project using spring mvc.
In the project,I have a href.I mentioned the correct URL path
in that h ref.but due to append of duplicate URL path,Jsp page
which I am trying to hit is not triggered.

I googled,but not find a suggestion.

For that reason I have mentioned the below story.



In inventory.jsp,this code will invoke "priceincrease.jsp" through FormController's initForm(mentioned below)
<c:url value="price/increase" var="theAction" />
<a href="<c:url value="${theAction}"/>">Increase Prices</a>





In priceincrease.jsp,I am submitting the form,and "inventory.jsp" is called now.
"price" is getting appended with "submitter" because priceincrease.jsp is called
by the above code("/price/increase")
<c:url value="submitter" var="theAction" />
<form:form method="post" commandName="priceIncrease" action="${theAction}">
<input type="submit" align="center" value="Execute">



inventory.jsp is called now.
So far so good.

The issue arise here.
In inventory.jsp,I have a href,
<c:url value="price/increase" var="theAction" />
<a href="<c:url value="${theAction}"/>">Increase Prices</a>

the url found here is "price/price/increase" which is wrong.
"price" is getting appended with the "price/increase".

So when I click the href,page is not displayed due to the wrong path.("price/price/increase")
"price" from @RequestMapping("/price") PriceIncreaseFormController,is getting appended with
"price/increase" of inventory.jsp.

How to handle this?.
"price" of @RequestMapping("/price") PriceIncreaseFormController is appended
to any url(price/increase) that we are calling.and this makes the invalid path("price/price/increase").

Please help me in this issue.

Regards,
Anand
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Invalid url path in spring mvc.
 
Similar Threads
How to handle form re-submission in spring-mvc-3
How to create forms in a loop in Spring MVC
ModelAndView returning wrong JSP
Spring MVC
Multiple RequestMapping annotations on Spring 2.5.6