简体   繁体   中英

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> 在此处输入图片说明 ps: suprimer means delete

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM