"基于JSP的购物商城(MySQL版)
1.包含源程序,数据库脚本。
2.课题设计仅供参考学习使用,可以在此基础上进行扩展完善。
基于JSP的物流信息管理系统(MySQL版)
代码已经上传github,下载地址https://github.com/21503882/distributor
1.包含源程序,数据库脚本。代码和数据库脚本都有详细注释。
2.课题设计仅供参考学习使用,可以在此基础上进行扩展完善。
开发环境:
Eclipse 8,MySQL 5.0,JDK1.7,Tomcat 7
涉及技术点:
MVC模式、JavaWeb、JDBC、HTML、CSS、JQUERY等
程序功能:
1.网站前台:
用户注册登录、新闻资讯、网点信息、运单查询、运费查询、留言板、在线下单、我的订单等。
2.后台管理:
仓储管理、员工维护、会员管理、车辆管理、运单管理、用户签收、新闻资讯管理、留言管理等。"
前台:
会员登录后:
配送管理
package servlet;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import dao.SimpleWordSegment;
import dao.WordSegment;
import org.apache.log4j.Logger;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
@WebServlet(name = "WordSegmentServlet", value = "/WordSegmentServlet")
public class WordSegmentServlet extends HttpServlet {
private static Logger logger = Logger.getLogger(WordSegmentServlet.class);
private WordSegment wordSegment = new SimpleWordSegment();
private JsonObject json = new JsonObject();
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, IOException {
response.setCharacterEncoding("utf-8");
response.setContentType("application/json");
response.setHeader("Access-Control-Allow-Origin", "*");
String returnType = "JSON";
String string = request.getParameter("text");
switch (returnType) {
case "JSON":
// 分词结果转换成JSON数据
segment2Json(string);
logger.debug("要返回的JSON数据为:" + json.toString());
response.getWriter().write(json.toString());
break;
case "JSP":
break;
default:
break;
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws javax.servlet.ServletException, IOException {
logger.debug("使用do get方法");
doPost(request, response);
}
/**
* 分词算法
* @param text
*/
public void segment2Json(String text) {
String[] methods = {"MM", "RMM", "BM", "MC"};
if (text == null || text.equals("")) {
json.addProperty("status", false);
json.addProperty("error", "分词字符串为空!");
return ;
}
JsonArray array = new JsonArray();
for (String method : methods) {
JsonObject result = new JsonObject();
// 算法的名称
result.addProperty("name", method);
long start = System.currentTimeMillis();
List
long end = System.currentTimeMillis();
JsonArray dataSegment = new JsonArray();
if (data != null && data.size() != 0) {
StringBuffer log = new StringBuffer("");
for (String s : data) {
log.append(s + " / ");
dataSegment.add(new JsonPrimitive(s));
}
logger.debug("分词结果为:" + log);
}
// 算法的分词结果
result.add("dataSegment", dataSegment);
// 算法的运行时间
result.addProperty("time", end - start);
array.add(result);
}
json.addProperty("status", true);
// 所有算法的分词结果
json.add("result", array);
}
/**
* 得到对应的分词方法的结果
* @param method
* @param text
* @return
*/
public List
List
try {
Method[] methods = wordSegment.getClass().getDeclaredMethods();
for (Method m : methods) {
if (m.getName().equals(method)) {
dataSegment = (List
break;
}
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return dataSegment;
}
public JsonObject getJson() {
return json;
}
}
package weibo4j;
import java.util.List;
import weibo4j.model.Favorites;
import weibo4j.model.FavoritesTag;
import weibo4j.model.Paging;
import weibo4j.model.PostParameter;
import weibo4j.model.Tag;
import weibo4j.model.WeiboException;
import weibo4j.org.json.JSONException;
import weibo4j.org.json.JSONObject;
import weibo4j.util.WeiboConfig;
public class Favorite extends Weibo{
/**
*
*/
private static final long serialVersionUID = 2298934944028795652L;
/*----------------------------收藏接口----------------------------------------*/
/**
* 获取当前登录用户的收藏列表
*
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see favorites
* @since JDK 1.5
*/
public List
return Favorites.constructFavorites(client.get(WeiboConfig
.getValue("baseURL") + "favorites.json"));
}
/**
* 获取当前登录用户的收藏列表
*
* @param page
* 、count
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see favorites
* @since JDK 1.5
*/
public List
return Favorites.constructFavorites(client.get(
WeiboConfig.getValue("baseURL") + "favorites.json",
null, page));
}
/**
* 获取当前登录用户的收藏列表ID
*
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see favorites
* @since JDK 1.5
*/
public JSONObject getFavoritesIds() throws WeiboException {
return client.get(WeiboConfig
.getValue("baseURL") + "favorites/ids.json").asJSONObject();
}
/**
* 获取当前登录用户的收藏列表ID
*
* @return list of the Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see favorites
* @since JDK 1.5
*/
public JSONObject getFavoritesIds(Paging page) throws WeiboException {
return client.get(WeiboConfig
.getValue("baseURL") + "favorites/ids.json",null,page).asJSONObject();
}
/**
* 根据收藏ID获取指定的收藏信息
*
* @param id
* @return Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see * href="http://open.weibo.com/wiki/2/favorites/show">favorites/show
* @since JDK 1.5
*/
public Favorites showFavorites(String id) throws WeiboException {
return new Favorites(client.get(WeiboConfig.getValue("baseURL")
+ "favorites/show.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 根据标签获取当前登录用户该标签下的收藏列表
*
* @param tid
* @return list of the favorite Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see * href="http://open.weibo.com/wiki/2/favorites/by_tags">favorites/by_tags
* @since JDK 1.5
*/
public List
return Favorites.constructFavorites(client.get(
WeiboConfig.getValue("baseURL") + "favorites/by_tags.json",
new PostParameter[] { new PostParameter("tid", tid) }));
}
/**
* 根据标签获取当前登录用户该标签下的收藏列表
*
* @param tid
* @param page
* @return list of the favorite Status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/show">favorites/show
* @since JDK 1.5
*/
public List
throws WeiboException {
return Favorites.constructFavorites(client.get(
WeiboConfig.getValue("baseURL") + "favorites/by_tags.json",
new PostParameter[] { new PostParameter("tid", tid) }, page));
}
/**
* 获取当前登录用户的收藏标签列表
*
* @param page
* @return list of the favorite tags
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.1
* @see * href="http://open.weibo.com/wiki/2/favorites/tags">favorites/tags
* @since JDK 1.5
*/
public List
return Tag.constructTag(client.get(WeiboConfig
.getValue("baseURL") + "favorites/tags.json"));
}
/**
* 添加一条微博到收藏里
*
* @param 要收藏的微博ID
* 。
* @return Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/create">favorites/create
* @since JDK 1.5
*/
public Favorites createFavorites(String id) throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/create.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 取消收藏一条微博
*
* @param 要取消收藏的微博ID
* 。
* @return Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/destroy">favorites/destroy
* @since JDK 1.5
*/
public Favorites destroyFavorites(String id) throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/destroy.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 批量删除收藏
*
* @param ids
* 要取消收藏的收藏ID,用半角逗号分隔,最多不超过10个。
* @return destroy list of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/destroy_batch">favorites/destroy_batch
* @since JDK 1.5
*/
public Boolean destroyFavoritesBatch(String ids) throws WeiboException {
try {
return client
.post(WeiboConfig.getValue("baseURL")
+ "favorites/destroy_batch.json",
new PostParameter[] { new PostParameter("ids", ids) })
.asJSONObject().getBoolean("result");
} catch (JSONException e) {
throw new WeiboException(e);
}
}
/**
* 更新一条收藏的收藏标签
*
* @param id
* 要需要更新的收藏ID
* @return update tag of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/tags/update">favorites/tags/update
* @since JDK 1.5
*/
public Favorites updateFavoritesTags(String id) throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/tags/update.json",
new PostParameter[] { new PostParameter("id", id) }));
}
/**
* 更新一条收藏的收藏标签
*
* @param id
* 要需要更新的收藏ID
* @param tags
* 需要更新的标签内容,必须做URLencode,用半角逗号分隔,最多不超过2条。
* @return update tag of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/tags/update">favorites/tags/update
* @since JDK 1.5
*/
public Favorites updateFavoritesTags(String id, String tags)
throws WeiboException {
return new Favorites(client.post(WeiboConfig.getValue("baseURL")
+ "favorites/tags/update.json", new PostParameter[] {
new PostParameter("id", id), new PostParameter("tags", tags) }));
}
/**
* 更新当前登录用户所有收藏下的指定标签
*
* @param id
* 需要更新的标签ID。
* @return update tags of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/tags/update_batch">favorites/tags/update_batch
* @since JDK 1.5
*/
public JSONObject updateFavoritesTagsBatch(String tid, String tag)
throws WeiboException {
return client.post(
WeiboConfig.getValue("baseURL")
+ "favorites/tags/update_batch.json",
new PostParameter[] { new PostParameter("tid", tid),
new PostParameter("tag", tag) }).asJSONObject();
}
/**
* 删除当前登录用户所有收藏下的指定标签
*
* @param id
* 需要删除的标签ID。。
* @return destroy tags of Favorites status
* @throws WeiboException
* when Weibo service or network is unavailable
* @version weibo4j-V2 1.0.0
* @see * href="http://open.weibo.com/wiki/2/favorites/tags/destroy_batch">favorites/tags/destroy_batch
* @since JDK 1.5
*/
public Boolean destroyFavoritesTagsBatch(String ids) throws WeiboException {
try {
return client
.post(WeiboConfig.getValue("baseURL")
+ "favorites/destroy_batch.json",
new PostParameter[] { new PostParameter("ids", ids) })
.asJSONObject().getBoolean("result");
} catch (JSONException e) {
throw new WeiboException(e);
}
}
}
代码已经上传github,下载地址https://github.com/21503882/distributor