• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Invalid url path in spring mvc.

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic