如何让node.js服务器在输入无效网址时将用户重定向到404.html页面?
我做了一些搜索,看起来大多数结果都是针对Express,但我想在纯node.js中编写我的服务器.
我一直在使用JSF处理一个简单的Java EE项目.
<h:form id="phoneForm">
<h:dataTable id="phoneTable">
</h:dataTable>
</h:form>
Run Code Online (Sandbox Code Playgroud)
我试图通过设置CSS #phoneTable { ... },但它不起作用.在客户端检查HTML源代码时,JSF生成的HTML表格似乎以形式获取客户端ID id="phoneForm:phoneTable".我无法应用CSS via #phoneForm:phoneTable { ... },因为冒号表示伪选择器的开始并导致错误.
我怎么能在CSS选择器中使用它呢?
当我使用专有的html属性时,Syntastic的lint工具会不断警告我,这一点令人困惑,尤其是在使用Angular指令时.

这很快就淹没了我的html中的实际错误,减少了linter错误的值,并增加了视觉噪音.
无论如何要避免这种情况吗?
我有一个Exception类:
namespace abc;
class AbcException extends Exception {
// blah blah
}
Run Code Online (Sandbox Code Playgroud)
它会产生以下错误:
Class 'abc\Exception' not found ...
Run Code Online (Sandbox Code Playgroud)
问题:
我能做些什么来完成这项工作?
有用的文件表示赞赏.
感谢您阅读我的问题
我正在寻找一种渲染404页面的好方法,而不是在angularjs中重定向404页面.我发现的许多解决方案都是关于重定向到另一个页面.如果用户点击浏览器的后退按钮,我将创建另一个重定向到404页面的问题.所以我正在寻找一个渲染404页面的解决方案.
感谢您的阅读,我希望这对您们来说是可以理解的.
我想在"我的网站"的左侧创建Sticky Side Navbar.我正在使用Bootstrap 3 RC2.我不知道如何创建它.
我尝试编写这些代码来通过CSS制作网格视图:( jsbin)
var tables = document.getElementsByClassName('tableData');
var rows = tables[0].getElementsByTagName('tr');
for(var i=1; i<rows.length; i +=2) {
alert(rows[i]);
rows[i].className = "alt";
}
Run Code Online (Sandbox Code Playgroud)
这只适用于tr元素class="" .但是,如果我想将类添加到tr.我已经尝试过Core.addClass,但它不起作用.
class Node
{
public:
Node *parent; // used during the search to record the parent of successor nodes
Node *child; // used after the search for the application to view the search in reverse
float g; // cost of this node + it's predecessors
float h; // heuristic estimate of distance to goal
float f; // sum of cumulative cost of predecessors and self and heuristic
Node() :
parent( 0 ),
child( 0 ),
g( 0.0f ),
h( 0.0f ), …Run Code Online (Sandbox Code Playgroud) 这真让我困惑,我觉得我很蠢,但我已经搜索过并尽我所能.每当我声明一个视图并使用jasmine运行BDD测试时,它总是返回"undefined is not a function".这是代码
window.LocationView = Backbone.View.extend({
initialize: function() {
// create new marker first
this.marker = new google.maps.Marker({
title: this.model.get('name'),
draggable: true,
animation: google.maps.Animation.DROP,
position: new google.maps.LatLng(this.model.get('lat'), this.model.get('long')), // give the position here
});
// bind events
this.model.bind('change', this.render, this);
},
render: function() {
this.marker.setTitle(this.model.get("name"));
this.marker.setPosition(new google.maps.LatLng(this.model.get('lat'), this.model.get('long')));
},
});
Run Code Online (Sandbox Code Playgroud)
这是我宣布的方式:
this.view = new LocationView({model: this.location});
this.view = new LocationView();
// neither of these ones work.
Run Code Online (Sandbox Code Playgroud)
当我使用jasmine运行此代码时,这是错误:
TypeError: undefined is not a function
at [object Object].make (http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.5.3/backbone-min.js:29:37)
at …Run Code Online (Sandbox Code Playgroud) I compile my simple prog with #include <sys/socket.h> but there's none of this file.
Where is it, I just start coding in linux and I have no idea where is it . Or do we need to download it online .
angularjs ×2
c++ ×2
javascript ×2
backbone.js ×1
clientid ×1
constructor ×1
css ×1
facelets ×1
initializer ×1
jquery ×1
jsf ×1
linux ×1
namespaces ×1
node.js ×1
php ×1
redirect ×1
syntastic ×1
vim ×1