Dynamic dropdowns in build runner jsp
Hi,
I haven't done any JSP development (and only very little Java), so I'm having some trouble figuring out how to do non-basic stuff in the ui. My latest issue is with changing the available values in a dropdown depending on the value selected in another dropdown (user selects a version, need to change available capabilities depending on version). I basically have two approaches I can think of, but please let me know if there is some other way which is easier:
1. Have the UI query the backend for available capabilities when the version selector changes. This requires me to be able to register new endpoint urls, which I'm not sure if it is possible?
2. Output the capability matrix as a json blob when my page is rendered, and then check that one when the version selector changes.
Since I'm unsure how I would create a new endpoint, I initially tried with approach 2. This went fine until I tried to alter the ui - it seems JSP pages are rendered quite non-trivially, with dropdowns being duplicated into other element types, and I'm not sure how document ids are mapped from my jsp ids to the actually html?
I have a version selector defined like this:
<props:selectProperty name="${constants.parameterName_XUnitVersion}" enableFilter="true" className="mediumField"> <c:forEach items="${runners.supportedVersions}" var="ver"> <props:option value="${ver}" id="xunit-version-${ver.replace('.','_')}">${ver}</props:option> </c:forEach> </props:selectProperty>
Then I have a bunch of properties whose available values should change depending on the selected value, which I currently do by outputting all of them:
<props:selectProperty name="${constants.parameterName_PlatformVersion}" enableFilter="true" className="mediumField"> <c:forEach items="${runners.supportedVersions}" var="ver"> <props:option value="${ver}">${ver}</props:option> </c:forEach> </props:selectProperty>
I would have expected the id I provided for the version to remain the same, but it seems to be discarded? Also I notice that there is select-elements rendered, but invisible? Do I need to take both copies into account when altering the DOM?
Reading the above I realize it is a bit unclear... Which is about how I feel trying to do this. So, is there some built-in thing to do this? Or does TC have some scripts already used for something similar? If not, how are JSP-elements mapped to html, and is there some way to give them ids that I can know and use in scripts?
Please sign in to leave a comment.