java - Spring MVC - passed http request argument not match the same String value, why? -


i'm passing email parameter value "adrian@domain.com in way:

.../confirmation?email="adrian@domain.com" 

that request handled following controlerr's method assign parameter modelatrribute added confirm.jsp view:

@requestmapping(value="/confirmation")     public string accessconfirmationform(@requestparam(value = "email") string email, model model)     {         confirmationcode confcode = new confirmationcode();         confcode.setemail(email);         model.addattribute("confcode", confcode);          return "confirm";     } 

that's code confirm.jsp:

<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <%@ page session="false" %> <html> <head> <title>confirmation</title> </head> <body>  <form:form modelattribute="confcode" action="${pagecontext.request.contextpath}/confirm" method="get"> <table> <tr> <td>confirmation code email ${confcode.email}:</td> <td><form:input path="confirmationcode" /></td> <td><font color="red"><form:errors path="confirmationcode"></form:errors></font></td> <td><form:hidden path="email" value= "${confcode.email}" /></td> </tr> <tr> <td><input type="submit" value="confirm"></td> </tr> </table> </form:form> 

after submitting form request reirected following controller's method:

@requestmapping(value = "/confirm", method = requestmethod.get)     public string confirmuser( //          @requestparam(value = "email", required=false) string email,             @valid @modelattribute(value = "confcode") confirmationcode confcode, bindingresult result,             model model) {...} 

problem email variable of confcode attribute in stage not equal manualy type string "adrian@domain.com", when printing email variable on console can see excatly same string "adrian@domain.com" without trailing spaces.

it causes email variable not applicable when i'm trying email entity in dao implementation class:

//it causes null reference  emails mail = entitymanager.find(emails.class, email);  //it returns proper entity emails mail = entitymanager.find(emails.class, "adrian@domain.com"); 

i think reason why these 2 string aren't equal encoding, maybe? encoding in db latin-1 (iso 8859-1)?

how solve problem?

why both string aren't equal each other?

.../confirmation?email="adrian@domain.com"

i think param value shouldn't have double quote


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -