Skip to content

Commit ff1522a

Browse files
committed
add web view (jsp) changes
1 parent 8cf91af commit ff1522a

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

src/main/webapp/WEB-INF/views/data-man/00-address.jsp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,30 @@
2626
<tr><td>Zip code:</td><td><form:input path="address.zipCode"/></td></tr>
2727
<tr><td>City:</td><td><form:input path="address.city"/></td></tr>
2828
<tr><td>Country:</td><td><form:select path="address.country" items="${countryCodes}"/></td></tr>
29-
</table>
29+
<tr><td>Latitude:</td><td><form:input path="address.latitude"/></td></tr>
30+
<tr><td>Longitude:</td><td><form:input path="address.longitude"/></td></tr>
31+
32+
<!--
33+
Extract the address object using spring:bind to make it accessible for JSTL conditionals.
34+
35+
Why: The form:input tag works with relative paths ("address.latitude"), but JSTL's c:if
36+
cannot resolve these relative paths - it needs direct object references. Since address
37+
can be nested in different parent objects (cp.address, user.address, etc.), we use
38+
spring:bind to resolve the path relative to the form's modelAttribute and expose the
39+
actual address object.
40+
41+
See: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/tags/BindTag.html
42+
-->
43+
<spring:bind path="address">
44+
<c:set var="boundAddress" value="${status.value}" />
45+
</spring:bind>
46+
47+
<c:if test="${(not empty boundAddress.latitude) and (not empty boundAddress.longitude)}">
48+
<tr>
49+
<td></td>
50+
<td><a target="_blank" href="https://maps.google.com/?q=${boundAddress.latitude},${boundAddress.longitude}">
51+
Show on Google Maps</a>
52+
</td>
53+
</tr>
54+
</c:if>
55+
</table>

src/main/webapp/WEB-INF/views/data-man/00-cp-misc.jsp

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,11 @@
3131
</c:if>
3232
</td>
3333
</tr>
34-
<tr><td>Latitude:</td><td><form:input path="locationLatitude"/></td></tr>
35-
<tr><td>Longitude:</td><td><form:input path="locationLongitude"/></td></tr>
36-
37-
<c:if test="${(not empty cp.chargeBox.locationLongitude) and (not empty cp.chargeBox.locationLongitude)}">
38-
<tr>
39-
<td></td>
40-
<td><a target="_blank"
41-
href="https://maps.google.com/?q=${cp.chargeBox.locationLatitude},${cp.chargeBox.locationLongitude}">
42-
Show on Google Maps</a>
43-
</td>
44-
</tr>
45-
</c:if>
4634

4735
<tr><td>Additional Note:</td><td><form:textarea path="note"/></td></tr>
4836
<tr><td></td>
4937
<td id="add_space">
5038
<input type="submit" name="${submitButtonName}" value="${submitButtonValue}">
5139
<input type="submit" name="backToOverview" value="Back to Overview">
5240
</td></tr>
53-
</table>
41+
</table>

0 commit comments

Comments
 (0)