Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Hibernate Spatial访问Spring NVC坐标的z值_Java_Hibernate_Spring Mvc_Oracle Spatial_Jts - Fatal编程技术网

Java 使用Hibernate Spatial访问Spring NVC坐标的z值

Java 使用Hibernate Spatial访问Spring NVC坐标的z值,java,hibernate,spring-mvc,oracle-spatial,jts,Java,Hibernate,Spring Mvc,Oracle Spatial,Jts,我正在构建一个SpringMVC应用程序,它使用一个包含3D几何图形的Oracle空间数据库。我使用Hibernate Spatial来访问它,但由于我对Spring比较陌生,对Java也比较陌生,我发现很难访问视图的z坐标。代码如下: Deposit.java DepositController.java 存款/index.jsp 我知道JTS的点类型不公开z坐标,它可以通过坐标对象访问。代码deposit.getGeometry.getCoordinates.z起作用,我如何使它在.jsp视

我正在构建一个SpringMVC应用程序,它使用一个包含3D几何图形的Oracle空间数据库。我使用Hibernate Spatial来访问它,但由于我对Spring比较陌生,对Java也比较陌生,我发现很难访问视图的z坐标。代码如下:

Deposit.java DepositController.java 存款/index.jsp 我知道JTS的点类型不公开z坐标,它可以通过坐标对象访问。代码deposit.getGeometry.getCoordinates.z起作用,我如何使它在.jsp视图中起作用

谢谢

我怀疑${depost.geometry.x}正在被重写为depost.getGeometry.getX,而getX是该类上存在的一个方法,因此它可以工作

类似地,${deposit.geometry.coordinate.z}将被重写为deposit.getGeometry.getCoordinate.getZ,该方法不存在

我只需要将X、Y和Z的getter添加到Deposit类中,然后使用

${deposit.x}
${deposit.y}
${deposit.z}

您使用的是哪种类型的Point类?i、 e.包括包名.com.livitSolutions.jts.geom.point很高兴知道我做了正确的事情,因为这就是我最终所做的!但是我想知道JSTL是否可以在不需要getter的情况下访问z值。无论如何,由于以下缺陷,访问z值是毫无意义的:
package com.example.project;

import ...

@Controller
public class DepositController {
  private DepositService depositService;

  @Autowired(required = true)
  @Qualifier(value = "depositService")
  public void setDepositService(DepositService ds) { 
    this.depositService = ds;
  }

  //Index
  @RequestMapping(value = "/deposits", method = RequestMethod.GET)
  public String listDeposits(Model model) {
    model.addAttribute("listDeposits", this.depositService.listDeposits());
    return "deposits/index";
  }
}
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ page session="false" %>
<html>
  <head>
    <title>Deposits Page</title>
  </head>
  <body>
    <c:if test="${!empty listDeposits}">
      <table>
        <tr>
          <th>Deposit ID</th>
          <th>Deposit Name</th>
          <th>Longitude</th>
          <th>Latitude</th>
          <th>Height</th>
        </tr>
        <c:forEach items="${listDeposits}" var="deposit">
          <tr>
            <td>${deposit.id}</td>
            <td>${deposit.name}</td>
            <td>${deposit.geometry.x}</td>
            <td>${deposit.geometry.y}</td>
            <td>${deposit.geometry.coordinate.z}</td>
          </tr>
        </c:forEach>
      </table>
    </c:if>
  </body>
</html>
${deposit.x}
${deposit.y}
${deposit.z}