當前位置:首頁 » 網頁前端 » runtheweb
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

runtheweb

發布時間: 2023-05-12 04:06:05

『壹』 web前端常用的框架有哪些

現在比較常用的主流框架有Vue、React、Angular。
Angular
Angular原名angularJS誕生於2009年,之前我們都是用jquery開發,自從angular的出現讓我們有了新的選擇,它最大的特點是把後端的一些開發模式移植到前端來實現,如MVC、依賴注入等,創新式的雙向數據綁定不知簡化了我們多少代碼,讓我們為之瘋狂,特別是表單處理方面,從此名聲大噪。
好的框架一般會有兩個結果,一個繼續不斷更新迭代,避免被拍死在沙灘上,一個是被一些大公司收購煥發第二春,angular屬於後者被google所收購,且從2.0後改名angular並使用微軟的typescript作為開發語言,目前最新版本8.0,照說傍上google與微軟這兩條大船,前途應該不可限量才對,然而造化弄人,現在angular的市場份額已經被React這個後起之秀和Vue這顆新星遠遠地甩到腦後。
React
React,facebook出品,正式版推出是在2013年,比angular晚了4年,但得益於其創新式的VirtualDOM,性能上碾壓angularJS,一經推出,火的一塌糊塗。 特點很多,VirtualDOM、JSX、Diff演算法等,支持ES6語法,採用函數式編程,門檻稍高,但也更靈活,能讓開發具有更多可能性。
Vue
Vue作為最後推出的框架(2014年),借鑒了前輩angular和react的特點(如VirtualDOM、雙向數據綁定、diff演算法、響應式屬性、組件化開發等)並做了相關優化,使其使用起來更加方便,更容易上手,比較少適合初學者。網上有很多人說Vue不適合做大型項目,純屬扯淡,Vue在這方面已經優化得很好,當然,大量的響應式屬性(監聽屬性)也許會用一定的性能損耗,但在硬體、網路大力發展的今天,這些細微的性能差異幾乎感覺不到。

『貳』 如何用Node去寫一個Web應用框架

第一步,用node輸出一個hello world

varhttp=require('http');
http.createServer(function(req,res){
varurlPares=url.parse(req.url);
varquery=querystring.parse(urlPares.query);
res.end('helloworld');
}).listen(80);


大部分的node教程在這里會告訴你,我們很容易的建立的一個伺服器。但是在實際使我們通常使用的是express.(f**k,難道Node必須要用express嗎?自己實現一個Web應用框架真的很難嗎?)其實並不是。
那麼既然打算自己寫我們首先要知道我們要做哪些事情。 1.路由或者智能路由 2.靜態文件輸出 3.session/cookie 4.模版渲染 5.資料庫處理 6.文件上傳
第二步,路由
路由好高大上的名字,它是幹啥的?url對應具體方法就是它該做的事情。 那麼我們為什麼不讓url對應xxx文件的xx方法。 例如:/user/login能不能自動對應到user.js的login方法上。實現起來很難么?其實只需要幾句代碼

varfs=require("fs");
mole.exports=function(req,res){
varquery=req.query;
varurlPares=req.urlPares;
varpathname=urlPares.pathname;
vararr=pathname.split("/");
req.arr=arr;
//start這段代碼處理默認行為。可以先忽略
if(arr.length==0||arr.length==1){
arr=["","index","index"];
}elseif(arr.length==2){
arr.push("index");
}
if(arr[1]==""){
arr[1]="index";
}
if(arr[2]==""){
arr[2]="index";
}
//end這段代碼處理默認行為。可以先忽略
if(fs.existsSync(APP_PATH+'/controller/'+arr[1]+'.js')){
varcontroller=require('./controller/'+arr[1]);
if(controller[arr[2]]){
controller[arr[2]](req,res);
}else{
res.writeHead(404,{'Content-Type':'text/plain'});
res.end("你訪問的控制器不存在指定方法");
}
}else{
res.writeHead(404,{'Content-Type':'text/plain'});
res.end("你訪問的路徑不存在");
}
}


通過fs判斷文件是否存在。然後去require它就行了。APP_PATH是個全局變數表示程序入口的路徑。
第三步,靜態文件輸出
靜態文件輸出我們需要一個庫MIME

