2013-12-11 69 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

相關問題