- This topic has 5 replies, 3 voices, and was last updated 12 years, 5 months ago by cconway.
-
AuthorPosts
-
ssquireMemberHow do I change the default page that displays after adding Spring CRUD Scaffolding?
cconwayMemberSorry for the delayed response. The scaffolded app uses sitemesh to “construct” pages. Sitemesh is configured in the decorators.xml file. In there you’ll find this section that configures the default page:
<decorator name=”main” page=”main.jsp”>
<pattern>/*</pattern>
</decorator>If you want to use a completely different page, just change that configuration in decorators.xml. If you want to continue to use the decorated pages but just want different content, then edit the main.jsp page. More specifically, if you look in the body of main.jsp you’ll see where the page includes the other sitemesh components like header.jsp and footer.jsp. The “dashboard.jsp” that’s being included is the section that contains the list of scaffolded objects.
Rob SilverParticipantOkay so decorators.xml is the file that sets up sitemesh, but does the
<filter> definition tell the app to start with sitemesh? What says load sitemesh first and bring up its pages? Where is that defined in the web.xml file???
cconwayMemberThere is a filter and a filter-mapping in web.xml that together cause every page to have sitemesh applied:
<filter> <description>generated-sitemesh-filter</description> <filter-name>Sitemesh Filter</filter-name> <filter-class> com.opensymphony.module.sitemesh.filter.PageFilter </filter-class> </filter> <filter-mapping> <filter-name>Sitemesh Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Rob SilverParticipantSo can you explain how exactly this filter is applied in the case of /pages/menu.jsp page
The browser shows http://host.domain.com:8080/TheOffice/
for the first page
It sounds like the servlet first loads the filter along with it and all pages processed through the controller e.g
a ModelAndView object when rendered first go through the filter specified in the web.xml,
So within the Dispatcher servlet is configurable post processing of SiteMesh’s
com.opensymphony.module.sitemesh.filter.PageFilter after rendering the xhtml /html from the JSP page.
Is there also a way to change the Scaffolding code generation to use
SiteMeshFilter object instead of PageFilter. According the the page:
http://www.opensymphony.com/sitemesh/api/com/opensymphony/module/sitemesh/filter/PageFilter.html
the PageFilter object has been deprecated. You may want to provide an option for this in future ME4S releases.Also a tutorial on how SiteMesh works would be a really good idea.
Thus far I have not found a lot about how SiteMeshFilter object works.I would really appreciate a brief run through of the steps needed to render the menu.jsp page as a good starting point though!
cconwayMemberSitemesh is a technology that is documented outside of MyEclipse for Spring. While we do try to answer as many questions as possible, it is really outside of the scope of the MyEclipse for Spring support to field detailed questions about the workings of the app server and the individual technologies such as sitemesh, hibernate, JSP, etc.
Please refer to the documentation for the individual technologies to understand their inner workings.
-
AuthorPosts