简体   繁体   中英

Struts - actions mapping - while choosing options

I am currently working on a struts2 project. In my project the user is given 2 options randomly of the many stored in the database out of which he selects any 1. the option that is selected is considered the winner and the one that is not is considered loser. The number of wins and losses for each entry is noted. That means i need to send both the winner and loser to the action and which 1 is sent will depend on what the user clicks. Also i have 2 work with objects simple strings is not enough.

I don't know how to go about this because whatever i name my options will be the name i have to give in the action. can someone tell me how to get the name of the option clicked. what should i do in my actions.

also if want that the user need not click the submit button after clicking the option what modifications should i do?

For both the above questions it would be best if the solution conforms to the OO Principles

You need to make an action that handles both options at the same time (So both winner or Loser). Or you need to sent multiple requests (for example with ajax) for each of 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