Announcement Announcement Module
Collapse
No announcement yet.
Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hi,

    I'm trying to import a page fragment in a jsp page that is under WEB-INF/jsp using <c:import url="/somepath/myjspfragment.jspf">. I configured a controller for my application and a default application controller as shown in a file called myapp-servlet.xml:

    <bean id="handlerMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <props>
    <prop key="/**/*.jspf">defaultController</prop>
    <prop key="/myapp*">myAppController</prop>
    </props>
    </property>
    </bean>

    <bean id="defaultController" class="org.springframework.web.servlet.mvc.UrlFile nameViewController"/>

    My web.xml mappings look like this:

    <servlet-mapping>
    <servlet-name>myapp</servlet-name>
    <url-pattern>/myapp/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
    <servlet-name>myapp</servlet-name>
    <url-pattern>/**/*.jspf</url-pattern>
    </servlet-mapping>

    I thought this would then resolve the jsp fragments correctly, but no luck (in fact it gets into an infinite loop).

    Does anyone have any ideas about how this should be accomplished. I'm new to Spring.

    Thanks!

  • #2
    In case anyone is interested I've been playing with Tiles as an alternative (which I last used well over a year ago) and it work beautifully.

    This is my setup in my web.xml:

    <servlet>
    <servlet-name>tiles</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet>
    <servlet-name>image</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>tiles</servlet-name>
    <url-pattern>*.html</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
    <servlet-name>myapp</servlet-name>
    <url-pattern>/myapp/*</url-pattern>
    </servlet-mapping>

    With associated *-servlet.xml configurations. Then just regular tiles definitions.

    <!-- DEFAULT MAIN TEMPLATE -->
    <definition name="template" page="/WEB-INF/jsp/common/main_template.jsp">
    <put name="menu" value="/WEB-INF/jsp/common/menu.jsp" type="page"/>
    </definition>

    <definition name="index" extends="template">
    <put name="content" value="/myapp/myappCommand" type="page"/>
    </definition>

    anyway you all probably know all this already....

    Comment

    Working...
    X