Your question is what we call the million dollar question. There is not one answer, and the debate around the decision is as alive in Israel as it is anywhere else.
Yes, the exchange is an incentive to Hamas for future kidnappings, but—they don’t need an incentive, they are as eager as can be, therefore they will continue to do it regardless of a deal or not.
I think the main point is that Israel has a people’s army as opposed to a professional army like in the States. Here that army is a family, every citizen has a father, brother, son, uncle, daughter in the military at a given time, some times more than one family member.
That puts a lot of pressure on the government in these sort of situations. Gilad Shalit, with the help of the Israeli press, became the son of almost every family in Israel, and that caused a nation wide movement for his release.
I hope this help a bit to understand the dilemma regarding the issue.