标题说明了一切。
我尝试了多种方法,但似乎没有任何效果。
我尝试在 theme.properties 中导入样式表。styles=css/styles.css
我尝试直接在 html 标签中设置我的样式。<h1 style="color:blue;">
我尝试在我的 ftl 文件中添加我的风格,如下所示:
<html>
<style type="text/css">
body {
margin: 0;
font-family: 'Source Sans Pro';
font-weight: 400;
font-size: 16px;
}
.header{
background-color: #B70E0C;
width: 100%;
height: 96px;
}
.footer{
flex-shrink: 0;
width: 100%;
padding: 20px 0;
text-align: center;
font-size: 16px;
background-color: #2D2D2D;
z-index: 1;
position: absolute;
bottom: 0;
}
.footer a {
color: white !important;
}
a:visited {
color: initial;
}
.activate-btn{
border-radius: 8px;
padding: 12px 28px;
background-color: #FDC300;
color: …Run Code Online (Sandbox Code Playgroud) 因此,我使用 keycloak 作为身份验证机制,并通过修改 login.ftl 文件来自定义登录页面。到目前为止,一切都很好。我正在我的 login.ftl 中导入 template.ftl 文件 - 按照 keycloak 文档的指示 - 到目前为止一切顺利。在该 template.ftl 文件中 - 有一种方法可以访问错误消息,如下所示
<#if displayMessage && message?has_content && (message.type != 'warning' || !isAppInitiatedAction??)>
<div class="alert alert-${message.type}">
<#if message.type = 'success'><span class="${properties.kcFeedbackSuccessIcon!}"></span></#if>
<#if message.type = 'warning'><span class="${properties.kcFeedbackWarningIcon!}"></span></#if>
<#if message.type = 'error'><span class="${properties.kcFeedbackErrorIcon!}"></span></#if>
<#if message.type = 'info'><span class="${properties.kcFeedbackInfoIcon!}"></span></#if>
<span class="kc-feedback-text">${kcSanitize(message.summary)?no_esc}</span>
</div>
</#if>
Run Code Online (Sandbox Code Playgroud)
太好了!如果我不想处理 template.ftl 文件中的错误消息 ui 怎么办?我在login.ftl 页面上有一个表单UI,我想在其中显示错误消息。如何将该消息传递到login.ftl 文件或从login.ftl 文件访问该错误消息?预先感谢您的任何指导。
freemarker keycloak custom-theme keycloak-services error-messaging
我项目中的测试人员希望每个页面元素都有一个唯一的HTML ID,以便更轻松地进行自动化测试.
我很难记得这样做,因为我不需要ID来进行开发.我怎样才能确保我不忘记?
我想也许像Checkstyle这样的东西可以告诉我,甚至是IntelliJ中的"检查" - 但它们似乎都不支持这种功能.
有任何想法吗?
所以,我正在使用Struts2的freemarker模板来制定我的回复.但是,由于我也尝试使用taconite,我需要使用"text/xml"的内容类型发送响应.我似乎无法找到一种方法来使用freemarker指令来设置内容类型,而且我并不精通struts知道是否有办法通过它来实现.
那么,我该怎么做呢?
<select name="showYears">
<#list payrollYears as year>
<option value="${year.year}">${year.yeardesc}</option>
</#list>
</select>
Run Code Online (Sandbox Code Playgroud)
我从我的控制器获得payrollyears列表,我在freemarker中迭代列表,并在选择框中添加值我希望我的列表的最后一个值应该在最后选择值我怎么能这样做
我正在使用内置Apache Sling的内容存储库(Adobe CQ5).我想使用FreeMarker而不是JSP来呈现网页.
为了实现这一点,我应该将OSGi Freemarker扩展上传到Sling,这可以在Sling源代码的贡献部分找到,或者我应该上传一个OSGi版本的Freemarker吗?两个jar都实现了接口javax.script.ScriptEngineFactory,所以我不知道要使用哪个,或者上传两者.
我想用freemarker生成一些java代码,即生成一个方法的参数.我有一个名为doIt的方法,它需要一些参数名称和它们的类名,我将给模板一个名为paramList的参数.我定义一个宏指令,迭代参数列表,但因此每个参数占用一行.我的模板代码如下:
<#macro paramList plist>
<#if plist??>
<#list plist as p>
${p.javaType?substring(2)} ${p.name} <#if p_has_next>, </#if>
</#list>
</#if>
</#macro>
doIt(<@paramList plist=params/>)
Run Code Online (Sandbox Code Playgroud)
运行结果是:
doIt( int end ,
String endDate ,
String evtCode ,
int evtNo ,
String giftCode ,
int start ,
String startDate
)
Run Code Online (Sandbox Code Playgroud)
如何使所有参数输出出现在同一行中.我知道我可以在同一行写入list指令逻辑以避免换行,但是如果还有其他逻辑,那么一段时间后读取和理解会花费太长时间.我想要的格式是:
doIt(int end , String endDate, String evtCode , int evtNo , String giftCode , int start , String startDate)
Run Code Online (Sandbox Code Playgroud) 我在Freemarker中有一个对象,其日期为ISO8601格式(例如2012-02-01T13:01:02+0000),我将如何计算它与现在之间的天数差异?
在其他非Java场景中,我将其重新格式化为unix时间戳并进行数学运算(如distance_of_time_in_wordsRoR或Symfony中的函数),但据我所知,Freemarker无法将ISO8601时间戳转换为unix时间戳.
是的,我意识到模板层可能不适合做这种事情,但需要等等.
在Freemarker FTL文件中,我要调用StringUtils.capatilize(myString)。例如:
<p>You selected ${selectionString}.</p>
<p>${StringUtils.capatilize(selectionString)} is great.</p>
Run Code Online (Sandbox Code Playgroud)
我能以某种方式进口 org.apache.commons.lang3.StringUtils吗?
在Keycloak中,我们创建了一个自定义ftl注册主题,删除了可选的名字和姓氏字段.我们的系统只要求用户拥有电子邮件地址和密码.
但是,当用户点击输入时,会显示错误,指示需要输入名字和姓氏.
在Keycloak UserModel中,这些字段是可选的,也可以通过admin console/api创建用户,而无需使用firstname和lastname.
我们如何从注册屏幕上的keycloak表单验证中删除这些字段?
freemarker ×10
keycloak ×3
html ×2
java ×2
aem ×1
checkstyle ×1
css ×1
custom-theme ×1
datetime ×1
scriptengine ×1
sling ×1
spring-mvc ×1
struts2 ×1
taconite ×1
xml ×1