腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
首页
学习
活动
专区
工具
TVP
最新优惠活动
返回腾讯云官网
java大数据
专栏成员
举报
627
文章
461551
阅读量
29
订阅数
订阅专栏
申请加入专栏
全部文章(627)
java(253)
jsp(114)
javascript(91)
html(46)
编程算法(30)
大数据(30)
spring(24)
http(24)
maven(14)
servlet(13)
数据库(13)
ide(12)
eclipse(12)
git(11)
scala(9)
xml(9)
人工智能(8)
https(8)
网站(7)
css(6)
github(6)
svn(5)
网络安全(5)
spark(5)
hadoop(5)
面向对象编程(5)
sql(4)
神经网络(4)
开源(4)
anaconda(4)
php(3)
python(3)
node.js(3)
mvc(3)
mapreduce(3)
mybatis(3)
负载均衡(2)
tensorflow(2)
c++(2)
jquery(2)
api(2)
容器(2)
存储(2)
jdk(2)
卷积神经网络(2)
spring cloud(2)
windows(2)
微服务(2)
bash(1)
json(1)
android(1)
云数据库 SQL Server(1)
jar(1)
linux(1)
负载均衡缓存(1)
apache(1)
bash 指令(1)
yarn(1)
分布式(1)
运维(1)
shell(1)
ssh(1)
spring boot(1)
jdbc(1)
aop(1)
微信(1)
add(1)
area(1)
background(1)
branch(1)
commit(1)
directory(1)
document(1)
edit(1)
firebug(1)
function(1)
import(1)
int(1)
io(1)
list(1)
profile(1)
push(1)
repository(1)
rsa(1)
script(1)
spyder(1)
target(1)
text(1)
union(1)
var(1)
web(1)
width(1)
对象(1)
工具(1)
开发(1)
开发者(1)
浏览器(1)
模型(1)
搜索文章
搜索
搜索
关闭
javascript当中静态方法和prototype用法
c++
java
6)静态方法和prototype(难) 例 3.6.1 <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <script> /*note that 马克-to-win: static variable's value has nothing to do with instance's variable's value.instance 名称 can not 直接access static member like in java. This is different from Java,比如下面例子中,Student.number=2,但是d1.number就为undefined.This is different from Java,但在实例方法中(比如d1.info)可以访问Student.number。这是和java中一样的。或者说function外或任何地方都可以访问Student.number。反过来,d1.age也可以在静态方法中访问,就像在function外一样,任何地方都能访问d1.age。String.prototype.abcd,这是给所有的实例加属性而不是静态属性。*/ function Student(number, agev) { this.age = agev; /*static variable's value can not be accessed by instance */ Student.number = number; /*lb is local variable, but not a member variable because it is not modified by this. from outside it can not be accessed. refer to noblockScope.html */ var lb = 0; } var d1 = new Student(1, 3); document.writeln("this的age属性为means window.age" + this.age + "<br>"); document.writeln("d1的age属性为" + d1.age + "<br>"); document.writeln("d1的number属性为" + d1.number + "<br>"); document.writeln("通过Student访问静态number属性为" + Student.number + "<br>"); document.writeln("d1的lb属性为" + d1.lb + "<br><hr>"); d1.qixy = "abc";/*以随意为实例加属性或方法*/ document.writeln("可以随意为实例加属性或方法see following,d1的qixy属性为" + d1.qixy + "<br><hr>"); document.writeln("是否有静态变量qixy" + Student.qixy + "<br><hr>"); d1.info = function()/*此方法仅为d1对象所用*/ { document.writeln("对象的qixy属性:" + this.qixy); document.writeln("对象的age属性:" + this.age); /*下列话是合法的, 因为不是this.number, 而是Student.number*/ document.writeln("static method is " + Student.number); }; Student.prototype.infop = function()/*此方法可以为所有Student对象所用*/ { document.writeln("对象的qixy属性p:" + this.qixy); document.writeln("对象的age属性p:" + this.age);
马克java社区
2019-10-09
458
0
SpringBoot中如何上传Upload
html
servlet
java
c++
上传: 根据第3部分的helloworld例子,用那个项目做底子。pom.xml都不用改变。参考项目bootUpload1. static/index.html: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> index1 <form method="POST" action="/upload" enctype="multipart/form-data"> <input type="file" name="file" /><br/><br/> <input type="submit" value="Submit" /> </form> </body> </html> package com.SpringbootMaven; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import javax.servlet.http.HttpServletResponse; @Controller public class UploadController { private static String UPLOADED_FOLDER = "e://temp//"; @RequestMapping("/upload") public void singleFileUpload(@RequestParam("file") MultipartFile file,HttpServletResponse res) throws IOException { try { byte[] bytes = file.getBytes(); Path path = Paths.get(UPLOADED_FOLDER + file.getOriginalFilename()); Files.write(path, bytes); System.out.println("马克-to-win@马克java社区 successfully"); } catch (IOException e) { e.printStackTrace(); } res.sendRedirect("index.html"); } }
马克java社区
2019-07-27
508
0
没有更多了
社区活动
【纪录片】中国数据库前世今生
穿越半个世纪,探寻中国数据库50年的发展历程
立即查看
Python精品学习库
代码在线跑,知识轻松学
立即查看
博客搬家 | 分享价值百万资源包
自行/邀约他人一键搬运博客,速成社区影响力并领取好礼
立即体验
技术创作特训营·精选知识专栏
往期视频·千货材料·成员作品 最新动态
立即查看
领券
问题归档
专栏文章
快讯文章归档
关键词归档
开发者手册归档
开发者手册 Section 归档