varurl=require("url");
varfs=require("fs");
varmime=require('mime');
/**
*[[檢測是否為靜態資源]]
*@param{Object}req[[Description]]
*@param{[[Type]]}res[[Description]]
*@returns{bool}[[Description]]
*/
mole.exports=function(req,res){
//正則表達式檢測文件後綴
varurl_resource_reg=/.*.(html|htm|gif|jpg|jpeg|bmp|webp|htc|swf|png|ico|txt|js|css)/;
if(!url_resource_reg.test(req.url)){
returnfalse;
}
varurlPares=url.parse(req.url);
varpathname=urlPares.pathname;
varfileUrl=APP_PATH+"/static"+pathname;
if(fs.existsSync(fileUrl)){
varcontentType=mime.lookup(fileUrl);
res.setHeader('Content-Type',contentType||"text/plain");
varfileStream=fs.createReadStream(fileUrl);
fileStream.pipe(res);
fileStream.on('end',function(){
res.end();
});
returntrue;
}else{
returnfalse;
}
}
第四步,session/cookie
這里稍微有點。但是代碼量也不多
varsessions={};
varsessionKey='session_key';
varEXPIRES=30*60*1000;
functionrandString(size){
varresult='';
varallChar='';
size=size||1;
while(size--){
result+=allChar.charAt(rand(0,allChar.length-1));
}
returnresult;
}
vargenerate=function(){
varsession={};
session.id=Date.now()+randString(12);
session.cookies={
expire:Date.now()+EXPIRES
}
sessions[session.id]=session;
returnsession;
}
varparseCookie=function(cookie){
varcookies={};
if(!cookie){
returncookies;
}
varlist=cookie.split(";");
for(vari=0;i<list.length;i++){
varpair=list[i].split("=");
cookies[pair[0].trim()]=pair[1];
}
returncookies;
}
varserializeCookies=function(cookies){
vararr=[];
for(varkeyincookies){
arr.push(serialize(key,cookies[key]));
}
returnarr;
}
varserialize=function(name,value,option){
varpairs=[name+'='+encodeURI(value)];
//設置cookie默認共用"/"路徑
option=option||{
path:"/"
};
if(option.maxAge)pairs.push('Max-Age='+option.maxAge);
if(option.domain)pairs.push('Domain='+option.domain);
if(option.path)pairs.push('Path='+option.path);
if(option.expires)pairs.push('Expires='+option.expires);
if(option.httpOnly)pairs.push('HttpOnly');
if(option.secure)pairs.push('Secure');
returnpairs.join(';');
}
mole.exports=function(req,res){
req.cookies=parseCookie(req.headers.cookie);
varid=req.cookies[sessionKey];
if(!id){
req.session=generate();
}else{
varsession=sessions[id];
if(session){
if(session.cookies.expire>Date.now()){
session.cookies.expire=Date.now()+EXPIRES;
req.session=session;
}else{
deletesessions[id];
req.session=generate();
}
}else{
req.session=generate();
}
}
for(varkeyinsessions){
if(sessions[key].cookies.expire<Date.now()){
deletesessions[key];
}
}
varwriteHead=res.writeHead;
res.writeHead=function(){
deletereq.cookies[ham_sessionKey];
varsessionStr=serialize(ham_sessionKey,req.session.id);
res.setHeader('Set-Cookie',serializeCookies(req.cookies).concat(sessionStr));
returnwriteHead.apply(res,arguments);
}
}

第五步,模版渲染

這是最簡單的。

第六步,資料庫處理

這里可以是用一些ORM框架。

第七步,文件上傳,post

第八步,就是你把上面的代碼組織起來。

『叄』 英語翻譯:Web用戶界面介紹

Web User Interface
Introction
Run Web browser on your computer, type in the address field: https://<system IP address, then press ENTER for opening the login page of the Polycom ® RSS™ 4000 system. Log into the system with your username and password. The default administrator account is "admin" (both for username and password).
The Web user interface is basically made up of the following 4 parts:
·Menu bar: offer all figuration available function group, the manu will stir to the detailed functional figuration page.
·Page control group: provide operations for Web page control
- Show login info and set font
- Quit Web figuration page
- Lock Web figuration page. The page will be locked on clicking this button, and password is needed for further operations.
·Navigation/Operation bar: Offer interlinked functional page link. Available items for operation will be demonstrated on this page.
·List/Figuration field: Show item list, detailed parameters or figuring item.
Web page has prepared different login pages for users of different ranks and identities. An administrator will see the following page on a successful login:

Fig. 1-1 Illustration of Polycom ® RSS™ 4000 Web page

『肆』 如何安裝配置TAM的WEB管理工具

