小编mrj*_*per的帖子

如何使用Java将字符串转换为"html"ascii代码?

例如

B is uppercase B.
so if I have string like "BOY". I want it converted to BOY
Run Code Online (Sandbox Code Playgroud)

我希望已经有一个我可以使用的库.我在网上搜索过但我没有看到它.

谢谢

java

1
推荐指数
2
解决办法
1092
查看次数

Windows10 / Powershell:使用Get-Childitem时如何使用-include参数?

使用“ -filter”时:

Get-ChildItem -file -filter "*.txt" | foreach-object { write-host $_.FullName }

我得到了当前文件夹中的4个.txt文件的列表。

我尝试使用“ -include”

Get-ChildItem -file -include *.txt | foreach-object { write-host $_.FullName }
Get-ChildItem -file -include *txt | foreach-object { write-host $_.FullName }
Run Code Online (Sandbox Code Playgroud)

我什么也没得到。我尝试使用和不使用“ -file”参数,都没有区别。

我看过各种指南/示例(ss64.com/TechNet等),并且据说我做得对。

有什么想法我可能做错了吗?谢谢!

在此处输入图片说明

powershell

1
推荐指数
1
解决办法
308
查看次数

如何使用 jquery 自动选择下拉列表中的第一个选项?

我在自动选择下拉列表中的第一个选项时遇到问题。

我试过使用 attr 和 val 函数(请参阅jdfiddle 链接以获取示例),但它不起作用。作为测试,我的示例有一个警报代码,显示第一个选项的 .text() ,这很好用。所以我的选择器正在工作。

非常感谢!

示例 HTML 代码:

<select id="rt" name="rt" style="width: 300px;">
  <option value="blank" selected="selected">- Select a fruit -</option>
  <option value="20270">Apple</option>
  <option value="20271">Banana</option>
  <option value="20273">Grapes</option>
</select>
<br>
<select id="rs" name="rs" style="width: 300px;">
  <option value="blank" selected="selected">- Select a car -</option>
  <option value="20226">Toyota</option>
  <option value="20227">Chevy</option>
  <option value="20228">Mazda</option>
</select>
Run Code Online (Sandbox Code Playgroud)

示例JS代码:

$("#rs").on("change", function() {
    alert("rt: "+$("#rt option:first-child").text());
    $("#rt option:first-child").attr("selected", "selected");
    //$("#rt option:first-child").val("blank");
});
Run Code Online (Sandbox Code Playgroud)

jquery

1
推荐指数
1
解决办法
1万
查看次数

如何使用HTL / Sightly访问后缀?

TLDR:创建一个名为“ mypage.html”的新AEM页面。在URL中提供后缀。将此后缀传递给Sling servlet。后缀用作URL参数。

所需的网址示例:http:// localhost:4502 / mypage.html / john / smith


因此,我创建了一个可以读取后缀的servlet(使用本指南:http : //www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/)。

@SuppressWarnings("serial")
@SlingServlet(paths="geometrixx/components/hompepage", selectors="name", extensions="html",methods="GET", metatype=true)
public class StaffProfileServlet extends SlingAllMethodsServlet {
    private static final Logger log = LoggerFactory.getLogger(CourseBookmarkServlet.class);

    @Override
    protected void doGet(final SlingHttpServletRequest request,
                         final SlingHttpServletResponse response) throws ServletException, IOException {
        RequestPathInfo rpi = request.getRequestPathInfo();
        String[] suffixes = rpi.getSuffix().split("/");
Run Code Online (Sandbox Code Playgroud)

如果我通过http:// localhost:4502 / content / geometrixx / en.name.html / first / last访问它,它将正常工作

接下来,我要创建一个名为“ mypage.html”的新页面,并首先提供后缀作为后缀。

mypage将在格式正确的页面中显示与该人有关的信息。使用上面的代码,我得到的只是JSON响应。

我认为实现我的目标所需的一些假设/更改:

  1. 我将在servlet代码上使用路径并使用请求参数(即,使用request.getParameter(“ myparameter”))
  2. 我将使用AJAX访问servlet

如果我的假设正确,那么如何从HTL / …

sling aem sightly htl

1
推荐指数
1
解决办法
646
查看次数

AEM 6.x:如何将HTL变量传递给clientlib/JS?

所以我有以下几行加载我的JavaScript.

<sly data-sly-use.clientLib="${'/libs/granite/sightly/templates/clientlib.html'}" data-sly-unwrap />
<sly data-sly-call="${clientLib.js @ categories='myhost.mycustomJS'}" data-sly-unwrap />
Run Code Online (Sandbox Code Playgroud)

我有一个HTL属性(例如:$ {properties.myCustomProperty}),我想传递给myCustomJS.

有什么想法可以做到吗?

我环顾网了但没找到任何有用的东西.

谢谢.

aem htl

0
推荐指数
1
解决办法
1192
查看次数

标签 统计

aem ×2

htl ×2

java ×1

jquery ×1

powershell ×1

sightly ×1

sling ×1