org.sakaiproject.util.Web.escapeJavascript()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 JavaScript  
字(5.8k)|赞(0)|评价(0)|浏览(253)

本文整理了Java中org.sakaiproject.util.Web.escapeJavascript()方法的一些代码示例,展示了Web.escapeJavascript()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Web.escapeJavascript()方法的具体详情如下:
包路径:org.sakaiproject.util.Web
类名称:Web
方法名:escapeJavascript

Web.escapeJavascript介绍

[英]Return a string based on value that is safe to place into a javascript / html identifier: anything not alphanumeric change to 'x'. If the first character is not alphabetic, a letter 'i' is prepended.
[中]返回一个基于值的字符串,该值可以安全地放入javascript/html标识符中:任何非字母数字的内容都可以更改为“x”。如果第一个字符不是字母,则在前面加上字母“i”。

代码示例

代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib

protected Map getParameters(HttpServletRequest request) {
 Map params = super.getParameters(request);
 if (params == null) {
   params = new Hashtable();
 }
 if (ToolManager.getCurrentPlacement() != null) {
   params.put("panelId", Web.escapeJavascript("Main" + ToolManager.getCurrentPlacement().getId()));
   params.put(FormHelper.XSL_SITE_ID, ToolManager.getCurrentPlacement().getContext());
 }
 if ( request.getAttribute(STYLESHEET_PARAMS) != null )
   params.putAll((Map) request.getAttribute(STYLESHEET_PARAMS));
 if ( request.getAttribute(STYLESHEET_LOCATION) != null )
   params.put(STYLESHEET_LOCATION, request.getAttribute(STYLESHEET_LOCATION));
 return params;
}

代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib

public ModelAndView handleRequest(Object requestModel, Map request, Map session, Map application, Errors errors) {
 Map model = new HashMap();
 model.put("tool", getWorksiteManager().getTool(ToolManager.getCurrentPlacement().getId()));
 model.put("mainPanel", Web.escapeJavascript("Main" + ToolManager.getCurrentPlacement().getId()));
 return new ModelAndView("success", model);
}

代码示例来源:origin: sakaiproject/sakai

public void setupForward(HttpServletRequest req, HttpServletResponse res,
    Placement p, String skin) throws ToolException
  {
      Site site = null;
  if ( p != null ) {
    try {
      site = SiteService.getSite(p.getContext());
    }
    catch (IdUnusedException ex) {
      log.debug(ex.getMessage());
    }
      }
  // Get the tool header properties
  Properties props = toolHeaderProperties(req, skin, site, p);
  for(Object okey : props.keySet() ) 
  {
    String key = (String) okey;
    req.setAttribute(key,props.getProperty(key));
  }
  StringBuilder bodyonload = new StringBuilder();
  if (p != null)
  {
    String element = Web.escapeJavascript("Main" + p.getId());
    bodyonload.append("setMainFrameHeight('" + element + "');");
  }
  bodyonload.append("setFocus(focus_path);");
  req.setAttribute("sakai.html.body.onload", bodyonload.toString());
  portalService.getRenderEngine(portalContext, req).setupForward(req, res, p, skin);
}

代码示例来源:origin: org.sakaiproject.portal/sakai-portal-render-impl

Web.escapeJavascript("Main" + configuration.getId())).append("\"\n")
.append("	id=\"").append(
    Web.escapeJavascript("Main" + configuration.getId()))
.append("\"\n	title=\"").append(titleString).append(" ").

代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl

public void setupForward(HttpServletRequest req, HttpServletResponse res,
    Placement p, String skin) throws ToolException
  {
      Site site = null;
  if ( p != null ) {
    try {
      site = SiteService.getSite(p.getContext());
    }
    catch (IdUnusedException ex) {
      log.debug(ex.getMessage());
    }
      }
  // Get the tool header properties
  Properties props = toolHeaderProperties(req, skin, site, p);
  for(Object okey : props.keySet() ) 
  {
    String key = (String) okey;
    req.setAttribute(key,props.getProperty(key));
  }
  StringBuilder bodyonload = new StringBuilder();
  if (p != null)
  {
    String element = Web.escapeJavascript("Main" + p.getId());
    bodyonload.append("setMainFrameHeight('" + element + "');");
  }
  bodyonload.append("setFocus(focus_path);");
  req.setAttribute("sakai.html.body.onload", bodyonload.toString());
  portalService.getRenderEngine(portalContext, req).setupForward(req, res, p, skin);
}

代码示例来源:origin: sakaiproject/sakai

m.put("pagePopupUrl", pagePopupUrl);
m.put("pageTitle", Web.escapeHtml(p.getTitle()));
m.put("jsPageTitle", Web.escapeJavascript(p.getTitle()));
m.put("pageId", Web.escapeUrl(p.getId()));
m.put("jsPageId", Web.escapeJavascript(p.getId()));
m.put("pageRefUrl", pagerefUrl);
m.put("pageResetUrl", pageResetUrl);
  m.put("isPage", Boolean.valueOf(false));
  m.put("toolId", Web.escapeUrl(placement.getId()));
  m.put("jsToolId", Web.escapeJavascript(placement.getId()));
  m.put("toolRegistryId", placement.getToolId());
  m.put("toolTitle", Web.escapeHtml(placement.getTitle()));
  m.put("jsToolTitle", Web.escapeJavascript(placement.getTitle()));
  m.put("toolrefUrl", toolrefUrl);
  m.put("toolpopup", Boolean.valueOf(source!=null));

代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl

m.put("pagePopupUrl", pagePopupUrl);
m.put("pageTitle", Web.escapeHtml(p.getTitle()));
m.put("jsPageTitle", Web.escapeJavascript(p.getTitle()));
m.put("pageId", Web.escapeUrl(p.getId()));
m.put("jsPageId", Web.escapeJavascript(p.getId()));
m.put("pageRefUrl", pagerefUrl);
m.put("pageResetUrl", pageResetUrl);
  m.put("isPage", Boolean.valueOf(false));
  m.put("toolId", Web.escapeUrl(placement.getId()));
  m.put("jsToolId", Web.escapeJavascript(placement.getId()));
  m.put("toolRegistryId", placement.getToolId());
  m.put("toolTitle", Web.escapeHtml(placement.getTitle()));
  m.put("jsToolTitle", Web.escapeJavascript(placement.getTitle()));
  m.put("toolrefUrl", toolrefUrl);
  m.put("toolpopup", Boolean.valueOf(source!=null));

代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl

toolMap.put("toolPlacementIDJS", Web.escapeJavascript("Main"
    + placement.getId()));

代码示例来源:origin: sakaiproject/sakai

toolMap.put("toolPlacementIDJS", Web.escapeJavascript("Main"
    + placement.getId()));

相关文章