2013-12-11 33 views
0

我通过运行问题进行了ModelAndView中找不到JSP视图春天的ModelAndView没有找到JSP页面 - 请求的资源不可用

以下是CONTROLER

@Controller 
public class BasicController { 
    private String GUID; 

    @RequestMapping(value = "/basicLti.spr", method = RequestMethod.GET) 
    public ModelAndView view(@RequestParam(value = ORG_IDS_ATTRIBUTE, required = false) String orgIds) { 
     ModelAndView mav = new ModelAndView(); 

     String GUID="one"; 

     if(orgIds != null) { 
      mav = new ModelAndView("sso-auth-tool"); 
      mav.addObject(userId, "36bdf294-2832-4179-b9e4-b4e2148fb048"); 
      mav.addObject(GUID,"String"); 
      mav.addObject(ORG_IDS_ATTRIBUTE, "512488b9-a387-45b0-b7c6-d514d112566e"); 
      return mav; 
     } 
     System.out.println("here i am"); 
    } 

} 

我有JSP教职员如下:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<html> 
<head> 
</head> 
<body> 
    <!--[if IE]> 
    <form name="formLogin" action="${ssoUrl}" method="post" target="_blank"> 
    <p id="message" style="visibility:hidden;">Your Starrmatica course has been opened in a new window.</p> 
<![endif]--> 
    <!--[if !IE]>--> 

    <p>Got Message</p> 


     <input type='hidden' name='iqity_id' value='${user_id}'> 
     <input type="hidden" name="school_id" value="${school_id}"> 
     <input type="submit" name="guid_key" value="${guid_key}"> 
     <!-- <input type="submit" id="sas-auth-tool" value="Authenticate Resources" name="submit" /> --> 
    </form> 
</body> 
</html> 

的servlet-context.xml文件

<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
     <beans:property name="prefix" value="/WEB-INF/views/" /> 
     <beans:property name="suffix" value=".jsp" /> 
    </beans:bean> 

现在它没有找到asso.jsp - HTTP 404错误! 我的问题是; 我如何评估jsp文件?

WEB.XML

<?xml version="1.0" encoding="UTF-8"?> 
<!-- Use this definition if using a Java EE 6 container This also stops Eclipse 
    from complaining that 3.0 is not a valid version <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" 
    http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> --> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    version="2.5"> 

    <!-- The definition of the Root Spring Container shared by all Servlets 
     and Filters --> 
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/spring/root-context.xml</param-value> 
    </context-param> 

    <!-- Creates the Spring Container shared by all Servlets and Filters --> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <!-- Processes application requests --> 
    <servlet> 
     <servlet-name>appServlet</servlet-name> 
     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
     <init-param> 
      <param-name>contextConfigLocation</param-name> 
      <param-value>/WEB-INF/spring/app/servlet-context.xml</param-value> 
     </init-param> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet> 
     <servlet-name>CXFServlet</servlet-name> 
     <servlet-class> 
      org.apache.cxf.transport.servlet.CXFServlet 
     </servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>CXFServlet</servlet-name> 
     <url-pattern>/services/*</url-pattern> 
    </servlet-mapping> 

    <servlet-mapping> 
     <servlet-name>appServlet</servlet-name> 
     <url-pattern>*.spr</url-pattern> 
    </servlet-mapping> 

    <error-page> 
     <exception-type>java.lang.Throwable</exception-type> 
     <location>/WEB-INF/error.jsp</location> 
    </error-page> 

    <welcome-file-list> 
     <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 


</web-app> 
+0

发表您的web.xml文件和HTML包含链接服务器返回 –

+1

是否文件'/ WEB-INF /视图/ SSO-AUTH-tool.jsp'存在于您的部署web应用? – jalynn2

+0

是/WEB-INF/views/sso-auth-tool.jsp存在于e = deploy webapp中。 – Thunder

回答

0
ModelAndView mav = new ModelAndView("sso-auth-tool"); 

    String GUID="one"; 

    if(orgIds != null) { 
     mav.addObject(userId, "36bdf294-2832-4179-b9e4-b4e2148fb048"); 
     mav.addObject(GUID,"String"); 
     mav.addObject(ORG_IDS_ATTRIBUTE, "512488b9-a387-45b0-b7c6-d514d112566e"); 
     return mav; 
    } 
    System.out.println("here i am"); 

这应该工作,因为必须有一个视图的名字,但在你的代码,查看名称设置只有当orgIds != null没有在相反的情况。

+0

试过了,没有帮助。 – Thunder

+0

发布您收到的错误和jsp文件的名称? – harsh

+0

资源未找到 - 404文件名称sso-auth-tool.jsp – Thunder

相关问题