简体   繁体   中英

how to get a selected value in a jsp from action bean

<select name="recordLimit" id="recordLimit">
    <option value="10">Last 10</option>
    <option value="50">Last 50</option>
    <option value="100">Last 100</option>
    <option value="500">Last 500</option>
    <option value="0">All</option>
</select>

I have a search page with some drop downs and the user can choose and search data for it. I have a record limit drop down that limits no of records returned on search. Say if I select last 50 records in the drop down and it gives me the last 50 records in the results page. but I want to remember the value selected in the jsp page(ie.. display last selection when the results are rendered)

If I understood: you can do this:

String option = request.getParameterName("recordLimit") // get option selected
session.setAttrubute("recordLimit", option) // display last option selected from session

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