try to pass by value between two controllers

This commit is contained in:
hjd
2015-11-25 22:47:35 +08:00
parent 5ff5b951e7
commit 26a2861b7b
8 changed files with 105 additions and 65 deletions

View File

@@ -5,7 +5,7 @@ log4j.appender.stdout.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-
# Output to the File # Output to the File
log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=./zhongchou.log log4j.appender.file.File=./jinshan.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n log4j.appender.file.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n

View File

@@ -1,45 +1,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd";>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<html ng-app="LoginApp"> <html ng-app="ReportListApp">
<head> <head>
<link rel="stylesheet" <link rel="stylesheet"
href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css"> href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="http://apps.bdimg.com/libs/angular.js/1.3.9/angular.min.js"></script> <script src="http://apps.bdimg.com/libs/angular.js/1.3.9/angular.min.js"></script>
</head> </head>
<body ng-controller="LoginController"> <body ng-controller="ReportController">
<div align="center"> aa{{report}}
<div> <script src="/js/app/ReportListApp.js"></script>
<img src="/img/logo.png" width="196" height="46"> <script src="/js/controller/ReportController.js"></script>
</div>
<div class="input-group">
<input type="text" class="form-control" placeholder="Username"
ng-model="user_name">
</div>
<br>
<div class="input-group">
<input type="password" class="form-control" placeholder="password"
ng-model="password">
</div>
<br>
<div>
<input type="checkbox"> Remember me
<button class="btn btn-success" ng-disabled="incomplete"
type="submit" ng-click="login()">
<span class="glyphicon glyphicon-hand-right"></span> SIGN-IN
</button>
</div>
</div>
<script src="/js/app/LoginApp.js"></script>
<script src="/js/controller/LoginController.js"></script>
</body> </body>
</html> </html>

View File

@@ -9,23 +9,24 @@
<body ng-controller="ReportListController"> <body ng-controller="ReportListController">
<br> <br>
<h4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>б<EFBFBD></h3> <h4>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>б<EFBFBD>
</h3>
<hr> <hr>
<ul> <ul>
<div ng-repeat="report in reportList"> <div ng-repeat="report in reportList">
<a <a ng-click="goToReport(report.report_id)" href="/html/report.html"><ui>{{report.report_name}}</ui></a>
href="http://localhost/report/query?report_id={{report.report_id}}"><ui>{{report.report_name}}</ui></a> </div>
</div> </ul>
</ul> <hr>
<hr>
<script src="/js/app/ReportListApp.js"></script> <script src="/js/app/ReportListApp.js"></script>
<script src="/js/controller/ReportListController.js"></script> <script src="/js/controller/ReportListController.js"></script>
</body> </body>
</html> </html>

View File

@@ -1 +1 @@
var app = angular.module("LoginApp", []); var app = angular.module("ReportApp", []);

View File

@@ -1,13 +1,11 @@
app.controller("ReportListController", function($scope, $http) { app.controller("ReportController", function($scope, $http, $rootScope) {
$http.get("http://localhost/summaryPlan/reportList").success(
function(response) {
if (response.status == "SUCCESS") {
$scope.reportList = response.data; var report_id = $rootScope.root_report_id;
} alert(report_id);
else{
// $http.get("http://localhost/summaryPlan/reportlist"); // $http.get("/report/query?report_id=" + 1)
} // .success(function(response) {
}); // $scope.report = response;
// });
}); });

View File

@@ -1,7 +1,16 @@
app.controller("ReportListController", function($scope, $http) { app.controller("ReportListController", function($scope, $http, $rootScope) {
$http.get("http://localhost/report/reportList").success(function(response) { $http.get("/report/reportList").success(function(response) {
$scope.reportList = response.reportList; $scope.reportList = response.reportList;
}); });
$scope.goToReport = function(report_id) {
alert(report_id);
$rootScope.root_report_id = report_id;
}
}); });

60
jinshan.log Normal file
View File

@@ -0,0 +1,60 @@
2015-11-25 22:27:16
[WARN]-[Thread: qtp1549409129-26]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:27:16
[WARN]-[Thread: qtp1549409129-26]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:29:18
[WARN]-[Thread: qtp1549409129-26]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:29:18
[WARN]-[Thread: qtp1549409129-26]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:29:46
[WARN]-[Thread: qtp1549409129-24]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:29:46
[WARN]-[Thread: qtp1549409129-24]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:29:51
[WARN]-[Thread: qtp1549409129-29]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:29:51
[WARN]-[Thread: qtp1549409129-29]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:30:45
[WARN]-[Thread: qtp1549409129-26]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:30:45
[WARN]-[Thread: qtp1549409129-26]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:30:48
[WARN]-[Thread: qtp1549409129-29]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:30:48
[WARN]-[Thread: qtp1549409129-29]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:30:53
[WARN]-[Thread: qtp1549409129-28]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:30:53
[WARN]-[Thread: qtp1549409129-28]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:30:59
[WARN]-[Thread: qtp1549409129-29]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:30:59
[WARN]-[Thread: qtp1549409129-29]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:33:58
[WARN]-[Thread: qtp1549409129-24]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:33:58
[WARN]-[Thread: qtp1549409129-24]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined
2015-11-25 22:34:05
[WARN]-[Thread: qtp1549409129-28]-[com.jfinal.core.ActionException.<init>()]: Can not parse the parameter "undefined" to Integer value.
2015-11-25 22:34:05
[WARN]-[Thread: qtp1549409129-28]-[com.jfinal.core.ActionHandler.handle()]: 404 Not Found: /report/query?report_id=undefined

View File

@@ -5,7 +5,7 @@ log4j.appender.stdout.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-
# Output to the File # Output to the File
log4j.appender.file=org.apache.log4j.FileAppender log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=./zhongchou.log log4j.appender.file.File=./jinshan.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n log4j.appender.file.layout.ConversionPattern=%n%-d{yyyy-MM-dd HH:mm:ss}%n[%p]-[Thread: %t]-[%C.%M()]: %m%n