springmvc框架404问题分析

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_35499112/article/details/88937137

浏览器访问controller层是首先路径我确定没问题,项目启动正常,就是访问时报错,404很是纳闷。解决思路:dubg启动,直接访问发现并没有进入controller层。访问路径是findAll.do路径没错,最后发现是web.xml配置文件的前端控制层的jar包导错了。

我导的是alibaba的前端控制器。。。。。切记必须到springframework下的。。。。。

 

 

 

 

 

 

wo

展开阅读全文

404!!!404!!!mother fucker 404!!!

07-26

这个是项目里面一段代码,主要是ajax执行servlet得到返回值rn下面是代码,非常感谢回帖的帮我的人rn[code=Java]rnrnrn //Ajax提交服务端创建日志班次对象信息rn document.getElementById("currentUserID").value = resultID;rn var JIEBRYMC = encodeURI(resultStr); // 接班人员名称rn var JIEBRYID = encodeURI(resultID); // 接班人员IDrn var url = "~/servlet/RunlogJJB?JIEBRQ="+jbrq.getValue();rn var request = mw.net.WebRequest(url, "POST");rn alert(url);rn request.contentType = "application/x-www-form-urlencoded";rn // 设置参数。rn // key : 逻辑判断 , appCode : 应用标识 , BCMC : 班次名称rn alert("ajax进行查询开始");rn request.query = key:"Insert", rn JIEBBC:encodeURI(document.getElementById("bcSel").value),rn JIEBRYMC:JIEBRYMC,rn JIEBRYID:JIEBRYID,rn JIEBRQ:jbrq.getText(),rn TQ:encodeURI(document.getElementById("tq").value),rn appCode:"<%=appCode%>",rn nowBC_OBJ_ID:"<%=nowBC_OBJ_ID%>",rn nowBCMC:encodeURI("<%=nowBCMC%>"),rn nowBCTIME:"<%=nowBCTIME%>",rn nowZBRYMC:encodeURI("<%=nowZBR%>"),rn nowZBRYID:"<%=nowZBRID%>",rn DW_OBJ_ID:"<%=DW_OBJ_ID%>"rn ;rn alert("提交查询");rn var response = request.getResponse();rn if(response.contentText=="F")rn rn alert("生成对象失败");rn rn elsern rn alert("返回数据:"+response.contentText);rn //刷新页面rn //这个参数修改对父窗口很重要rn window.dialogArguments.status="完成";rn //关闭窗口rn alert("窗口关闭");rn //window.close();rn rnrn[/code]rnrnrnrnweb.xml配置rnrnrnrn[code=XML] rn RunlogJJBrn nariis.pi3000.yxrzpz.servlets.RunlogJJBrn rn rn RunlogJJBrn /servlets/RunlogJJBrn [/code]rnrnclass文件放置路径rn[img=http://img.my.csdn.net/uploads/201207/26/1343301623_2108.jpg][/img]rnrn返回值404rn[img=http://img.my.csdn.net/uploads/201207/26/1343301623_2115.jpg][/img]rn 论坛

springmvc框架问题

08-23

网页上添加部门名称出现这个问题No mapping found for HTTP request with URI [/web/addOrUpdateDepart.do] in DispatcherServlet with name 'springmvc' 求大神解决rnrnrnweb.xmlrnrn Archetype Created Web Applicationrn rn EncodingFilterrn org.springframework.web.filter.CharacterEncodingFilterrn rn encodingrn utf-8rn rn rn forceEncodingrn truern rn rn rn EncodingFilterrn /*rn rn rn rn springmvcrn org.springframework.web.servlet.DispatcherServletrn rn rn contextConfigLocationrn classpath:applicationContext.xmlrn rn rn rn rn springmvcrn *.dorn rn rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnorg.hibernate.dialect.MySQL5Dialectrntruernrnrnrnrnrncom/ym/pojo/CrmClass.hbm.xmlrncom/ym/pojo/CrmCourseType.hbm.xmlrncom/ym/pojo/CrmDepartment.hbm.xmlrncom/ym/pojo/CrmFollow.hbm.xmlrncom/ym/pojo/CrmGraduate.hbm.xmlrncom/ym/pojo/CrmPost.hbm.xmlrncom/ym/pojo/CrmRefer.hbm.xmlrncom/ym/pojo/CrmRunoff.hbm.xmlrncom/ym/pojo/CrmStaff.hbm.xmlrncom/ym/pojo/CrmStation.hbm.xmlrncom/ym/pojo/CrmStudent.hbm.xmlrnrnrnrnapplicationcontext。xmlrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrncom.ym.action CrmDepartmentAction.javarnimport org.springframework.web.servlet.ModelAndView;rnrnimport com.ym.pojo.CrmDepartment;rnimport com.ym.service.CrmDepartmentService;rnrn@Controllerrnpublic class CrmDepartmentAction rn//依赖服务层rnrn@Autowiredrn@Qualifier("crmDepartmentService")rnprivate CrmDepartmentService crmDepartmentService;rnrnpublic void setCrmDepartmentService(CrmDepartmentService crmDepartmentService) rnthis.crmDepartmentService = crmDepartmentService;rnrnrn@RequestMapping("/addDepart.do")rnpublic ModelAndView addDepart(HttpServletRequest request,HttpServletResponse response)rnModelAndView mv = new ModelAndView();rn//得到页面上的数据:rnString depName = request.getParameter("depName");rn//添加rnCrmDepartment pojo = new CrmDepartment();rnpojo.setDepName(depName);rnrncrmDepartmentService.addCrmDepartment(pojo);rnmv.setViewName("/pages/login.jsp");rnreturn mv;rn 论坛

没有更多推荐了,返回首页