Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting null values in database while edit.jsp

 
laura xhaferaj
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HELLO! I am trying to edtit my database data using jsp. I have already created edit.jsp (which is ok) and update.jsp. The problem is that while i click edit it saves data as null in database.

edit.jsp


update.jsp



 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You only send the id as request parameter,
update.jsp?id=<%=rs.getInt(1)%>

the other parameters have null values since they not are present in the request.
update.jsp?id=<%=rs.getInt(1)%>&email=<%=rs.getString(4)%>
Try this and you gonna get a non null email.


Best regards,

PD: Try a html form better than encode the parameters in the get url.
 
laura xhaferaj
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works now. Thank you
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

try to trace your update query and found out if the parameters from edit.jsp reach update.jsp


Some considerations,
- Never concatenate query string use instead a prepared statement.
- Never access data base from view tier.
- Avoid using get and use post http requests.


Best regards,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic