No one can win with just a military victory. Oppression and restriction, on one side, lead to anger and retaliation on the other, in the form of rockets. Those rockets lead to anger and retaliation on the Israeli side, in the form of bombs, and now troops on the ground.
In a sense, both sides are right, but both are also wrong. The Israelis want their citizens to be safe, and to be free to live normal lives. But guess what? The Palestinians want their people to be safe, and to be free to live normal lives. Neither side can win unless they are willing to give to the other side what they want for themselves.
The best, and probably the only, way to make Hamas irrelevant, is for each country to recognize the other's right to exist, to treat each other with respect, and for each to be as fair as they want the other side to be. If life is to improve for the Israelis, it must also improve for the people of Gaza, and for all Palestinians.