在service()方法中连接数据库获取表信息 代码: package com.shige.controller; import javax.servlet.*; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.sql.*; public class ListEmpServlet implements Servlet { @Override public…
RequestContextListener实现了 ServletRequestListener ,在其覆盖的requestInitialized(ServletRequestEvent requestEvent)方法中,将request最终设置到了RequestContextHolder中. public class RequestContextListener implements ServletRequestListener { private static final String RE…
package com.hanqi.test; public class Car { //构造一个汽车的属性 private String name; //创建getter和setter方法 public String getName() { return name; } public void setName(String name) { this.name = name; } public void drive() { } } package com.hanqi.test; public c…
package zuoye8; public abstract class Shape { private double zhouchang ; private double mianji ; public Shape(double zhouchang, double mianji) { super(); this.zhouchang = zhouchang; this.mianji = mianji; } public Shape() { super(); } //抽象一个周长方法 publi…
今天遇到了一个非常牛逼的BUG,在@Test标注的测试类中没有中文乱码,但是访问@Controller标注的接口却报中文乱码,找了一系列资料以及各种尝试之后,发现是因为eclipse编辑工具字符编码的错误,只需到点击eclipse上面的windows=====>Preference===>然后搜索Workspace将我圈主的字符集改位UTF-8…
package zhongqiuzuoye; public class Car { String brand; public void drive() {} } package zhongqiuzuoye; public class Aodi extends Car{ public double price; public String model; public double speed; public Aodi(double price,String model,double speed)…
package b; public class Car { public final static Car pinpai=new Car(); public static Car instance() { return pinpai; } public void drive() { System.out.println("请安全驾驶!"); } } package b; public class Aodi extends Car { private String price; priv…