Scenario: Demand export data.
Specific function: Export data according to the results of the query, if you do not tick the data that needs to be exported, export all data if checked, then export the data selected in the query results.
Implementation method: In the query, the generated query conditions are placed in the session, the query condition is a collection, when the export to get the query conditions and the ID of the selected data, generating a new query criteria.
Problem: The first time the data is exported correctly, the second export when the query condition in the session is the first time generated query conditions, resulting in the result of the export of this condition and the result of the previous condition
Cause of error: The concept of copying and assigning an array is unclear. The following is the code
Correct code:
List searchparams = (list) request.getsession (). getattribute ("Searchquitassetparamslist"); New ArrayList (); for (Object param:searchparams) {paramslist.add (param);
}
= Request.getparameter ("IDs"); if null &&! "" = ids.substring (0, Ids.length ()-1); Paramslist.set (6, Paramslist.get (6) + "and asset_id in (" + IDs + ")"= Assetquitservice.getassetquit (
null
null);
Error code:
= (List) request.getsession (). getattribute ("Searchquitassetparamslist");
For
= Request.getparameter ("IDs"
if null &&! ""
= ids.substring (0, Ids.length ()-1
Paramslist.set (6, Paramslist.get (6) + "and asset_id in (" + IDs + ")"
= Assetquitservice.getassetquit (nullnull);
Array assignment understanding error, resulting in data errors