------ Solution ------------------------------------ --------
with property labels.
bean class set on it .
------ Solution ---------------------------------------- ----
question is not very clear. . . Is said to get the current project name ? ? In the init method to get started , the latter can be used
------ Solution ---------------------------- ----------------
in spring configuration inside a bean, start calling init () method to get the current project ContextPath, setAttribute on it , similar to the project a global variables
------ Solution --------------------------------------- -----
ah , it is now stuck in how to get this ContextPath yet.
public class ResourcePathExposer implements ServletContextAware {
private ServletContext servletContext;
public void init() {
getServletContext().setAttribute("ctx", getServletContext().getContextPath());
}
public ServletContext getServletContext() {
return servletContext;
}
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
}
------ For reference only ----------------------------------- ----
did not quite understand what you're asking oh
------ For reference only ---------------------- -----------------
totally do not understand ask what
------ For reference only ----------- ----------------------------
an application package aaa.war, at deployment time may well be renamed bbb.war I hope that when you get this in the Programs bbb. Requirement can not be modified web.xml, you can not use Servlet and Filger, framework Spring. So I wanted to in the bean 's init method to do this thing .
experts have not encountered such a scenario , there is no thinking gets advice ?
------ For reference only -------------------------------------- -
top, continue to seek ideas .
------ For reference only -------------------------------------- -
ah , it is now stuck in how to get this ContextPath yet.
------ For reference only -------------------------------------- -
ah , it is now stuck in how to get this ContextPath yet.
public class ResourcePathExposer implements ServletContextAware {
private ServletContext servletContext;
public void init() {
getServletContext().setAttribute("ctx", getServletContext().getContextPath());
}
public ServletContext getServletContext() {
return servletContext;
}
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
}
received , thank master !
没有评论:
发表评论