Results 1 to 5 of 5

Thread: Error using spring tld in any jsp page

  1. #1

    Default Error using spring tld in any jsp page

    Code:
    <%@taglib prefix="c" uri="http&#58;//java.sun.com/jsp/jstl/core" %> 
    <%@taglib uri="http&#58;//www.springframework.org/tags" prefix="spring" %> 
    <%@page  contentType="text/html;charset=gb2312"%> 
    <html> 
    <head> 
    <title>用户注册</title> 
    </head> 
    <body> 
    </body> 
    </html>
    error:
    java.lang.IllegalStateException: No WebApplicationContext found: not in a DispatcherServlet request?
    org.springframework.web.servlet.support.RequestCon textUtils.getWebApplicationContext(RequestContextU tils.java:79)
    org.springframework.web.servlet.support.RequestCon textUtils.getWebApplicationContext(RequestContextU tils.java:56)
    org.springframework.web.servlet.support.RequestCon text.<init>(RequestContext.java:95)
    org.springframework.web.servlet.support.RequestCon text.<init>(RequestContext.java:81)
    org.springframework.web.servlet.tags.RequestContex tAwareTag.doStartTag(RequestContextAwareTag.java:6 7)
    org.apache.jsp.register_jsp._jspService(register_j sp.java:84)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

    my web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?> 
    <web-app xmlns="http&#58;//java.sun.com/xml/ns/j2ee" xmlns&#58;xsi="http&#58;//www.w3.org/2001/XMLSchema-instance" xsi&#58;schemaLocation="http&#58;//java.sun.com/xml/ns/j2ee http&#58;//java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> 
      <display-name>test</display-name> 
      <context-param> 
        <param-name>contextConfigLocation</param-name> 
        <param-value>/WEB-INF/test-servlet.xml</param-value> 
        
      </context-param> 
      <servlet> 
        <servlet-name>context</servlet-name> 
        <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> 
        <load-on-startup>1</load-on-startup> 
      </servlet> 
      <servlet> 
        <servlet-name>test</servlet-name> 
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> 
        <load-on-startup>1</load-on-startup> 
      </servlet> 
      <servlet-mapping> 
        <servlet-name>test</servlet-name> 
        <url-pattern>*.htm</url-pattern> 
      </servlet-mapping> 
      <servlet-mapping> 
        <servlet-name>test</servlet-name> 
        <url-pattern>*.do</url-pattern> 
      </servlet-mapping> 
    
      <jsp-config> 
        <taglib> 
          <taglib-uri>http&#58;//java.sun.com/jsp/jstl/core</taglib-uri> 
          <taglib-location>/WEB-INF/c.tld</taglib-location> 
        </taglib> 
        <taglib> 
          <taglib-uri>http&#58;//java.sun.com/jsp/jstl/xml</taglib-uri> 
          <taglib-location>/WEB-INF/x.tld</taglib-location> 
        </taglib> 
        <taglib> 
          <taglib-uri>http&#58;//java.sun.com/jsp/jstl/fmt</taglib-uri> 
          <taglib-location>/WEB-INF/fmt.tld</taglib-location> 
        </taglib> 
        <taglib> 
          <taglib-uri>http&#58;//java.sun.com/jsp/jstl/sql</taglib-uri> 
          <taglib-location>/WEB-INF/sql.tld</taglib-location> 
        </taglib> 
      </jsp-config> 
    </web-app>

  2. #2
    Join Date
    Aug 2004
    Location
    Denver
    Posts
    249

    Default

    You need to access your pages through a controller, rather than directly. This will involve creating mappings for the urls in your *-servlet.xml file.

    Matt

  3. #3

    Default

    I have resolved it , thank you very much

  4. #4
    Join Date
    Sep 2004
    Location
    china
    Posts
    5

    Default

    to mfc42d:
    I have the same trouble with you. how can I resolve ? thanks!

  5. #5

    Default

    access your jsp pages through a controller

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 5
    Last Post: Aug 9th, 2008, 05:30 AM
  3. Pageable data list with Hibernate
    By robmorgan in forum Data
    Replies: 23
    Last Post: Jul 24th, 2006, 06:12 PM
  4. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •