二維碼掃描器
發(fā)現(xiàn)問題:二次開發(fā)的sdk里的demo不能運行琼讽,應(yīng)該是動態(tài)庫有問題搀暑,
與掃描器的公司技術(shù)溝通之后,還沒解決跨琳,人家也挺忙的,所以百度桐罕,發(fā)現(xiàn)問題:動態(tài)庫的位數(shù)不對脉让,參考http://blog.csdn.net/u013430189/article/details/50848796
解決問題之后,demo可以運行功炮,之后可以進行二次開發(fā)溅潜。
服務(wù)Servlet
發(fā)現(xiàn)昨天的問題之后,今天看了服務(wù)器響應(yīng)的東西薪伏,參考
- 主要寫法:http://blog.csdn.net/fyy90903/article/details/46928083
- 編碼的問題:http://blog.csdn.net/sinat_27714067/article/details/53864025
主要用到
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
- web.xml是什么:http://blog.csdn.net/u013439850/article/details/49980957
- 解決網(wǎng)頁緩存:http://www.jb51.net/article/120093.htm
之后寫出了新的servlet_test項目包
主要文件:
昨天用到的ConnectMysql.java滚澜、Student.java、TestMapToJson.java
新寫了src/Servlet/TestServlet.java
package Servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cuz_welcome.ConnectMysql;
/**
* Servlet implementation class TestServlet
*/
@WebServlet("/TestServlet")
public class TestServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TestServlet()
{
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// TODO Auto-generated method stub
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
// response.getWriter().append("Served at: ").append(request.getContextPath());
// 指定該頁面不緩存
response.setDateHeader("Expires", -1); // IE游覽器支持的
response.getWriter().append(ConnectMysql.getStu());
}
}
結(jié)果
訪問https://www.zumc.xin/serlvet_test/TestServlet可以取到數(shù)據(jù)庫的數(shù)據(jù)嫁怀。
微信小程序可以調(diào)用服務(wù)器的數(shù)據(jù)了设捐。
接下來準備設(shè)計數(shù)據(jù)庫。