String reget = request.getQueryString();//就这个报空指针异常,我想获取?号以后完整的参数,谢谢
@WebServlet(name = "config_addmodel", urlPatterns = {"/system/config_addmodel"})
public class config_addmodel extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String restr = request.getParameter("model");//初始化接收参数,可以使用
String rURL = request.getServerName(); //来访域名信息,可以使用
String domain = super.getServletContext().getAttribute("sitedomain").toString(); //合法域名信息,可以使用
String reget = request.getQueryString();//上面都能用,就这个报空指针异常,我想获取?号以后完整的参数,谢谢
//System.out.print("xxx" + SerMod);
try (PrintWriter out = response.getWriter()) {
if (restr == null) {
String title = super.getServletContext().getAttribute("sitename").toString();
String locTitle = "系统配置";
String stMenu = "<a class=\"themeListmenufocus\" href=\"config_addmodel\"><i class=\"fa fa-plus-square\"></i> 增加功能</a> <a href=\"config_model\"><i class=\"fa fa-th\"></i> 功能管理</a> ";
String locMenu = "<li><span>系统配置</span></li><li><span>功能管理</span></li>";
String dir = "../";
String SerMod = bus_config_model.bus_add(); //获取业务具体代码
sysHtml newHtml = new sysHtml(); //新建模版
newHtml.setHtml(title, "leftmenu", locMenu, locTitle, stMenu, SerMod, "", dir);//设置模版
out.print(newHtml.ConfigModelAdd()); //输出模版
} else if (restr.equals("add")) {
//判断来访是否本站url
if (functionStr.requestURL(rURL, domain)) {
// //属于合法地址,开始处理业务
// String title = super.getServletContext().getAttribute("sitename").toString();
// String locTitle = "系统配置";
// String stMenu = "<a href=\"config_model.html\" class=\"themeListmenufocus\"><i class=\"fa fa-th\"></i> 功能管理</a> <a href=\"config_addmodel\"><i class=\"fa fa-plus-square\"></i> 增加功能</a> ";
// String locMenu = "<li><span>系统配置</span></li><li><span>功能管理</span></li>";
// String js = "<script src=\"${dir}mtjs/table/config_addmodel.js\"></script><script src=\"${dir}mtjs/system/MTtable.js\"></script>";
// String dir = "../";
//
// String SerMod = request.getQueryString();
// sysHtml newHtml = new sysHtml(); //新建模版
// newHtml.setHtml(title, "leftmenu", locMenu, locTitle, stMenu, SerMod, js, dir);//设置模版
// out.print(newHtml.ConfigModelAdd()); //输出模版
} else {
// //属于非法地址,退出操作
// out.print(errMessage.errme(netTools.getIpAddr(request), "禁止外部提交,请勿打扰!"));
}
}
}
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
}
}