排行榜

  • 用户榜
  • 标签榜
  • 冲榜分奖金

频道

最新最热悬赏待采纳 筛选
  • 3

    回答

  • 35

    浏览

在eclipse里弄了个Tomcat,不把webapp放进去可以正常启动,一把webapp放进去就启动不了Tomcat,显示的问题是  

  • 2

    回答

  • 25

    浏览

两个线程去执行遍历删除lis(for (int i=0;i

  • 5

    回答

  • 52

    浏览

g跟着书第一个实践配置下来,代码就是一个简单的访问界面的内容,但是运行之后却找不到连接,该怎样修改  谢谢

  • 3

    回答

  • 28

    浏览

package cookie; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/CookieReadServlet") public class CookieReadServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); PrintWriter out=response.getWriter(); Cookie[] cookies =request.getCookies(); for(Cookie c:cookies) { out.print("cookie名"+c.getName()+"&nbsp;"); out.print("cookie值"+c.getValue()+"<br>"); } } } package cookie; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.*; @WebServlet("/CookieReadServlet") public class CookieTestServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=utf-8"); PrintWriter out=response.getWriter(); Cookie passwordcookie=new Cookie("password","111"); Cookie namecookie=new Cookie("loginname","admin"); response.addCookie(namecookie); response.addCookie(passwordcookie); out.print("cookie已发送"); } }

  • 1

    回答

  • 37

    浏览

提示程序包javax.servlet不存在

回答 Aphraaa
采纳率100%
27天前
  • 1

    回答

  • 25

    浏览

mysql的id自增都是从1开始,我想用自增id加上可变前缀,实现订单号id,这样可可以保证不重复,例如20210411000+mysql自增id类似这样的,该怎么写

回答 酷爱码
采纳率69.2%
26天前
  • 2

    回答

  • 15

    浏览

如下面代码所示(关于链表的代码): Node类是用来定义链表当中的节点, LinkedList是用来对Node类做出操作的。 为什么不把Linkedlist当中的类放在Node中,而是用了一个新类, 我知道这么做肯定是好的,但是我不知道为什么这么做, 以及下次写代码的时候到底是直接在需要使用的下面添加方法,还是添加一个新类。 public class SingleLinkedList { public static void main(String []args) { LinkedList ll = new LinkedList(); Node n1 = new Node(1,"ff"); Node n2 = new Node(2,"ss"); ll.add(n1); ll.add(n2); ll.show(); } } class LinkedList {//操作Node类 private Node head = new Node(0,""); public void add(Node n) { Node temp = head; while(true) { if(temp.next == null) break; temp = temp.next; } temp.next = n;//直接添加数据 } public void show() { Node temp = head; while(temp.next != null) { temp = temp.next; System.out.println(temp); } } } class Node {//链表类 public int id; public String name; public Node next;//java没有指针 public Node(int id , String name ) { this.id = id ; this.name = name; } public String toString() { return "id = " + id + " name = " + name; } }

回答 nsnhdhshs
采纳率0%
26天前
  • 1

    回答

  • 15

    浏览

(IDEA)使用Mybatis时,Mapper接口的返回值是基本数据类型或者List<>时,总是爆红Result type not match for select id="XXX" 实在找不出原因,求大佬们帮忙看看,万分感谢  

  • 1

    回答

  • 11

    浏览

我用的echart模板想生成两个相似的图表,一个在左一个在右,但是有一个显示不出来,随便将哪一个注释掉,另外一个都能正常显示,不过显示的数据一闪一闪的,像是程序将两个数据全部传到一个显示表中,这是怎么回事? <%-- Created by IntelliJ IDEA. User: ZZC Date: 2021/4/11 Time: 10:57 To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>温湿度监控平台</title> <script type="text/javascript" src="js/jquery-1.8.3.js"></script> <script type="text/javascript" src="js/echarts.min.js"></script> <link rel="stylesheet"href="bootstrap-3.3.7-dist\css\bootstrap.min.css"> </head> <body> <div id="main1" style="float:left;width: 600px;height:400px;"></div> <script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main1')); // 指定图表的配置项和数据 var option = { title: { text: '机房温度', //标题文本内容 }, toolbox: { //可视化的工具箱 show: true, feature: { restore: { //重置 show: true }, saveAsImage: {//保存图片 show: true } } }, tooltip: { //弹窗组件 formatter: "{a} <br/>{b} : {c}%" }, series: [{ name: '机房温度', type: 'gauge', detail: {formatter:'{value}℃'}, data: [{value: 50, name: '温度显示表'}] }] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); setInterval(function(){//把option.series[0].data[0].value的值使用random()方法获取一个随机数 $.getJSON( "TempHumiditySecServlet", {}, function (result){ //js需要通过eval()函数 将返回值 转为一个js能够识别的json对象 json = eval(result); option.series[0].data[0].value = json.tempRandow; myChart.setOption(option, true); } ); }, 1000); </script> <div id="main2" style="float:right;width: 600px;height:400px;"></div> <script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main2')); // 指定图表的配置项和数据 var option = { title: { text: '机房湿度', //标题文本内容 }, toolbox: { //可视化的工具箱 show: true, feature: { restore: { //重置 show: true }, saveAsImage: {//保存图片 show: true } } }, tooltip: { //弹窗组件 formatter: "{a} <br/>{b} : {c}%" }, series: [{ name: '机房湿度', type: 'gauge', detail: {formatter:'{value}%rh'}, data: [{value: 50, name: '湿度显示表'}] }] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); setInterval(function(){//把option.series[0].data[0].value的值使用random()方法获取一个随机数 $.getJSON( "TempHumiditySecServlet", {}, function (result){ //js需要通过eval()函数 将返回值 转为一个js能够识别的json对象 json = eval(result); option.series[0].data[0].value = json.humidityRandow; myChart.setOption(option, true); } ); }, 1000); </script> <div class="row"></div> <h3><a href="main.jsp">返回</a></h3> <script type="text/javascript" src="bootstrap-3.3.7-dist\js\bootstrap.min.js"></script> <script type="text/javascript" src="jquery\jquery-2.1.1.min.js"></script> </body> </html>  

  • 2

    回答

  • 21

    浏览

springboot+RabbitMQ实现简单邮件服务,邮件发不出去 @Configuration public class RabbitMQConfig { //自定义消息转换器 @Bean public MessageConverter messageConverter(){ return new Jackson2JsonMessageConverter(); } //定制fanout类型的交换器 @Bean public Exchange fanout_exchange(){ return ExchangeBuilder.fanoutExchange("fanout_exchange").build(); } //定义1个消息队列 @Bean public Queue fanout_queue_email(){ return new Queue("fanout_queue_email"); } //把1个消息队列与交换器进行绑定 @Bean public Binding bindingEmail(){ return BindingBuilder.bind(fanout_queue_email()).to(fanout_exchange()).with("").noargs(); } } @Service public class EmailService { @Autowired private JavaMailSenderImpl mailSender; @Value("${spring.mail.username}") private String from; public void sendSimpleEmail(String to,String title,String content){ //制作纯文本邮件 SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(from); message.setTo(to); message.setSubject(title); message.setText(content); try { mailSender.send(message); } catch (MailException e) { e.printStackTrace(); } } } public class Mail { private Integer id; private String to; private String subject; private String content; //省略getter setter toString方法 } @Service public class RabbitMQService { @Autowired EmailService emailService; /* * 发布/订阅工作模式,处理邮件业务 */ @RabbitListener(queues = "fanout_queue_email") public void publishSubscribeConsumerEmail(Mail mail){ System.out.println("收到邮件信息:"+mail); emailService.sendSimpleEmail(mail.getTo(),mail.getSubject(),mail.getContent()); System.out.println("邮件已发送"); } } 测试方法 @Autowired private RabbitTemplate rabbitTemplate; @Test public void rabbitMQ(){ Mail mail = new Mail(); mail.setId(2); mail.setTo("limiq@qq.com"); //测试时改为正常邮箱 mail.setSubject("主题是什么"); mail.setContent("内容是内容"); rabbitTemplate.convertAndSend("fanout_exchange","",mail); } 测试虽然是绿的,但是邮件没发送到,我看控制台有这么个信息 Workers not finished. RabbitMQ管理页面里队列是这样的 有人知道怎么解决吗?

  • 2

    回答

  • 20

    浏览

请教各位大佬,哪位大佬做个esb相关的项目吗,可以帮忙介绍一下相关资料吗 有什么开源的esb项目吗,最好是有汉化版的

回答 梦沉三万里
采纳率0%
25天前
  • 3

    回答

  • 21

    浏览

tomcat-user加了权限 jenkins输出日志: ERROR: Build step failed with exception org.codehaus.cargo.container.ContainerException: Failed to redeploy [D:\VisualizationTools\jenkins\workspace\out_dashan_oa\out_dashan_oa_service\target\out_dashan_oa_service.war] at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176) at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81) at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167) at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136) at hudson.FilePath.act(FilePath.java:1075) at hudson.FilePath.act(FilePath.java:1058) at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133) at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95) at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113) at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1072) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635) at hudson.model.Run.execute(Run.java:1905) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:428) Caused by: java.net.ConnectException: Connection refused: connect Build step 'Deploy war/ear to a container' marked build as failure Finished: FAILURE 配置 : 求帮忙看看

  • 8

    回答

  • 60

    浏览

HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)   root cause java.lang.NullPointerException org.apache.jsp.homepage_jsp._jspService(homepage_jsp.java:214) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)   note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.  

yao_1209
采纳率50%
24天前
  • 1

    回答

  • 26

    浏览

<%@ page language="java" import="java.util.*,yjy.bean.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>购物网</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> <style type="text/css"> div{ border:1px solid grey; } .all{ width:1024px; margin:0px auto; } .top{ height: 40px; line-height: 40px; } .top a{ text-decoration: none; display:inline-block; width: 60px; } .header{ } form{ display:inline-block; } .header input{ height:40px; vertical-align: bottom; } input[type="text"]{ width:300px } .nav{ height: 50px; } ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: red; } li { float: left; } li a { display:inline-block; color: white; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover { background-color: #111; } .main{ } .mainList{ display:flex; flex-wrap:wrap; } ul.pagination { display: inline-block; padding: 0; margin: 0; } ul.pagination li {display: inline;} ul.pagination li a { color: black; float: left; padding: 8px 16px; text-decoration: none; } ul.pagination li a.active { background-color: red; color: white; } ul.pagination li a:hover:not(.active) {background-color: #ddd;} .page{ display:flex; justify-content:flex-end; } .footer{ height: 50px; } .other{ display:flex; justify-content:space-around; } </style> </head> <body> <div class="all"> <div class="top" > <a href="login.jsp">登录</a> <a href="register.jsp">注册</a> </div> <div class="header" > <img alt="" src="image/home/logo.png"> <form action=""> <input type="text"> <input type="image" src="image/home/search.png"> </form> <img alt="" src="image/home/cart.png"> </div> <div class="nav" > <ul> <li><a class="active" href="#home">主页</a></li> <li><a href="#news">新闻</a></li> <li><a href="#contact">联系</a></li> <li><a href="#about">关于</a></li> </ul> </div> <div class="main" > <div class="mainList"> <% //HomeData homeData=(HomeData)request.getAttribute("homeData"); HomeData homeData=(HomeData)request.getAttribute("homeData"); for(int i=0;i<homeData.getGoodList().size();i++){ Goods goods=homeData.getGoodList().get(i); %> <div class="item"> <img alt="" src="<%=goods.getImgpath() %>"> <div class="introduce"> <%=goods.getInfo() %> </div> <div class="other"> <%=goods.getPrice() %> <button>加入购物车</button> </div> </div> <%} %> </div> <div class="page"> <ul class="pagination"> <li><a href="#">«</a></li> <li><a href="#">1</a></li> <li><a class="active" href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">»</a></li> </ul> </div> </div> <div class="footer" >footer</div> </div> </body> </html> package yjy.bean; import java.util.*; public class HomeData { public int numPerPage=8; private int curPage; private int kind; private String keyword; private int total; private ArrayList<Goods> goodList; public HomeData(int curPage, int kind, String keyword) { super(); this.curPage = curPage; this.kind = kind; this.keyword = keyword; } public HomeData() { super(); } public int getNumPerPage() { return numPerPage; } public void setNumPerPage(int numPerPage) { this.numPerPage = numPerPage; } public int getCurPage() { return curPage; } public void setCurPage(int curPage) { this.curPage = curPage; } public int getKind() { return kind; } public void setKind(int kind) { this.kind = kind; } public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public int getTotal() { return total; } public void setTotal(int total) { this.total = total; } public ArrayList<Goods> getGoodList() { return goodList; } public void setGoodList(ArrayList<Goods> goodList) { this.goodList = goodList; } } package yjy.controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import yjy.bean.HomeData; import yjy.service.GoodsService; public class HomeController extends HttpServlet { /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //设置默认值 int curPage=1; int kind=0; String keyword=null; //设置获取参数 //数据封装 HomeData homeData=new HomeData(curPage,kind,keyword); //调用业务逻辑处理数据 GoodsService.prepareForHome(homeData); request.setAttribute("homeData", homeData); request.getRequestDispatcher("homepage.jsp").forward(request, response); } /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ } package yjy.service; import java.math.BigDecimal; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import javax.print.attribute.standard.PagesPerMinuteColor; import Test.DBHelp; import yjy.bean.Goods; import yjy.bean.HomeData; public class GoodsService { public static void prepareForHome(HomeData homeData){ Connection conn=DBHelp.getConn(); int curPge=homeData.getCurPage(); int kind=homeData.getKind(); //int numPerPage=homeData.numPerPage; int page=homeData.numPerPage; String sql=null; if(kind==0){ sql="select top "+page+ " * from goods where id not in(select top "+(curPge-1)*page+" id from goods)"; System.out.println("sql="+sql); }else{ sql="select top "+page+ " * from goods where kind="+kind+" id not in(select top "+(curPge-1)*page+" id from goods kind="+kind+")"; System.out.println("sql="+sql); } ArrayList<Goods> arr=new ArrayList<Goods>(); PreparedStatement ps; try { ps = conn.prepareStatement(sql); ResultSet rs=ps.executeQuery(); while(rs.next()){ int id = rs.getInt("id"); String name = rs.getString("name"); String info = rs.getString("info"); String imgpath = rs.getString("imgpath"); int sort = rs.getInt("kind"); BigDecimal price = rs.getBigDecimal("price"); int num = rs.getInt("stock"); Goods goods = new Goods(id,name,info,imgpath,sort,price,num); arr.add(goods); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } homeData.setGoodList(arr); } }  

回答 yao_1209
采纳率50%
24天前
  • 5

    回答

  • 58

    浏览

源代码中显示 <img th:src="@{/images/123.jpg}" alt="" class="ui avatar image"> 没有把里面的@{}里面的资源读取出来 这是怎么回事   后来发现好像是thymeleaf没起作用,我换代码块在浏览器中还是一样的

  • 8

    回答

  • 57

    浏览

创建ArrayList实例化对象,添加10个以上的元素,在2号位插入一个元素, 获得5号位元素,删除6号位元素。

  • 2

    回答

  • 42

    浏览

用的是在echarts社区的示例 在社区鼠标是有反应的:   但是在java ee里面鼠标就没有反应了:  

  • 1

    回答

  • 21

    浏览

语法1. PUT /索引库名/_mapping/类型名称 {   "properties": {     "字段名": {       "type": "类型",       "index": true,       "store": true,       "analyzer": "分词器"     }   } } 语法2.  PUT /索引库名 {     "mappings": {     类型名称: {       "properties": {            字段       }     }   } } 语法1和语法2是一个意思吗? 语法3: POST /cars/transactions/_bulk { "index": {}} { "price" : 10000, "color" : "red", "make" : "honda", "sold" : "2014-10-28" } { "index": {}} { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } { "index": {}} { "price" : 30000, "color" : "green", "make" : "ford", "sold" : "2014-05-18" } { "index": {}} { "price" : 15000, "color" : "blue", "make" : "toyota", "sold" : "2014-07-02" } { "index": {}} { "price" : 12000, "color" : "green", "make" : "toyota", "sold" : "2014-08-19" } { "index": {}} { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } { "index": {}} { "price" : 80000, "color" : "red", "make" : "bmw", "sold" : "2014-01-01" } { "index": {}} { "price" : 25000, "color" : "blue", "make" : "ford", "sold" : "2014-02-12" } 我知道语法3是批量提交,但是我发现每一个提交的row的上面都有{ "index": {}}这样的数据结构,它是为了设置什么吗?

