我试图UITableView用一些数据显示一个简单的.我希望设置静态高度,UITableView以便它不会在表的末尾显示空单元格.我怎么做?
码:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"%d", [arr count]);
return [arr count];
}
Run Code Online (Sandbox Code Playgroud) 我开始学习swift遵循The Swift Programming LanguageApple提供的iBook- on Swift.该书说要创建一个空字典,应该使用[:]相同的方法,同时将数组声明为[]:
我声明了一个空数组如下:
let emptyArr = [] // or String[]()
Run Code Online (Sandbox Code Playgroud)
但是在声明空字典时,我得到语法错误:
let emptyDict = [:]
Run Code Online (Sandbox Code Playgroud)
如何申报空字典?
可能重复:
使用JPA选择前1个结果
我希望在写下以下查询时根据我的表'MasterScrip'提交的'totalTradedVolume'获取前10个结果:
Collection<MasterScrip> sm=null;
sm=em.createQuery("select m from MasterScrip m where m.type = :type order by m.totalTradedVolume limit 2").setParameter("type", type).getResultList();
Run Code Online (Sandbox Code Playgroud)
我得到以下异常:
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [select m from MasterScrip m where m.type = :type order by m.totalTradedVolume limit 2], line 1, column 78: unexpected token [limit].
Internal Exception: NoViableAltException(80@[])
Run Code Online (Sandbox Code Playgroud)
我的jpa查询有问题.任何人都可以纠正我吗?
我有以下要求:应显示包含编辑和删除链接的所有项目的列表.当用户点击编辑时,编辑表单应显示文本框和保存按钮.现在,当用户编辑数据并单击保存按钮时,应保存数据,并且列表页面应再次显示修改后的数据.一切正常,但我如何通过angularjs中的路由再次重定向到列表页面?下面是一些代码:
路由控制器:
angular.module('productapp', []).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/productapp', {templateUrl: 'partials/productList.html', controller: productsCtrl}).
when('/productapp/:productId', {templateUrl: 'partials/edit.html', controller: editCtrl}).
otherwise({redirectTo: '/productapp'});
}]);
Run Code Online (Sandbox Code Playgroud)
编辑表格:
<div>
<form method="POST">
<label>Add New Product:</label>
<input type="text" name="keywords" ng-model="product.name" placeholder="enter name..." value="{{product.name}}">
<input type="text" name="desc" ng-model="product.description" placeholder="enter description..." value="{{product.description}}">
<button type="submit" ng-click="save(product.product_id,$event)" >Save</button>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
我如何重定向到相同的列表页面?
我希望创建一个包含多个标签的单个html文件.这些应该作为单独的单独视图,通常保存在partials文件夹中.然后我希望在路由控制器中指定它们.现在我正在做如下:app.js
angular.module('productapp', []).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/productapp', {templateUrl: 'partials/productList.html', controller: productsCtrl}).
when('/productapp/:productId', {templateUrl: 'partials/edit.html', controller: editCtrl}).
otherwise({redirectTo: '/productapp'});
}],
['$locationProvider', function($locationProvider) {
$locationProvider.html5Mode = true;
}]);
Run Code Online (Sandbox Code Playgroud)
的index.html
<!DOCTYPE html>
<html ng-app = "productapp">
<head>
<title>Search form with AngualrJS</title>
<script src="../angular-1.0.1.min.js"></script>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="js/products.js"></script>
<script src="js/app.js"></script>
</head>
<body>
<div ng-view></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在partials文件夹中:我有2个名为edit.html和productlist.html的html视图
我希望将它们组合成一个独立的文件而不是创建这两个文件,并通过路由调用它们(div).我该怎么做呢?
我在应用程序启动页面加载时收到以下错误:
SEVERE: Error Rendering View[/HomeTemplate/equityVolume.xhtml]
javax.el.ELException: /HomeTemplate/equityVolume.xhtml @70,78 value="#{equityBean.scripList}": java.lang.IllegalStateException: PWC3999: Cannot create a session after the response has been committed...
Caused by: java.lang.IllegalStateException: PWC3999: Cannot create a session after the response has been committed...
Run Code Online (Sandbox Code Playgroud)
当我将css应用到我的主页时出现此错误,当我删除css模板时错误消失(但我想填写css模板)以下是导致错误的bean代码片段(通过调试找到)
public List<MasterScrip> getScripList() {
HttpServletRequest req=(HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); //error line
HttpSession session=req.getSession();
type=(String)session.getAttribute("type");...
Run Code Online (Sandbox Code Playgroud)
xhtml代码:
<h:body>
<ui:composition template="commonClientLayout.xhtml">
<ui:define name="contentFile">
<div id="content">
<h:form id="frm">...
Run Code Online (Sandbox Code Playgroud)
当我删除ui:组合并定义标签(即如果我不应用css),那么我不会得到这个错误.什么可能导致这个错误,我该如何解决?
编辑:
@PostConstruct
void initialiseSession() {
if(type!=null)
{
if(type.equalsIgnoreCase("losers"))
{
scripList=new ArrayList<MasterScrip> ();
scripList=getScripByPriceLosers(exchange);
// return scripList;
}
else if(type.equalsIgnoreCase("gainers"))
{
scripList=new ArrayList<MasterScrip> …Run Code Online (Sandbox Code Playgroud) 我正在使用带有backbone.js的jQuery Mobile.当我加载主页时,我收到以下错误:
Uncaught TypeError: Cannot call method '_trigger' of undefined
Run Code Online (Sandbox Code Playgroud)
这是我做的加载主页.在routes.js中:
routes:{
'':'home',
}
home:function () {
new HomeView();
this.changePage(new HomeContentView());
},
changePage:function (page) {
$(page.el).attr('data-role', 'page');
console.log($(page.el));
page.render();
$('body').append($(page.el));
var transition = $.mobile.defaultPageTransition;
if (this.firstPage) {
transition = 'none';
this.firstPage = false;
}
$.mobile.changePage($(page.el), {changeHash:false, transition: transition});
}
Run Code Online (Sandbox Code Playgroud)
在view.js中
window.HomeView = Backbone.View.extend({
template : Handlebars.compile($('#home').html()),
render : function (eventname) {
this.$el.html(this.template());
this.header = new HeaderElement();
this.$el.find('div.header_element').append(this.header.$el);
this.footer = new FooterElement();
this.$el.find('div.footer_element').append(this.footer.$el);
return this;
}
});
window.HomeContentView = Backbone.View.extend({
initialize: …Run Code Online (Sandbox Code Playgroud) 我正在开发一个包含许多UIView的iOS应用程序.UINavigation用于在这些视图之间导航.
我的一个UIView包含UITextField.我的问题是,当我缩放它时显示另一个视图的内容.我没有添加任何缩放代码.
下面是我实际设计的屏幕截图.
在缩放时,它显示导航的根视图

此外,它在模拟器上正常工作.当我在设备上测试应用程序时检测到此问题.
提前致谢
我在2个系统(笔记本电脑)中有相同的应用程序,但它在一个但不在另一个系统中工作.我在另一个系统中得到以下错误.我也发布了下面的代码.我想做的是使用调用不同托管bean方法的按钮级联下拉列表,以及在数据库中添加记录的placeOrder按钮.但是我在页面时遇到以下错误装载
WARNING: Setting non-serializable attribute value into ViewMap: (key: stockOrderBean, value class: beans.stockOrderBean)
SEVERE: Error Rendering View[/ClientTemplate/stockTrade.xhtml]
java.io.NotSerializableException: beans.stockOrderBean
WARNING: JSF1087: Unable to generate Facelets error page as the response has already been committed.
SEVERE: javax.faces.FacesException: beans.stockOrderBean
Run Code Online (Sandbox Code Playgroud)
xhtmlcode:
<h:outputText value="Exchange :"/>
<p:selectOneMenu value="#{stockOrderBean.exchange}" style="width: 200px">
<f:selectItem itemLabel="Select Exchange"/>
<f:selectItem itemLabel="NSE" itemValue="nse"/>
<f:selectItem itemLabel="BSE" itemValue="bse"/>
<p:ajax update="sym" listener="#{stockOrderBean.wow}"/>
</p:selectOneMenu>
<h:outputText value="Select ScripSymbol :"/>
<p:selectOneMenu value="#{stockOrderBean.scripID}" style="width: 200px" id="sym">
<f:selectItem itemLabel="Select scrip"/>
<f:selectItems var="scrip" value="#{stockOrderBean.sl}" itemLabel="#{scrip.scripSymbol}" itemValue="#{scrip.scripID}"/>
</p:selectOneMenu>
<p:commandButton value="Get Quote" actionListener="#{stockOrderBean.equity.setQuote}" …Run Code Online (Sandbox Code Playgroud) 我试图在angularjs应用程序中使用路由,如下所示:
app.js
angular.module('productapp', []).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/productapp', {templateUrl: 'partials/productList.html', controller: productsCtrl}).
//~ when('/productapp/:phoneId', {templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl}).
otherwise({redirectTo: '/productapp'});
}]);
Run Code Online (Sandbox Code Playgroud)
controller.js
function productsCtrl($scope, $http, $element) {
//~ $scope.url = 'php/search.php'; // The url of our search
// The function that will be executed on button click (ng-click="search()")
$http.get('php/products.php').success(function(data){
alert("hi");
$scope.products = data;
});
$scope.search = function() {
var elem = angular.element($element);
var dt = $(elem).serialize();
dt = dt+"&action=index";
alert(dt);
console.log($(elem).serialize());
$http({
method: 'POST',
url: 'php/products.php',
data: dt,
headers: …Run Code Online (Sandbox Code Playgroud) angularjs ×3
ios ×3
java ×3
routing ×3
java-ee ×2
jsf ×2
managed-bean ×2
backbone.js ×1
dictionary ×1
jpa ×1
objective-c ×1
persistence ×1
routes ×1
session ×1
swift ×1
uitableview ×1
uitextfield ×1
uiview ×1
zoom ×1