当前位置:网站首页>The essence of analog Servlet
The essence of analog Servlet
2022-07-07 22:03:00 【Vayne's fat tiger】
Directory structure of the project
---src
---web.properties
---javax.servlet
---Servlet
---web
---Tomcat
---service
---UserListServlet
---UserLoginServlet
- web.properties
/aaa=service.UserListServlet
/bbb=service.UserLoginServlet
- Servlet
package javax.servlet;
/** * Author:LinYue * Time:2022-06-27 10:29:54 */
public interface Servlet {
void service();
}
- Tomcat
package web;
import javax.servlet.Servlet;
import java.util.ResourceBundle;
import java.util.Scanner;
/** * Author:LinYue * Time:2022-06-27 10:32:13 */
public class Tomcat {
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
System.out.println("Tomcat Launched the ....");
Scanner s = new Scanner(System.in);
System.out.print(" Please enter the access path :");
String path = s.nextLine();
ResourceBundle bundle = ResourceBundle.getBundle("web");
String resource = bundle.getString(path);
Class clazz = Class.forName(resource);
Object obj = clazz.newInstance();
Servlet servlet = (Servlet) obj;
servlet.service();
}
}
- UserListServlet
package service;
import javax.servlet.Servlet;
/** * Author:LinYue * Time:2022-06-27 10:31:06 */
public class UserListServlet implements Servlet {
@Override
public void service() {
System.out.println("UserListServlet Of service Method is called !");
}
}
- UserLoginServlet
package service;
import javax.servlet.Servlet;
/** * Author:LinYue * Time:2022-06-27 10:31:06 */
public class UserLoginServlet implements Servlet {
@Override
public void service() {
System.out.println("UserLoginServlet Of service Method is called !");
}
}
边栏推荐
- Take the intersection of two sets
- Goal: do not exclude yaml syntax. Try to get started quickly
- 反爬通杀神器
- Actual combat: sqlserver 2008 Extended event XML is converted to standard table format [easy to understand]
- Tupu digital twin coal mining system to create "hard power" of coal mining
- Demon daddy A1 speech listening initial challenge
- Two kinds of updates lost and Solutions
- Usage of MySQL subquery keywords (exists)
- L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?
- What stocks can a new account holder buy? Is the stock trading account safe
猜你喜欢

Using enumeration to realize English to braille

The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function

Two kinds of updates lost and Solutions

#DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA

嵌入式开发:如何为项目选择合适的RTOS?

NVR硬盘录像机通过国标GB28181协议接入EasyCVR,设备通道信息不显示是什么原因?

Validutil, "Rethinking the setting of semi supervised learning on graphs"

Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?

Demon daddy B3 read extensively in a small amount, and completed 20000 vocabulary+

Time standard library
随机推荐
Paint basic graphics with custompaint
QT compile IOT management platform 39 alarm linkage
[开源] .Net ORM 访问 Firebird 数据库
Take the intersection of two sets
使用 BlocConsumer 同时构建响应式组件和监听状态
PDF文档签名指南
Solve the problem of using uni app mediaerror mediaerror errorcode -5
Using enumeration to realize English to braille
How polardb-x does distributed database hotspot analysis
[open source] Net ORM accessing Firebird database
Jerry's configuration of TWS cross pairing [article]
Crawler (17) - Interview (2) | crawler interview question bank
The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
你可曾迷茫?曾经的测试/开发程序员,懵懂的小菜C鸟升级......
Oracle advanced (VI) Oracle expdp/impdp details
Default constraint and zero fill constraint of MySQL constraint
The maximum number of meetings you can attend [greedy + priority queue]
2022 how to evaluate and select low code development platforms?
[open source] Net ORM accessing Firebird database
Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future