回答 weixin_44514323
采纳率25%
22天前
  • 4

    回答

  • 39

    浏览

教师表(主表) 学生表(从表) 论文表(从表) 教师--学生:一对多 教师--论文:一对多 请问我怎么筛选从表条件正确分页(就是筛选多的一方并正确分页展示,因为一个主表有两个一对多关系,我的理解是没法进行连接查询),比如我想查出学生年龄大于18岁的并且教师论文都是优秀的老师?    

  • 3

    回答

  • 50

    浏览

一段简单的遍历中, List.forEach中的临时变量不能用来赋值,因为它是个临时的复制, 求大佬解答下代码出错在那里 首先是一个简单的类: public class ImportDataBean { private String name; private Object value; public ImportDataBean(String name) { this.name = name; } @Override public String toString(){ return "\n name: "+name +" value: " +value; } public ImportDataBean() { } } 最后是遍历代码: public static void main(String[] args) { List<ImportDataBean> importHeadList=new ArrayList(); List<ImportDataBean> importBodyList=new ArrayList(); ImportDataBean importDataBean1=new ImportDataBean("名称"); ImportDataBean importDataBean2=new ImportDataBean("备注"); ImportDataBean importDataBean3=new ImportDataBean("创建时间"); importHeadList.add(importDataBean1); importHeadList.add(importDataBean2); importHeadList.add(importDataBean3); for (int i=0;i<importHeadList.size();i++){ for(ImportDataBean importDataBean:importHeadList){ importDataBean.setValue(i); importDataBean.setName(importDataBean.getName()); //System.out.println(importDataBean.toString()); importBodyList.add(importDataBean); //ImportDataBean importDataSetBean=new ImportDataBean(); //importDataSetBean.setValue(i); //importDataSetBean.setName(importDataBean.getName()); //importBodyList.add(importDataSetBean); } } for (ImportDataBean importDataBean:importBodyList){ System.out.println(importDataBean.toString()); } } 觉得我这段代码有什么问题吗?没错,直接用 ForEach的临时变量操作是不是有点不妥,  贴一下执行结果: 可以看到 name的赋值还正常, value的赋值都变成2 这让我有点懵圈,如果正常的 重新 New一个  ImportDataBean 对象用于赋值,输出结果是没有问题的 如果把注释的输出放开 importDataBean.setValue(i); importDataBean.setName(importDataBean.getName()); System.out.println(importDataBean.toString()); importBodyList.add(importDataBean); 输出结果: 红色标红就是遍历中的 print了,这是为什么呢,Name没有错,但是value

回答 qq_40963234
采纳率33.3%
22天前
  • 4

    回答

  • 46

    浏览

package net.codejava.ws; import java.util.Calendar; import java.util.Date; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/datum") public class DatumGeben {      //    @GET //    @Produces(MediaType.TEXT_PLAIN) //    public String datumWrite() { //        return "schreiben Datum hier!"; //    } //    @GET //    @Produces(MediaType.TEXT_HTML) //    public String sayHTMLHello() { //        return "<html><title>Hello REST</title><body>" //                +"<h1>Welcome</h1></body></html> @GET     @Produces(MediaType.APPLICATION_JSON)         public Date sayJsonHello() {         Student st = new Student();         String date = "23.1.2014";         Date mydate = st.getValidDate(date);         if(mydate!=null) {         Calendar calendar=Calendar.getInstance();         //Converting Date to Calendar.         calendar.setTime(mydate);         int dayofWeek=calendar.get(Calendar.DAY_OF_WEEK);         String dayName=getDayName(dayofWeek);         } //        System.out.println("Day : "+dayName);         return mydate;              }                  private static String getDayName(int dayofWeek) {                          String dayName=null;             switch(dayofWeek)             {             case 1:                 dayName="Sunday";                 break;             case 2:                 dayName="Monday";                 break;             case 3:                 dayName="Tuesday";                 break;             case 4:                 dayName="Wednesday";                 break;             case 5:                 dayName="Thursday";                 break;             case 6:                 dayName="Friday";                 break;             case 7:                 dayName="Saturday";                 break;             }             return dayName;         }                                    } //         package net.codejava.ws; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Student {     private int id;     private String name;     private String country;          // constructor     public Student() {         super();     }     public Student(int id, String name, String country) {         super();         this.id = id;         this.name = name;         this.country = country;     }          //get and set      public int getId() {         return id;     }     public void setId(int id) {         this.id = id;     }     public String getName() {         return name;     }     public void setName(String name) {         this.name = name;     }     public String getCountry() {         return country;     }     public void setCountry(String country) {         this.country = country;     }       public Date getValidDate(String date) {                  Date mydate=null;         if(isValidDateFormat(date))         {             /*              * d -> Day of month              * M -> Month of year              * y -> Year              */             DateFormat dateFormat=new SimpleDateFormat("dd.MM.yyyy");                          dateFormat.setLenient(false);             try {                 mydate=dateFormat.parse(date);             } catch (ParseException e) {                 mydate=null;                 e.getStackTrace();             }         }              return mydate;     }     public  boolean isValidDateFormat(String date) {                  String pattern="(0?[1-9]|[12][0-9]|3[01])\\/(0?[1-9]|1[0-2])\\/([0-9]{4})";         boolean result=false;         if(date.matches(pattern))         {             result=true;         }         return result;     }      }    

  • 1

    回答

  • 25

    浏览

Description    Resource    Path    Location    Type Non-resolvable parent POM for com.cy:dell-SBOOT-01:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.4.5 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.4.5 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org    pom.xml    /dell-SBOOT-01    line 5    Language Servers  

回答 lxjtz
采纳率50%
21天前
  • 4

    回答

  • 20

    浏览

刚刚安装了zookeeper 但是zkCli.cmd 的时候会提示以下异常 java.net.ConnectException: Connection refused: no further information         at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)         at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)         at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)         at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141) 2021-04-17 11:14:22,392 [myid:] - INFO  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 2021-04-17 11:14:24,397 [myid:] - WARN  [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1162] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect

  • 4

    回答

  • 14

    浏览

我需要粘贴pdf文件里的一段代码到vscode里,但是我发现我粘贴过去的代码全部显示成了一行.因为有//所以它全部被注释了,见下图.请问有没有什么插件或者方法,可以保证按照原来的格式粘贴过来的?  

  • 3

    回答

  • 20

    浏览

<div class="required field"> <div id="test-editor" style="z-index: 1 !important;"> <textarea placeholder="博客内容" name="content" style="display:none"> </textarea> </div> </div> 上面的是Editor.md显示界面的html代码。 js的命令 $(function() { var editor = editormd("test-editor", { width : "100%", height : 640, syncScrolling : "single", path : "/editormd/lib/" }); }); 我的Editor.md文件位置: 在火狐浏览器中的检测如下:      界面中没有出现Editor.md的编辑界面,          f12中的代码和控制台显示:      没有把Editor.md中的引入:    控制台:     我的css和js引入 :      

weixin_48050721
采纳率20%
19天前