TA的每日心情 衰 2021-2-2 11:21
签到天数: 36 天
[LV.5]常住居民I
java 实现微信公众平台开发项目源码
* t- ?: R' e( M2 y. C 本文向大家介绍使用Java来实现微信公共平台功能,实现根据回复的内容返回对应的消息。供大家学习使用。
1 V4 T, p' D3 B) V _ 微信服务端收发消息接口:WechatServlet.java
, G$ m! g' T) c0 U, U" \+ V8 c package demo.servlet;
0 V | d- D4 ^. u' l & g, H! @* a9 D/ `7 j$ D
import java.io.BufferedReader; m( U9 G6 N5 ~+ o* M& R
import java.io.IOException;
7 A# k! n8 y6 v import java.io.InputStream;
! Z6 R! b: P% q# R9 M2 f import java.io.InputStreamReader;" r1 @. h! O" a* t5 ~& y) C' Z1 \
import java.util.Arrays;
# z5 l. T' N( r, L. V, @& [
d4 h# |# X6 C1 n. h import javax.servlet.ServletException;2 H6 J$ N5 n6 B8 b# I' }
import javax.servlet.http.HttpServlet;
, A" J% z5 ?3 b$ ^, x% C5 u' b import javax.servlet.http.HttpServletRequest;4 `' Q# H$ {! `! J
import javax.servlet.http.HttpServletResponse; h! n) y- N/ Y! ?) V: F4 D
4 _9 i+ h/ E; ]3 y import demo.process.WechatProcess;
: X, Q- i8 u( f7 W' n import demo.util.SHA1;
9 N4 T b/ @0 f7 f) ^ /**7 u5 P2 v4 d% s4 \; V4 \
* 微信服务端收发消息接口
3 X6 F% E& H. P# h! R * / ], [0 F: w7 Y) s
* @author 科帮网
2 j2 s+ V2 I$ F& k. ~! [9 u) g * ' p- U/ }7 C" Z- U" z
*/% Z1 O- I6 m/ E9 K8 ^
@SuppressWarnings("serial")
8 N4 q! V# N4 J5 |& S public class WechatServlet extends HttpServlet {
2 f I' ~; @& b6 O' e" f: | : e6 W* d0 V3 S ~0 {
// 自定义 token" V6 U) m8 r' K- x6 E5 n
private String TOKEN = "52itstyle"; & t) _6 A7 w& L4 ~# i
public void doGet(HttpServletRequest request, HttpServletResponse response)2 }8 H7 A. Y! V! X
throws ServletException, IOException {
- ?' C, Z9 C& b" M- T; u String signature = request.getParameter("signature"); // 随机字符串 m5 S& \6 N/ ^ b+ [
String echostr = request.getParameter("echostr"); // 时间戳
$ [! m/ t9 F ~ String timestamp = request.getParameter("timestamp"); // 随机数+ a2 K; U* m( z& R" [
String nonce = request.getParameter("nonce");
( y+ |! m) M5 Y( K6 U * B6 f1 M) @8 {+ F9 s) b
String[] str = { TOKEN, timestamp, nonce };& c- k2 ]2 v0 e( l! h, M
Arrays.sort(str); // 字典序排序% V0 s/ a: Y$ H8 N: e1 r+ ^; n
String bigStr = str[0] + str[1] + str[2]; // SHA1加密
% _- \8 Z7 H9 Z+ B0 F0 U String digest = new SHA1().getDigestOfString(bigStr.getBytes()).toLowerCase();
, O% O+ o2 J$ w# S7 k // 确认请求来至微信; H' W% ^5 `4 W; u/ x `: Y& o
if (digest.equals(signature)) {
5 c" ~5 i/ L. S$ f P1 C2 t, L request.setCharacterEncoding("UTF-8");
0 K' r) y. j7 m1 a8 E7 ?0 A0 f# Z5 s response.setCharacterEncoding("UTF-8");
$ {& b7 z8 W$ \( D / G9 x- N% [8 C0 b4 C! I* Q
/** 读取接收到的xml消息 */
0 p, C7 j' S- p StringBuffer sb = new StringBuffer();
: W( d5 W; r( Q0 u7 Z2 x) P! y InputStream is = request.getInputStream();
7 G1 u9 v1 ^" e InputStreamReader isr = new InputStreamReader(is, "UTF-8");
7 D' |4 e# U+ C X8 _$ J f1 s BufferedReader br = new BufferedReader(isr);
4 F, O" `2 ?0 D String s = "";" U$ a' N3 x& G5 M9 A" q+ n
while ((s = br.readLine()) != null) {0 W+ I# Q6 [2 y1 m( ?
sb.append(s);
4 A# C0 A1 L$ M- G }9 F1 P) _- |4 b% n2 S) A
String xml = sb.toString(); //次即为接收到微信端发送过来的xml数据
' L7 e6 \$ T, ?$ i
* E& v x+ L$ }! { String result = "";& N8 a, c" Z3 X, n2 x' k
/** 判断是否是微信接入激活验证,只有首次接入验证时才会收到echostr参数,此时需要把它直接返回 */
" [0 L" M, l4 j6 d0 ~! Y! r if (echostr != null && echostr.length() > 1) {# W1 `& h2 a( ]2 `% b, Y9 F) i& y
result = echostr;% U/ m2 I$ h0 r7 @5 ~, U6 W c
} else {
+ w# v. b, Z# C* F //正常的微信处理流程
$ W4 ~$ X# ^) O result = new WechatProcess().processWechatMag(xml);
& f, S; a5 Q. Y+ o: D) j } C) a1 V) H' N7 u. u: a. r. f
System.out.println("说的什么"+result);" B, x; K7 m1 U" `0 a+ H; u
response.getWriter().print(result);
8 r& P, I$ J& l1 D5 ] }, B/ v, i' w8 k; J. O- v4 ^( y
}5 v$ i; |2 C8 P9 E
0 v* X5 A# o9 @& J, t) s( W( \& T( _: A$ m
/**
) s+ Z3 q0 [) G7 j * The doPost method of the servlet. <br>
3 H" K& A5 f+ |& S *
0 X# i' M7 @/ B. C9 h3 q * This method is called when a form has its tag value method equals to
7 ]. i- q) k; Z * post.+ D9 ^; w7 Z6 c7 f1 I
*
1 t1 `7 n% a4 A4 |8 } * @param request
# n, u( A& h0 f3 L * the request send by the client to the server
4 C/ K4 x* P* b" ^7 L * @param response- i7 Z1 V9 ?! R" u
* the response send by the server to the client
) w1 u$ O$ S, k/ g: U& P * @throws ServletException
% |! n9 h x; r: u, z! r * if an error occurred# g, b0 A3 H5 c. M- J6 K2 a
* @throws IOException
0 ^' B* Y' G" Y, h$ m& C * if an error occurred8 t3 Z0 h; z% a& [% o3 e% T
*/
; Z5 S; a( i/ H( X3 `/ o! F" \ public void doPost(HttpServletRequest request, HttpServletResponse response)
8 |) ~. R; ], ^ throws ServletException, IOException {$ X) k2 T4 Y3 N2 O/ s
doGet(request, response);
* h: ^; h! J: y- R1 T* T }6 t" E) g/ d% A+ i4 X
& A0 h) m6 n% x" [
}; d/ L$ w2 | x% X( ~( i, U' M
复制代码 接收到的微信xml实体类:ReceiveXmlEntity.java; O( z2 K' h& w2 U/ E6 V7 a( }
package demo.entity;
4 O! k5 ^- `& h) Y% V+ j /**
, _1 X& Q3 W" a% W8 x9 R9 ?9 z * 接收到的微信xml实体类- I0 S* q: w; u% m% W" S
* @author 科帮网/ A" l- p( y6 u8 ]
*, [! I" s* Y1 d9 g
*/
5 \3 {& |( d) `' q public class ReceiveXmlEntity {( D4 _6 ]4 c! q- Z. y$ k
private String ToUserName="";; Z9 d$ o* `: a2 I7 a' f" {
private String FromUserName="";+ s" K! r* U( j: f" X6 F2 j0 \$ M/ s
private String CreateTime="";2 ^8 A$ V0 H" p
private String MsgType="";
) r8 c( @: [1 f4 G6 M) M5 G private String MsgId="";
" o' n( D4 X+ X( _6 G3 V/ h private String Event="";
3 k1 s+ m9 z7 O$ e. C9 w private String EventKey="";
7 X1 h9 J5 \$ d# x5 e4 V5 C* p: V private String Ticket="";+ O$ K, e7 B- z! u' Z
private String Latitude="";
- F; S' R; b5 ]# j0 d+ b5 L5 p- S$ p private String Longitude="";: j! k2 {' u' b, N3 w. t9 E1 `5 {
private String Precision="";" T" k K4 b5 J( S! ?6 o
private String PicUrl="";
, v. J) N" T6 a1 r& E8 f& v) w2 R private String MediaId="";* \" L! W) X$ Q2 z
private String Title="";
" m- F9 Z. n! n private String Description="";
5 W5 O$ G* a& { private String Url="";
# }5 F3 {0 d' A& E private String Location_X="";
- z1 w2 Z* R% K" f, w private String Location_Y="";
0 L, p1 v+ T: }, Z# h2 D5 M. | private String Scale="";) v0 q$ n- m" g* B$ S. U# j
private String Label="";8 D- [1 Z7 J- V9 B3 s* ?2 O
private String Content="";
* D) R4 n& A' Y6 @# o3 U& | private String Format="";
+ e% Z5 j, e; z( d private String Recognition="";( N9 a+ q: L! w5 G3 ~2 Q( X" \
1 T- Z; X k7 @% k5 e public String getRecognition() {
7 c# @0 m% L' [. D return Recognition;
2 R8 @* I( K( Y& E; O5 S }* V; [8 j- x, w% K
public void setRecognition(String recognition) {
: W7 y/ `! k$ p, U8 V; u" K3 Q3 x Recognition = recognition;
; t9 ~. k( |# J; a3 H+ J$ x4 p }7 w% g' d) I1 q7 e+ d
public String getFormat() {
& v3 I5 |, m$ t; f, C! g1 } return Format;' F4 X/ O; ?; f1 V' [
}# U' V% c$ `5 ^# G6 q7 X: r
public void setFormat(String format) {& W4 _2 u0 j1 ~0 P
Format = format;
, ]: S) ]* C: Y% ~" o# z0 N [6 @ }
( w3 N: |! W; E3 d6 | public String getContent() {
: b4 ]% Z# b: e1 K& u+ O! `' k4 D return Content; Q% B" b% E# l0 z! w- [/ |
}7 A0 g+ }# A% `+ c
public void setContent(String content) {( C6 T' E1 L- E5 U4 ^
Content = content;
6 e6 x! }' F: _4 B; N }
: I% S" t V( Z9 p! [ public String getLocation_X() {, |9 O7 `# s& B8 l- W
return Location_X;: b! f. {+ f9 o
}
8 ~# z( s" N( O" D$ g( D public void setLocation_X(String locationX) {# H6 r) H4 ~$ p( q; l8 X) u3 ~
Location_X = locationX;5 [- b) l. t0 d1 h8 ?7 ]
}
2 u: I- O- | T2 q+ `' V public String getLocation_Y() {. {2 a) P- z0 ? l+ D
return Location_Y;
3 F1 j: S& u2 e9 F0 S6 R }5 N2 s/ C, p& }+ S6 F, W' j3 i
public void setLocation_Y(String locationY) {
' k# ]4 \) n& `, _) q) k5 M& s Location_Y = locationY;3 f7 e' V9 b- V- i& t0 l0 s
}
9 q1 @! A L) { public String getScale() {
0 J" j, a- q( ]* z# I# r; C return Scale;
! J/ b6 D+ e2 z! `! a }$ M) w! j o) y- T9 `! }
public void setScale(String scale) {& j* ^& [ n% f, f7 w' S" L
Scale = scale;# w3 u- I4 ]# N/ y$ `* _
}8 b! i" m: n5 m' _; M1 P/ w9 s
public String getLabel() {( v/ }3 h$ m+ p" ~# l6 }9 |% m
return Label;
8 r1 E8 H" t' Y2 a }
3 U3 y: J2 w" Z: ^ public void setLabel(String label) {
p+ E& ?& P* b: N& p" i1 z Label = label;
( T+ X3 v7 W$ l5 o. O1 B }& W7 ^8 F# M' b7 ]" w3 n3 f
public String getTitle() {! H1 ?0 D7 h1 S
return Title;
) ^9 A' J8 D! D' G, D }/ a' F: p* i7 h, Q7 d
public void setTitle(String title) {% o1 x, v9 A' ?9 F9 r
Title = title;
" P/ I9 v" z+ w% a }
7 q& a. J1 x6 @8 T/ P public String getDescription() {
* Z% ?- Y n& ^+ D return Description;
- h6 q- [) y7 i# D }
+ m5 @) b) V' u7 `! Z public void setDescription(String description) {
. o; s) d, {3 { Description = description;8 k% W+ O P2 F& A( {% C& n* P; q" X
}% `( q, l$ D6 m& x b3 E) W7 Q- p+ j
public String getUrl() {2 [( ~, w8 v$ N. m
return Url;# N* w U% i; b" m' I9 y
} \1 F& M! l& P4 N3 X$ C. |; b8 |
public void setUrl(String url) {9 Z# S+ t+ d$ D' n& Q
Url = url;0 a+ }' r+ {- Z. |6 k* [$ F
}3 R7 e" A$ X2 J9 N* y7 A' i
public String getPicUrl() {+ O2 j; A4 T6 g* Z
return PicUrl;: w$ J3 j6 K0 e9 t6 ~* e# U0 k: E
}2 [# ~4 C: a/ D+ {
public void setPicUrl(String picUrl) {2 r3 l$ j& {" F7 @8 e0 o" N
PicUrl = picUrl;6 C& p6 O* s! |8 V
}: z2 }5 N! q4 f" g. [3 y1 @0 B5 K
public String getMediaId() {3 }! X9 Y$ U: a! v/ \* O
return MediaId;
4 Z' J' |, Q1 c }
# i9 t# F, k/ Y1 C+ _7 H& k public void setMediaId(String mediaId) {3 u5 A7 T' T. p% x" C( l
MediaId = mediaId;0 X9 a- f* n, h& E+ k: S
}3 I& D. W; D' t( K# [7 Z' S
public String getEventKey() {
9 w5 z* I: | U: F" F: J return EventKey;
2 D: G$ r6 ~7 h4 n5 ^ }! n- C% |9 \* [& n' N" l/ \
public void setEventKey(String eventKey) {% `5 O* e: e& `8 T
EventKey = eventKey;
, X$ n- v" ?/ [9 w2 B }2 i- X8 E* l }# Z& w, {
public String getTicket() {# a w t8 E' `
return Ticket;
* F r2 Q" E) a6 i }
4 z o5 H- b6 s0 u O. T public void setTicket(String ticket) {
1 |2 U9 |* W! V# e# j. i8 M/ H1 | Ticket = ticket;8 B. i" ?% Z' D. r V# H9 V
}/ m7 S0 H; ]5 x/ V: ^% A" U$ g' x
public String getLatitude() {
: L$ R; ^+ m( a- N) u2 o return Latitude;
. r) O% D* _ ?) p }$ h) M2 b1 Q* i
public void setLatitude(String latitude) {" W7 V) s6 R+ `2 P9 M2 _- L
Latitude = latitude;
1 R" }, w* J) O0 k' J3 N, w }) Y3 d6 w+ z0 Y! H$ `8 J: a$ v; m
public String getLongitude() {
) r: T* g/ w+ {( x" p' M return Longitude;
; ^, G$ g: A1 i. Z3 b' @ }
A8 D" L6 p) x2 ~' T! Z public void setLongitude(String longitude) {
' O9 P0 ?5 ?. T& z+ e9 t7 Q o; H Longitude = longitude;7 A* t' q& e' }2 R7 k0 w
}4 [# w- P3 e' C( F8 k, e5 ?
public String getPrecision() {
. P. n. N6 H' U& E9 r4 i; p, q return Precision;2 G; P$ h4 a* b: a8 [7 S4 Y
}: m+ }8 L N" h/ A
public void setPrecision(String precision) {4 A5 {/ c5 n# z
Precision = precision;
0 q! w, e, O) `9 P- e! N$ L# Q }3 j( Y. ?3 E l6 o! j: y G E
public String getEvent() {
' N$ j2 |( N, A& Y return Event;5 v/ |3 q+ F$ ~. p c- k7 n
}+ F- t) g, s0 O# V7 h
public void setEvent(String event) {
: Y0 I* `& U1 K3 W( l- A Event = event;" j2 Z: W$ [8 `6 F4 B/ j
}
3 d8 K4 y- [0 a( D public String getMsgId() {
' P$ z6 u& B9 @# |+ v C( a return MsgId;' v: \ {0 s' D% ^+ _- y; d0 b; Q
}
- R8 J7 w" t' I; ^. { public void setMsgId(String msgId) {) l7 e; y1 ^5 W8 r {- [
MsgId = msgId;: V% D3 i1 [2 M2 @! ^7 d7 D
}
( P9 T; G3 {7 f' P# ^ public String getToUserName() {
7 g% B( D- e7 a* ?! _) S return ToUserName;
" N# E. m* P; ]' C9 Z1 n }
* D7 L$ E3 b" z g public void setToUserName(String toUserName) {4 f* {: z4 @, {: |6 b$ y
ToUserName = toUserName;
; Q% h; I- k% q5 q/ T0 ^" X }" f5 |+ S$ R8 u: U5 G7 p
public String getFromUserName() {
( {1 U( O# U0 {& b2 ~ return FromUserName;
3 A. }* o# t) g8 A }, Q" g5 t9 z! | C$ G$ m& r, |: o' {
public void setFromUserName(String fromUserName) {
0 O' R- A$ g4 B4 [% k" h FromUserName = fromUserName;
& I1 M1 F( P0 r& _% I }+ O1 U9 g. K( a
public String getCreateTime() { m0 x w" l! z, H% a- x% H
return CreateTime;# p* ^# M7 ?6 t- I
}
+ V1 Y b: J" s4 L6 _4 _ public void setCreateTime(String createTime) {
* P% S+ X1 A6 h) U CreateTime = createTime;
' {! m6 J+ q( g- o4 |5 Y4 B }! G9 e$ C6 J0 J
public String getMsgType() {- W1 I+ g5 D8 P: g5 x' ~% C* F/ V: `
return MsgType;7 p9 z7 `' N: B: Z( y
}
" a4 f- g' |9 \' q- ^1 p* o' S; G: _7 M public void setMsgType(String msgType) {
5 b& v6 y H% L* I9 T, r& d MsgType = msgType;3 @. `/ h* n/ P/ t+ T2 A' l
}
2 j' _1 e+ C7 c# V% o! C' n }# u" Q/ f) d5 c' I3 \/ y* D
复制代码 调用图灵机器人api接口,获取智能回复内容 TulingApiProcess.java1 W& S5 C4 K- T" H# a4 O0 P" o+ C, L0 l
" X1 R$ |+ C( o) q package demo.process;5 d- y% W* t7 T K& _ R! I- y
( V/ e. A3 I# u8 W
import java.io.IOException;! P4 T) J/ U% Z _4 O
import java.io.UnsupportedEncodingException;2 O3 N v) L0 q, e5 ?
import java.net.URLEncoder;
, o! }. i" H/ u) d, |5 O9 K s9 u: G8 q* c( N C" l
import org.apache.http.HttpResponse; ]' ?/ ?0 ?# i7 Z4 m/ T4 V5 T: V
import org.apache.http.client.ClientProtocolException;4 t2 R! e+ f9 l5 V- N6 R
import org.apache.http.client.methods.HttpGet;) U* f; K4 w+ A! U3 h6 }* @
import org.apache.http.impl.client.HttpClients;/ U, I( v5 v! g) \# L1 f
import org.apache.http.util.EntityUtils;9 p5 i! Y. ^9 D! e3 Y3 J
import org.json.JSONException;
0 h7 D7 F$ }8 |" H" u import org.json.JSONObject;
1 x: H, g! }8 [; o6 [& S4 G " ?: f: I7 {6 r# o! p% c, g
/*** o W+ Y: G+ ]% Z" y
* 调用图灵机器人api接口,获取智能回复内容' W% H \/ Y3 f4 j3 i/ E; D
* @author 科帮网/ l+ s% K8 Q6 H' f/ O) k: B
*4 k6 }; E! f0 e6 m, B
*/" f7 M* w# s3 E# y0 m
public class TulingApiProcess { Y, T, t- U3 o D) }
/**, p5 Y! s, G/ ?" b q
* 调用图灵机器人api接口,获取智能回复内容,解析获取自己所需结果
" e) ]' d1 g4 |/ N, u# v% N * @param content1 q! S: w; u6 s3 a/ P" E
* @return
" P6 r, @" @' }4 M */; ^( i! `: v8 e
public String getTulingResult(String content){$ x% P% k4 ^' Y3 e' }- e
/** 此处为图灵api接口,参数key需要自己去注册申请 */5 {6 _, w3 i# U7 H2 s
String apiUrl = "http://www.tuling123.com/openapi/api?key=2a31b2f601f74b54ea13db1c82fe5d71&info=";' p5 j* f7 {% O) l
String param = "";
) R( N. |$ H* j! _: m0 c) u2 ]( E try {1 X6 M$ Z+ W5 V9 }% M! T. E
param = apiUrl+URLEncoder.encode(content,"utf-8");( Q# w) @9 ?/ j2 |7 v
} catch (UnsupportedEncodingException e1) {& s7 W/ q! c! G4 t9 ~* L" F" O8 {
e1.printStackTrace();
( j- h0 ^2 V! S* r } //将参数转为url编码8 N4 r% W( j) e2 _( s, j2 C
/** 发送httpget请求 */
+ h$ N' f3 {+ `; m) K1 V HttpGet request = new HttpGet(param);
4 f, b- |) f, U- L4 M String result = "";7 M8 Y% S. o! ~
try {
3 Z$ T' m# ?$ v: |, ^9 Y* x: p4 H HttpResponse response = HttpClients.createDefault().execute(request);5 \% m1 ` T, B# o9 ~1 R' L
if(response.getStatusLine().getStatusCode()==200){
& p: F4 J5 s- _, x( o) k result = EntityUtils.toString(response.getEntity());
. y, b8 s8 V9 v+ W }7 i/ Q5 `$ u5 u! c V
} catch (ClientProtocolException e) {. D/ ^ M" i w7 D k# |$ S ~; |
e.printStackTrace();
% a9 Q8 x$ O: z/ B8 F } catch (IOException e) {. @" X8 s9 [: \: A( \( R
e.printStackTrace();
( y$ p7 ~: B4 c" G1 Q }
6 ~/ m! S+ x7 g) y5 q /** 请求失败处理 */6 L: y2 \* |$ _4 T4 y" F% @+ q; |, O
if(null==result){
8 d. _0 b' w3 a7 v& l' z return "对不起,你说的话真是太高深了……"; H+ b9 Y- M: w9 K
}% F/ ]% F6 z* L8 r- o3 S" Z( Z
0 ~2 `, s+ w, e8 K. D I9 O try {9 T8 m, z8 r- O9 N
JSONObject json = new JSONObject(result);. ~* X) r( F" s4 |* C. l
//以code=100000为例,参考图灵机器人api文档
b$ k0 z6 l0 c8 h3 s if(100000==json.getInt("code")){( \- G+ E; z' e
result = json.getString("text");9 z L2 Z+ ~* K K+ z( Z5 Z
}$ _, w* Q+ l& f& u5 `7 o! y
} catch (JSONException e) {' @6 n4 K8 M! [: x$ q
e.printStackTrace();
1 Q3 n8 u) _- {4 E- `. h& h3 U }$ z X: O6 L2 `6 z7 z7 |$ M7 j
return result;1 R, K, R8 p' V
}9 G3 v" a! k3 Q
}4 _6 l% r+ C0 j" g# |" z
复制代码
) g( K* w, L2 B web.xml 配置:
1 ^. J0 t, N0 @3 b, s1 } <?xml version="1.0" encoding="UTF-8"?>
# N: ], m7 X: M% \ <web-app version="2.5" # D2 m' i+ p% J E0 L2 T( H
xmlns="http://java.sun.com/xml/ns/javaee"
# p g) Y+ O2 N8 H( E0 [ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" $ Z2 X6 _* O5 E$ o, d4 Y8 H% y3 ^. j
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee ) ^5 [" g5 g" M
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
" h) [: u0 @" v* y) N) B: o <servlet>) Y5 D5 c( ] |7 G
<servlet-name>WechatServlet</servlet-name>
2 U# e7 ] ]) {' u. b <servlet-class>demo.servlet.WechatServlet</servlet-class>- f) H% K; U. ]! v2 V: v
</servlet>7 r9 u( _: T) R" |9 x% w- }) ?; V, F
4 D/ r& H. W: u' r S <servlet-mapping>
8 [0 j- ^9 I( o5 N9 h! G6 B; c' ] <servlet-name>WechatServlet</servlet-name>8 ]/ ~/ Z% M8 k
<url-pattern>/wechat.do</url-pattern>
+ i+ V1 t* b8 W; A: A3 A( E# P, V </servlet-mapping>$ U! S- q$ ~3 }4 h4 Z- D
<welcome-file-list>$ d1 u) k# Q& X4 `1 J
<welcome-file>index.jsp</welcome-file>
7 }& N0 e) E; t" N </welcome-file-list>: K) l2 m0 q' }1 z5 E
</web-app>/ [, N( D3 ~2 j; r" n% W
复制代码 * Y3 j5 W w# I6 B
项目源码下载地址:
1 }8 S7 y5 {; V3 L5 w
- F6 ~; S9 Z) g8 ?8 ]; ~
, E% j6 T8 ~& W7 b- \
科帮网 1、本主题所有言论和图片纯属会员个人意见,与本社区立场无关2、本站所有主题由该帖子作者发表,该帖子作者与科帮网 享有帖子相关版权3、其他单位或个人使用、转载或引用本文时必须同时征得该帖子作者和科帮网 的同意4、帖子作者须承担一切因本文发表而直接或间接导致的民事或刑事法律责任5、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责6、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意7、科帮网 管理员和版主有权不事先通知发贴者而删除本文
JAVA爱好者①群:
JAVA爱好者②群:
JAVA爱好者③ :