Hi,
I wonder if anyone can help. I can currently working through a proof of concept to determine view technology suitability for our application. I've put together a working application using JSP as the view; and am now trying to 'convert' it to VM.
One of the things the application does is setup a series of 'common'/shared list objects in the application scope (yes/no, titles, genders etc). I only want these lists defined and instantiated once, so I have a bean which implements ServletContextAware and InitializingBean, and I add attributes to the ServletContext:
In my JSP I can reference the yesNoList like this:Code:ArrayList<GIOLPListItem> list = new ArrayList<GIOLPListItem>(); list.add(new GIOLPListItem("Y", "Yes")); list.add(new GIOLPListItem("N", "No")); m_context.setAttribute("yesNoList", list);
The important syntax I think is this: ${applicationScope['yesNoList']}Code:<select name="<c:out value="${status.expression}"/>" id="<c:out value="${id}"/>"> <c:forEach var="listItem" items="${applicationScope['yesNoList']}"> <option value="<c:out value="${listItem.id}"/>" <c:if test="${listItem.id == status.value}">selected="selected"</c:if>><c:out value="${listItem.value}"/></option> </c:forEach> </select>
This works fine for JSP; but I cannot work out how to reference the application scope in VM
Any ideas?
Cheers
JD


Reply With Quote
