Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Missing part of string from Spring PathVariable mapping

 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • 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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic