Тусгай тэмдэгтийн тайлбар: <any> нь any бол заавал бичигдэх ёстой зүйлийг заана.
- WebLayoutController
public class <Name>Controller extends WebLayoutController {
/**
*for <td>${<contextname>_}</td>
*/
private static final String DEFAULT_CONTENT_OBJECT_PREFIX = "<contextname>_";
/**
*List list = manager.list(id, site);
*request.setAttribute(prefix+“ list”, list);
*/
private <Name>Manager manager;
/**
*for <td>${<prefix>list}</td>
*/
private String prefix = DEFAULT_CONTENT_OBJECT_PREFIX;
@Override
protected ModelAndView handleSiteRequest( HttpServletRequest request
, HttpServletResponse httpServletResponse
, ModelAndView modelAndView
, PageInfo pageInfo, WebSite webSite) throws Exception {
Object clientId = request.getSession()
.getAttribute(webSite. getConfiguration(Config. SESSION_CLIENT_ID));
String clientStatus = request.getParameter(“ firstname”);
if (clientId == null || !clientStatus.equals(“in”)) {
//response any jump url
response.setHeader("Cache- Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0 response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
response.sendRedirect(request. getContextPath()
+ "/<key of Controller>(home.shtml .etc)");
return null;
} else {
//response any content page with layout page
}
return modelAndView;
}
- AbstractController
public class ClientXdataController extends AbstractController {
/**
*for <td>${<contextname>_}</td>
*/
private static final String DEFAULT_CONTENT_OBJECT_PREFIX = "<contextname>_";
/**
*List list = manager.list(id, site);
*request.setAttribute(prefix+” list”, list);
*/
private <Name>Manager manager;
/**
*for <td>${<prefix>list}</td>
*/
private String prefix = DEFAULT_CONTENT_OBJECT_PREFIX;
@Override
protected ModelAndView handleRequestInternal( HttpServletRequest request
, HttpServletResponse response) throws Exception {
WebSite webSite = WebUtil.getSiteFromRequest( httpServletRequest);
Object client = request.getSession()
.getAttribute(webSite. getConfiguration(Config. SESSION_CLIENT_ID));
if (client == null && “”.equals(client)) {
//response any content page
ModelAndView next = new ModelAndView(
webSite.getName()+"/"+webSite. getTemplate()
+"/<title of Controller>(home .etc)");
return next;
} else {
//response any text
response.getWriter().println(" OK");
return null;
}
}
}
Sequence:
request url - > Servlet ( load spring framework ) - > call controller ( return modelAndView ) - > print jsp ( with data );
No comments:
Post a Comment