我试图在Java Web应用程序中获取项目上下文路径.我的项目位于D:\GED\WSysGED目录中,我希望获得该路径.在我的研究中,我发现了两种方法:首先使用System.getProperty如下:
String path= System.getProperty("user.dir");
System.out.println(path);
Run Code Online (Sandbox Code Playgroud)
但是该代码返回D:\eclipse-jee-luna-R-win32\eclipse,Eclipse可执行文件所在的位置.
第二种方法是使用servlet.
我在本教程后创建了一个
public class ContextPathServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
ServletContext servletContext = getServletContext();
String contextPath = servletContext.getRealPath("/");
PrintWriter out = response.getWriter();
out.println("<br/>File system context path (in TestServlet): " + contextPath);
}
}
Run Code Online (Sandbox Code Playgroud)
但它正在显示 C:\Users\Juan\SysGED\.metadata\.plugins\org.eclipse.wst.server.core\tmp6\wtpwebapps\WSysGED
获得项目路径的正确方法是什么?
我正在使用primefaces 5开发一个项目,一个页面使用需要jquery的js文件,但显示Uncaught TypeError: undefined is not a function,但当我将我的jquery源更改<h:outputScript library="primefaces" name="jquery/jquery.js" target="head"/>为
<h:head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
</h:head>
Run Code Online (Sandbox Code Playgroud)
工作正常,但我失去了许多主要功能,如 contexMenu
我该如何解决这个冲突?
这是我的javascript文件:
(function($, $S) {
//$ jQuery
//$S window.localStorage
//Variables Declaration
var $board = $('#notesForm\\:board'),
//Board where the Posticks are sticked
Postick, //Singleton Object containing the Functions to work with the LocalStorage
len = 0, //Length of Objects in the LocalStorage
currentNotes = '', //Storage the html construction of the posticks
o; //Actual Postick data …Run Code Online (Sandbox Code Playgroud) 我使用的是jsf版本2.1 primefaces 5.1和tomcat 7.
我必须在多个上传组件中成功完成所有上传后执行托管bean方法,我使用了onComplete属性,但是在每次上传后执行.所有文件上传完成后我需要这样做.怎么识别?
提前感谢您的时间和答案
PD我在primefaces 1论坛上发布了这个问题,但没有人回答.
我是角色JS的漂亮菜鸟,我正面临着问题.instruccion console.log($ routeParams)向我展示了一条路线,但我不知道为什么.我使用离子yeoman发生器创建了我的proyect.
这是在我的视图内(生成像这样的网址http:// localhost:8100 /#/ app/tracking/50)
<p ng-repeat="item in items">
<a href="#/app/tracking/{{item .number}}" class="item item-icon-left">
<i class="icon ion-home"></i>
{{item .a}} - {{item .b}}
</a>
</p>
Run Code Online (Sandbox Code Playgroud)
我在app.js中的路由器配置
.state('app.tracking', {
url: "/tracking/:idItem",
data: {
requireLogin: true
},
views: {
'menuContent': {
templateUrl: "templates/tracking.html",
controller: 'TrackingCtrl'
}
}
})
Run Code Online (Sandbox Code Playgroud)
这是我的控制器(我尝试以这些方式访问)
.controller('TrackingCtrl', function($scope,$routeParams) {
console.log($routeParams);
console.log($routeParams.idItem);
console.log($routeParams["idItem"]);
})
Run Code Online (Sandbox Code Playgroud)
我在这里定义了ngRoute int app.js
angular.module('starter', ['ionic','angular- md5','ngCordova','starter.controllers','ngRoute'])
Run Code Online (Sandbox Code Playgroud)
最后,对凉亭组件的引用就是索引
<script src="bower_components/angular-route/angular-route.js"></script>
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的时间