首先安裝was60。
之後安裝wpm,並且使用pdjrtecfg 和amwpmcfg進行配置螞粗
安裝前提:
1. 以Administrators組用戶登錄。
2. 啟動registry server和policy server。 (in normal mode).
3. 安裝IBM Java Runtime 1.4.2 SR2 provided with Tivoli Access Manager is installed. For instructions, see page 322.
a.執行悶李鎮命令windowsJDKibm-java-2-sdk-142.exe
b.設定PATH環境變數擾做:
set PATH=install_dir;%PATH%
例如:set PATH=C:IBMJava142jrebin;%PATH%
c. 設置JAVA_HOME:
set JAVA_HOME=c: IBMJava142jre
d. Add the GSKit bin and lib directories to the PATH variable. For example:
Install IBM Global Security Kit (GSKit), if not already installed.
在windowsGSKit 路徑下運行setup PolicyDirector命令
set PATH=C:IBMgsk7bin;%PATH%
set PATH=C:IBMgsk7lib;%PATH%
7. Install IBM WebSphere Application Server Refresh Pack. For instructions, see page 337.
8. Insert the IBM Tivoli Access Manager Base for Windows CD.
9. Install the Tivoli Access Manager packages. To do so, run the setup.exe file located in the following directory: windowsPolicyDirectorDisk ImagesDisk1
選擇以下組件:
v Access Manager License
v Access Manager Runtime for Java
v Access Manager Web Portal Manager
Configure the Access Manager Runtime for Java component for use within the Java Runtime Environment installed with WebSphere.
To do so, follow these steps:
a. Stop the WebSphere Application Server and the IBM HTTP Server
.
d. Optional: You can use the IBM WebSphere setupCmdLine script to reset environment variables, including the location of the Java Runtime Environment, before configuring Access Manager Runtime for Java and Web Portal Manager.
1) Run the which java command from the command line to show the default PATH settings being used. For example, the command shows that Java is currently being run from the /usr/bin/java directory.
2) To update the PATH environment variable and reset the JAVA_HOME variable, edit the setupCmdLine.bat file and change the environment variable as needed.
3) Enter: C:Program FilesIBM|.bat Set the JAVA_HOME variable to the Java Runtime Environment that has been configured for Access Manager Runtime for Java. The JAVA_HOME variable should be set to the top directory. C:Program
(還執行了之前設path的操作)
b. Change to the install_dirsbin directory (for example, C:Program FilesTivoliPolicy Directorsbin), and enter the following command: pdjrtecfg -action config -interactive
c. Select the Full configuration type and click Next. For descriptions of the configuration options, click Help.
e. Specify the Java Runtime Environment that was installed with IBM WebSphere Application Server. For example: C:Program jre Click Next to continue.
有的時候會有這樣的錯誤:
說明之前安裝過一次,可以先unconfig:
pdjrtecfg –action unconfig -java_home C:IBMJava142jre
f. Specify the policy server host name, port, and domain. Click OK to start configuration.
g. When configuration has completed successfully, click OK to exit the configuration utility. For more information about this utility, see 「pdjrtecfg」 on page 578.
12. Configure the Access Manager Web Portal Manager package.
To do so, follow these steps:
a. Change to the install_dirsbin directory (for example, C:Program FilesTivoliPolicy Directorsbin), and enter the following command: amwpmcfg -action config -interactive Specify the necessary configuration parameters, such as IBM WebSphere Application Server installation path, the policy server host name and port number, and the Tivoli Access Manager administrator ID and password.
set PATH=C:;%PATH%
set PATH=C:;%PATH%
啟動application server
amwpmcfg –action config -interactive
-Make sure that PD.properties is in
c:.
b. When configuration has completed successfully, click OK to exit the configuration utility.
13. Restart the IBM WebSphere Application Server and IBM HTTP Server. For example, select Start → Settings → Control Panel → Administrative Tools and then double-click the Services icon to restart these servers.
Note: If you installed a registry server that does not use IBM HTTP Server and you are installing Web Portal Manager on the same system, ensure that the Web server ports are different. To change the IBM HTTP Server default port, edit the C:Program FilesIBMHTTPServerconfhttpd.conf file, change default port 80 to 8080 as shown, and then restart the IBM HTTP Server. # Port: The port the standalone listens to. Port 8080
14. To access the Web Portal Manager interface, enter the following address in your Web browser: http://hostname:port/pdadmin where hostname is the host name of the system and port where IBM WebSphere Application Server is running the IBM HTTP Server, and port is the port number being used, such as 80. For example: http://wpm14.example.com:80/pdadmin This step completes the setup of a Web Portal Manager system. To set up another
訪問路徑:http://localhost:9080/pdadmin (埠不是80)