url attribute of <h:graphicImage/> not accepting 2nd request parameter - jsf

I use a Servlet to stream an image from the database and I use the tag for display as follows:
<h:graphicImage url=”/servletUrl?para1=name1&para2=name2”/>
The problem starts if I include the 2nd parameter (&para2=name2) and I get the following error message:
The reference to entity "para2" must end with the ';' delimiter
Am I missing anything?

The ampersand & is actually an special character in XML. The ampersand is to be used to indicate the start of a XML entity like >, < and so on. Hence the exception message that it is expecting a ; which indicates the end of a XML entity.
To represent a standalone ampersand, you need to represent it as &.
<h:graphicImage url="/servletUrl?para1=name1&para2=name2" />
(note that I fixed the invalid curly quotes as well)

Related

Escaping characters in cucumber step definition

I have used following step def for capture error message from given pop up modal
Then warning "Invalid file. File name should be "Users.xml" " should be given to user
In this case I want to include "User.xml" inside the given string
#Then("^warning \"([^\"]*)\" should be given to user
But this will not escaping the ". How do I escape this " character for matching the exact string
You need to change
#Then("^warning \"([^\"]*)\" should be given to user
to
#Then("^warning \"(.*?)\" should be given to user$"
[^"]* is matching everything except quotes
.*? will match everything (including quotes )
For more information See here
You can also use multiline string to do that as explained in above link
Also see this video tutorial for including strings in your arguments

DialogFlow: Adding entity values with brackets

I am trying to add entries to a entity which contains bracket.
eg: project 1(new)
This throws back an error:
Error parsing Entity 'project_name': Syntax Error in input 'project
1(new)'. Incorrect token '(' at position 32. Brackets can only be used
with parameterized entities.
Any solutions how to train it?
Added Image below Dialog Flow error image
You are using reserved characters for synonyms (parenthesis are reserved).
You can use them as value so you can retrieve this value with parenthesis but you need to clean it from synonyms, see the image:
Adding parenthesis to value (so in this sample, I must clean parenthesis - "Sinop Br" and "Sinop Brazil" from synonyms but I can preserve parenthesis on the value "Sinop (Br)" so this value can be used at backend)
Best regards

Can I use double quotes in Chef attribute declaration?

I have inherited a cookbook that sets some attributes in the ./attributes/default.rb file as per normal.
However, we have a problem with one of the lines is, which is:
default["obscured"]["mysql"] = "#{node['jboss']['jboss_home']}/modules/com/mysql/jdbc/main"
When run, it write this into the node as:
{}/com/mysql/jdbc/main
I can confirm that the node['jboss']['jboss_home'] attribute exists and has correct values.
So, I cannot see any problem with the above, except that every other declaration of this type in our cookbooks has single quotes on the attribute to be set (i.e. left side), not double quotes. I haven't heard this of as being an issue before, but I am pretty new to chef.
Is there any rule that says they must be single quotes?
The answer is that there is no rule.
Using double-quotes in something like this is completely fine:
default["obscured"]["mysql"] = blah blah
The reason I know that is that I just found one being set, with double quotes, that actually works. :-)
What you have there is fine, how are you confirming the value of node['jboss']['jboss_home'] and how are you using it in the template?
In Ruby single and double quoted literals both become Strings but single quotes are relatively literal while double quotes allow backslash escapes and #{} interpolation.
You are most likely hitting the derived attributes problem:
https://coderanger.net/derived-attributes/
The attribute code in your cookbook is getting parsed before the jboss_home attribute is being set. One way or another the solution is to move the interpolation into recipe code.
You could just use a plain old ruby variable instead of the attribute you are trying to construct -- particularly if nothing else in your system ever sets that attribute.
You also should be able to delete the declaration from your attributes file and use this in recipe code as well:
node.default_unless["obscured"]["mysql"] =
"#{node['jboss']['jboss_home']}/modules/com/mysql/jdbc/main"
Although you need to place that statement early in your run_list, before you ever use node["obscured"]["mysql"] as an argument to any resource.

Firebug identified xpath not working in protractor

Firebug identified xpath not working in protractor.I ahve cretaed xpath using firebug.When I identify the xpath using IDE,it is working fine.However when I use the same xpath in protractor,it is not working.My element does not have id or name.So here i can use only xpath option.
Please find the below image for reference.
Here I need to verify whether that particular element has "IRCTC Attractions" text.
Could you please help me?
HTML code:
//div style="width:100%;" class="g_hedtext">IRCTC Attractions /div
Find the element by text and assert it's present:
var elm = element(by.xpath("//div[. = 'IRCTC Attractions']"));
expect(browser.isElementPresent(elm)).toBe(true);
OK, looking at your error message (in the comment):
Exception loading: SyntaxError:
C:\Users\XXXX\AppData\Roaming\npm\TC_model2.js:7
var disclaimermessage = element(by.xpath('//[#id='disclaimer-message']'));
^^^^^^^^^^ Unexpected identifier
(I'm guessing where the carets before "Unexpected identifier" were aligned. Is that right?)
The problem is that you've used single quotes both to delimit the string 'disclaimer-message', and to delimit the whole XPath expression '//[#id='disclaimer-message']'. Thus it appears to the parser that your XPath expression is the stuff between the first two single quotes: '//[#id=', and then the disclaimer-message is some other identifier without any comma or other operator to show what it's doing there.
The solution is to use double quotes inside the XPath expression. XPath accepts either single or double quotes; it doesn't care, as long as you match them with each other. So change the offending line to
var disclaimermessage = element(by.xpath('//[#id="disclaimer-message"]'));
And you should be good to go.
For future reference, this question would have been quicker and easier to answer if you had told us about the error message in the first place.

How to write a hardcoded string value inside EL expression #{ } in JSF?

I am trying to do the following:
rendered="#{billBean.company.equals("something")}"
But the problem is I cannot write "something" inside #{}. It causes the below XML parsing error:
Element type "h:commandLink" must be followed by either attribute specifications, ">" or "/>".
How can I achieve this?
Use single quote (') to refer to a plain String inside EL:
rendered="#{billBean.company.equals('something')}"

Resources