• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Missing part of string from Spring PathVariable mapping

 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi with spring mvc 3.0.5 and jsp, I use Spring PathVariable to pass an {id} to controller, where {id} is an email address.
After the id has been passed into the controller, the tailing .au of the email address is missing.

Here is the log messages:



In the above log message, I am passing in email address samuel@morfeusflex.com.au as the {id}, but ".au" is missing from its mapping.

here is my jsp file:



controller class:



What is wrong with the spring mapping in my example?

Any suggestion is very appreciated.
Thanks
Sam
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, there are some characters that end up making it the end of that pathVariable even though there might be more text in it. So you have to break it into more than one pathVariable and then concatenate the Strings adding the character that caused the problem

In your email example that would be the "."

so I recomment

myApp/{firstPart}.{lastPart}

public String someMethod(@PathVariable("firstPart") String first, @PathVariable("secondPart") String second) {

String email = first + "." + second;

}


Mark
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic