youssef
youssef

Reputation: 41

struts2 prevent other users from performing an action

hello i am trying to write a web application with struts 2 the problem is that i am having an action like this http://localhost:8080/Onda_vol/suprimer?id=14 which allows user to delete a row from SQL with the id= 14 i am using session that doesn't allow people to enter the application with no permission

for example if i enter to http://localhost:8080/Onda_vol/index.jsp it will redirect me to http://localhost:8080/Onda_vol/login.jsp and will ask for username and password but the but when some one enter to http://localhost:8080/Onda_vol/suprimer?id=14 it redirects him to http://localhost:8080/Onda_vol/login.jsp but the row with the id=14 get deleted how can i prevent this from happening please don't tell me to use post instead of get cause the action is written like this

<th><a class="btn btn-danger" href="suprimer?id=<s:property value="id_vol" />"> suprimer</a></th> enter image description here ps: suprimer means delete

Upvotes: 0

Views: 49

Answers (1)

S. Saad
S. Saad

Reputation: 333

What you're looking for is Interceptors. See https://struts.apache.org/docs/interceptors.html on how to use them.

Upvotes: 1

Related Questions