We create tasks containing multiple documents; each document has a number.
I have a string Field (docNums) in the Workflow that contains each document number separated by a delimiter. I have done this as the log / email template will only accept certain types.
I have edited the "stp_new.msg" template to include the docNums field.
No matter what I use as the delimiter, I only get plain text. (as in <BR> shows in the email as text "<BR>".
What can I use as a delimiter to provide a newline/carriage return? Or am I looking at this all wrong?
The template is <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
The field is being created by Java, and Java is also starting the workflow (via ICN). I have tried <BR> but CF seems to change it to <br>, which Outlook just treats as text.
In order for a list of strings (or String[]) to be displayed as a list inside a Process Engine Notification Template email (i.e. stp_new.msg etc.), the template will need the list set up as a String type variable and surrounded in Pre tags.
HTML template (stp_new.msg section):
<pre>{$stringContainingList}</pre>
The variable will need to be populated with the separator hex("0A")
Java (where list is a populated List):
String stringList;
for (String s : list){
stringList = stringList.concat(s).concat(String.valueOf((char)0x0A));
}
Process Engine (where array is a string[]):
arraytostring(array,"","",hex("0A"))
Related
I'm using Nifi, and it looks like ReplaceText doesn't work properly. I want to perform a text search and replace with these criteria:
I want to store a regex of my search string in a variable, not directly in a processor's property.
I want to store a regex of my replacement string in a variable, not directly in a processor's property.
I want to be able to only change the variables in the resulting template, so I can share it with other users via the Nifi registry.
I've tried using ExtractText to search for something, store that in an attribute, and then use the value of that attribute, but Nifi Expression Language scope is listed as unsupported for ExtractText user added properties. ReplaceText works fine if you want to put the regex in the ReplaceText property, but I don't, since I'm sharing the template via the registry and any time someone changes that property for their own search text, there will be a new version in the registry.
I have two fields, one that not allow save HTML tags on DB and the other allow.
How I create an validator that remove spetial chars and tags from my string before save, and apply on String fields only?
PS.: I need something to block SQL inject too.
Actually validator cannot remove any chars. Validator just checks whether entered content is valid or not.
Read for example
For your case you can define form fields and mar them with
#Pattern(regexp = "the detect html expression here")
See regular expressions to [detect][2] (and remove) html
Freemarker (by default) uses the locale to build the file names it looks for when loading and including templates. For example, loading tos.ftl (the template) with the en_US locale would look for:
tos_en_US.ftl
tos_en.ftl
tos.ftl
This can be useful to translate whole pages when the pages are completely different between different languages. For example, a "Terms of Service" page might be mostly static so different languages would have completely different content. In this case, it is a hassle to externalize the whole content to messages loaded from message bundles.
I am now learning Thymeleaf and can't find any information about a similar functionality. I know that Thymeleaf uses localized message bundles to fill in th:text elements, but can it load localized versions of the template files?
Note: I'm using Spring Boot
I know it's a little bit too late but here is how I would attempt to solve this using the current version of Thymeleaf:
Presuming you have these 2 localised templates under path (from the template root) path/to/template:
localized_template_en.html
localized_template_ru.html
In your SomeController.class:
#GetMapping( "/locale_test" )
public String getLocalisedPage( Model model ) {
return "path/to/template/localized_template_"
+ LocaleContextHolder.getLocale().getLanguage();
}
As a result you will get the correct template given you use Spring localisation features (such as LocaleChangeInterceptor). If not - instead of using LocaleContextHolder implement your custom logic for postfix selection.
Thymeleaf's behaviour the same as Spring 4 MVC Internationalization (I guess you using Thymeleaf with Spring??), it uses messages.properties to realize that.
For example you have a template with #{hello} message:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head>
<title></title>
</head>
<body>
<span th:text="#{hello}">
</body>
#{hello} text will be binded to the messages.properties proprty hello.
If you locale would be another, e.g. ru_RU you just add messages_ru_RU.properties and change the locale of your application.
After that, your message will be taken from localized properties file.
Note that necessarily to have messages.properties file if you using localized messages file.
I'm trying to get the latest results inserted into a collection (ordered by data) on the homepage. I haven't a 'q' parameter because the user doesn't make a search yet in the homepage. So, there's a way to do this? Maybe a special character, I didn't find anything in the documentation.
You could utilize the site: query to get all content from your site like
q=site%3Ahttp%3A%2F%2Fwww.yoururl.com&sort=date%3AD%3AS%3Ad1
(site:http://www.yoururl.com URL encoded)
Finally I found this way: I used the parameter requiredfields and link to it all the results that I want to show. For example:
www.gsa.it/search?q=&sort=date:D:S:d1&requiredfields=client
This will return any results that have a meta tag of this name
<meta name="client" content="lorem ipsum">
Reference: Restricts the search results to documents that contain the exact meta tag names or name-value pairs.
Iam developing a web application with free marker template using Struts2 tag libs.
I have a map in the request object with attribute name as "namesToBeUsed"
How to assign it to a variable in ftl using struts2 tag?
Iam getting below error if I assign like this <#sftl.set name="namesToBeUsed" value='${Request["namesToBeUsed"]}'/>
Expecting a string, date or number here, Expression Request["namesToBeUsed"] is instead a freemarker.template.SimpleHash
Can any one help me?
Thanks in advance.
Should be:
<#sftl.set name="namesToBeUsed" value=Request["namesToBeUsed"] />
because '${whateverExpression}' does string interpolation, and hence had to convert the expression value to string. So inside FreeMarker tags, just enter the expressions without any extra syntax around them.