I want to set a th:class attribute depending on the context locale using the expression object #locale.
I have tried
th:class="${#locale}=='en'?'active':''"
th:class="${#locale=='en'}?'active':''"
Both of them results in false, but whent I print it with th:text="${#locale}, I got the correct locale code (en,es).
Any idea of how to compare the #locale object with a locale code?
Based on the answer posted by David_Garcia, I could resolve my issue this way:
th:class="__${#locale}__=='en'?'active':''
This is a issue that I told to the guys of thymeleaf time ago.
You need to resolve first the #locale before comparing it with "en".
You can do that adding 2 underscore at the beggining and end to the expresion that you want to resolve first. In your case will be something like this:
th:call="$({__#locale__}=='en'?'active':'')"
I used like this
th:text="${#locale.toString()}=='in'?'active':'inactive'"
Related
error=Navigation record searches specified with a missing keys or terms or both
How to solve the above Oracle Endeca query error ?
This error is coming as Ntt and Ntx parameters are having the blank value.Since this is navigation query than no need to pass these parameters, NTK, Ntt and Ntx.
I tried at my end and looks like query passed to MDEX engine is not parsed properly and gives Failed to Parse URL
I hope this helps.
Thanks,
Ajay Agrawal
I am trying to filter out my list of images by OS reference code. Here is the url I am trying:
https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups.json?objectMask=mask[flexImageFlag]&objectFilter={'children': {'blockDevices': {'diskImage': {'softwareReferences': {'softwareDescription': {'referenceCode': {'operation': 'REDHAT_6_64'}}}}}}}
But I am kept getting the following error msg:
{"error":"Unable to parse object filter.","code":"SoftLayer_Exception_Public"}
Can anyone help me see what is wrong? Thanks in advance!
Q.Z.
The filter is wrong, but in my tests the filter is not working with the "referenceCode" property; you need to use another property such as name, version or both. See below the examples:
using name and version property
https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups?objectMask=mask[flexImageFlag]&objectFilter={"blockDeviceTemplateGroups": {"children":{"blockDevices":{"diskImage":{"softwareReferences":{"softwareDescription":{"name":{"operation":"CentOS"}, "version":{"operation":"6.3-32"}}}}}}}}
Using only a property (name in this case)
https://api.softlayer.com/rest/v3/SoftLayer_Account/getBlockDeviceTemplateGroups?objectMask=mask[flexImageFlag]&objectFilter={"blockDeviceTemplateGroups": {"children":{"blockDevices":{"diskImage":{"softwareReferences":{"softwareDescription":{"name":{"operation":"CentOS"}}}}}}}}
Regards
Looks like you are using the REST api. The example in the
API reference, suggests that this parameter should be in JSON format:
https://api.softlayer.com/rest/v3/SoftLayer_Account/getVirtualGuests?objectMask=mask[id,hostname]&objectFilter={"datacenter":{"name":{"operation":"dal05"}}}
Your error says "Unable to parse object filter.", so the error is probably just be that your parameter is invalid JSON: The JSON standard only accepts double quotes.
Try replacing
{'children': {'blockDevices': {'diskImage': {'softwareReferences': {'softwareDescription': {'referenceCode': {'operation': 'REDHAT_6_64'}}}}}}}
with the corresponding valid json:
{"children": {"blockDevices": {"diskImage": {"softwareReferences": {"softwareDescription": {"referenceCode": {"operation": "REDHAT_6_64"}}}}}}}
Dear Stackoverflowers,
this is my first post, so I try to do everything correct.
In the error handler of an OSB component, I need to assign a value from the existing $originalHeader to another variable to reuse it, without entering the value as text.
In an assign-action, the expression $originalHeader/privateMetaAttributesHeader/LoggingCategory
for variable originalLoggingCategory does return the below:
Debugging_VariablesScreen
I do not understand why the value of LoggingCategory is not assigned to variable originalLoggingCategory. Please help me out with this.
Content of $originalHeader:
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><v1:privateMetaAttributesHeader xmlns:v1="http://www.example.org/scintilla/meta/v1"><SwingMonitoring>...</SwingMonitoring><LoggingCategory>com.schenker.scintilla.AirOcean.WWTAN.LoadPlanInstructionService.v1</LoggingCategory></v1:privateMetaAttributesHeader></soapenv:Header>
Thanks in advance.
Patrick
There is a difference between <privateMetaAttributesHeader> and <v1:privateMetaAttributesHeader>, which OSB rightly respects.
for instance
$originalHeader/privateMetaAttributesHeader/LoggingCategory may be null
$originalHeader/v1:privateMetaAttributesHeader/v1:LoggingCategory will probably return what you want (try selecting just the header at first, then work your way down to the logging category, just in case LoggingCategory isn't in the v1 namespace)
You can define what namespace 'v1' is in the OSB Proxy Stage, or if you don't know, you can use $originalHeader/*:privateMetaAttributesHeader/*:LoggingCategory but that's not recommended.
Is there a way to include the entire value in the filtering search? For example, searching “123″ would return the value “Test 123″. By default, the control only filters starting with the first character.
I tried modifying the queryExpr property mentioned here, but nothing seemed to work for me. Thanks for any tips.
I realise this is 2 years ago but I'm just answering in case someone else comes along looking!
You can specify the queryExpr like this:
<xe:djFilteringSelect id="djFilteringSelect1" value="#{viewScope.myvalue}" autoComplete="false">
<xe:this.queryExpr><![CDATA[${javascript:"*$\{0}*"}]]></xe:this.queryExpr>
<xp:selectItems id="selectItems1" value="#{myBean.mySelectItems}"/>
</xe:djFilteringSelect>
i´m a bit confused about using optional parameters and phpdocs.
I got the following #url statement:
#url GET /pruefvorschrift/:typs
now want to set :typs as optional so i do
function getpruefvorschrift ($typs=null) {...
this isn´t working, value for :typs is never available in $typs.
If i change the above # url rout to use other word e.g. :id it works?
I don´t understand it could anyone help?
For completeness:
I have many functions in this file
get /device.json/{id}
get /device/pruefvorschrift/:typs.json
get /device/serial.json/{serial}
get /device/:id/merkmale.json
Hope one could help,
thx
Inge
The parameter name is not the problem here!
Using optional parameter as part of the URL is strongly discouraged
By setting a default value for $typs you are making it optional
Which means we need to create two routes for the same api method
GET /device/pruefvorschrift/{typs}
And
GET /device/pruefvorschrift
By default restler 3 does not do it, where as restler 2 does it by default
You can add the following to the phpdoc comment to change that behaviour
/**
* #smart-auto-routing false
*/
function getpruefvorschrift ($typs=null) {
But keep in mind this may stand in the way of another route, read further at http://restler3.luracast.com/examples/_006_routing/readme.html and https://github.com/Luracast/Restler/issues/10