您好老师,在创建表格时,为什么给表名和字段名添加单引号' '呀?
浏览器输入:localhost:8888/servletdemo/helloworld.do
报错404,为啥呀
webapps.zip
快速生成返回值的快捷键是什么
源码:
package com.bjsxt; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; /** * 下载文件, * 添加头信息,获取资源对象即可下载 */ public class servletDemo06 extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doPost(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { File file = new File("C:\\Users\\j1781\\Desktop\\JAVA学习\\java尚学堂\\plane.jpg"); FileInputStream fis = new FileInputStream(file); byte[] buff = new byte[fis.available()]; fis.read(buff); //在响应中添加附加信息 resp.addHeader("Content-Disposition", "attachment;filename" + file.getName()); OutputStream os = resp.getOutputStream(); os.write(buff); os.flush(); os.close(); fis.close(); } }
可以下载信息,但是文件名不对,后缀不对,是图片可以用画图工具打开, 说明传输没有问题
下载就是这样的文件, 文件名是访问的URI名
这里老师都不带着敲代码吗
idea.. 的cookie是怎样的,视频里没有,我的却有
HelloWorld.class路径:D:\1614895987\FileRecv\apache-tomcat-9.0.34\webapps\servletdemo\WEB-INF\classes\com\bjsxt\servlet
web.xml路径:D:\1614895987\FileRecv\apache-tomcat-9.0.34\webapps\servletdemo\WEB-INF
web.xml代码:
我的浏览区无法访问html搜索页面,麻烦老师帮忙看看
web.xml
html
RedirectServlet.java
老师,我这个输入了正确的用户和密码登录后也显示用户名或密码错误,我检查不出来,求老师指点,这是我源码
WebDemo.zip
wo
老师,能不能解释一下,持久层,业务层。。。。。之类的是干嘛的??有点蒙
老师,为什么这行代码改成false后,默认的谷歌浏览器里的信息并不会为空,控制台输出也是有值的,但是把URL粘贴到火狐和edge浏览器里就是输出空值呢
servletdemo_my.zip
HttpSession session = req.getSession(false);
com.panda.xmlorg.jsoup.Jsouporg.jsoup.nodes.Documentorg.jsoup.nodes.Elementorg.jsoup.select.Elementsjava.io.IOExceptionjava.net.MalformedURLExceptionjava.net.URLGrawlDemo StringargsIOException i=i<=i++Document document = Jsoup.URL+iSystem..printlndocumentElements headerImgEle = document.getElementsByAttributeValueElements headerEle = document.selectElements authorEle = document.selectElements contentEle = document.selectString headerImg = headerImgEle.get.attrString header = headerEle.textString author = authorEle.textString content = contentEle.textSystem..printlnheaderImgSystem..printlnheaderSystem..printlnauthorSystem..printlncontent
老师,这个编译后还存在标签和报错Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=404, URL=https://daily.zhihu.com/story/9747249 at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:760) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:706) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:299) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:288) at org.jsoup.Jsoup.parse(Jsoup.java:183) at com.panda.xml.GrawlDemo.main(GrawlDemo.java:17)
问题:当我不开启针对这个servlet 对象的线程同步时,为啥IE浏览器输出的值不是itb2(也就是为啥IE浏览器给定的值不会覆盖掉Chrome给的值)(这里面有点理不清关系求详细解答)
(这个图为开启线程同步后输出的内容)
老师我也有些不太理解servletcontext,没有赋值就取值,是因为它是全局容器;所以可以直接通过userid(唯一的)来获取对应session?还是应该怎么理解
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637