I have a method in a java class that returns an ArrayList of a particular class type. How can it be passed as a request parameter?
2 Answers
Correcting Jigar Joshi:
request.setAttribute("dataList",methodThatReturnsList());//and forward this request to jsp
But this is not a parameter. The request parameters can only be strings (or string arrays), and are generated when you submit a form or you attach the parameters in the query string of an url.
2 Comments
Niranjan Kumar
How can I convert this arraylist into a string and split all the key value pairs for the shown below: [[bitValue=2, name=Families], [bitValue=32768, name=Close to the Beach], [bitValue=512, name=Central Location]]
AdrianRM
Do you really need it? Where do you obtain the mappings from? Perhaps it's enough to send bitValues=2,512,32768 . But, if they are bitValues, you can just send bitValues=33282. If you really need to send this information, you could send: list_bitValues=2,512,32768&list_Names=Families,Central Location,Close to the Beach and recover the values with String.split() -- BUT: What is really your problem? I have the feeling that you are not following a good approach.