How To Assign Arraylist To Select Option In Jsp May 17, 2024 Post a Comment I have the list: ArrayList list = new ArrayList(); I write this list select option: select&lSolution 1: It's not recommended to use java code inside jsp. You should try to avoid it.The approach that needs to be followed in your case, is to first set the Arraylist as an attribute in the servlet that is calling the jsp page.Servlet CodeArrayListdatabaseArrayList=newArrayList(); ... request.setAttribute("databaseList", databaseArrayList); CopyThen, in the JSP code, use jstl to iterate through the values of the list to populate the select options.JSP Code<select name="database1"> <c:forEach items="${databaseList}" var="databaseValue"> <option value="${databaseValue}"> ${databaseValue} </option> </c:forEach> </select> CopyI've written an article for looping over HashMap and ArrayList in JSPSolution 2: I guess You are doing great, just change your code like:- <option value="<%out.print(Field); %>"></option> Hope this works Share Post a Comment for "How To Assign Arraylist To Select Option In Jsp" Top Question Firefox, Chrome, Safari Have Grey Background For Mp4 Html5 Video Any video (that I can make) with a white background becomes… Red Border Still Appears On Inputs After Resetting An HTML 5 Form Firefox I have an HTML 5 form! Great, I'm excited! I decide to … Svg Animation And Firefox I'm struggle with SVG animation drawing, which is work … Form To Iframe Submission - How Do You Reset The Form After File Upload? I have a form that submits the results to an iframe. The su… How To Hide/show Tabs Using Jquery I have four tabs.On loading only the first tab is opened an… How To Save Html5 Geolocation Data To Python Django Admin? Is it possible to save the javascript html5 geolocation lat… How To Limit The Html Table Records In Each Page I am populating a table in my jsp which has more than 20 re… How To Display A Python String As Html In Jupyter Notebook In IPython notebook, I used to be able to display a python … How To Add Placeholder Field? I've been trying to add placeholder in input type='… Bounce Animation On A Scaled Object What is the best way to have an object scale and then perfo…