I can't get on with the following task and I haven't even found any information about expression language functions in JSF which is able to help me. I have a task -
Display lines out which start in a new line
ManagedBean(name = "Bean_0") method that returns the lines is
public String task4() {
String result = "";
String surname = "Sckoriy";
int i = 0;
do {
result += surname + "\n";
i++;
}while(i != 4);
return result;
}
Here is xhtml code -
<div class = "Container">
<p class = "Task">#{Bean_0.getTask4()}</p>
<p class = "Result">
//Difficult is here
//What's syntax must there be?
<h:outputText value = "#{fn:replace(Bean_0.task4(),'\n','<br/>')}" escape="false"/>
</p>
</div>
I get the exception -
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path
[/Practice] threw exception [/Page.xhtml @34,78 value="#
{fn:replace(Bean_0.task4(),'\n','<br/>')}" Failed to parse the expression [#
{fn:replace(Bean_0.task4(),'\n','<br/>')}]] with root cause
org.apache.el.parser.ParseException: Encountered " <ILLEGAL_CHARACTER> "\'
"" at line 1, column 29.
Was expecting one of:
"{" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"null" ...
"(" ...
"[" ...
"!" ...
"not" ...
"empty" ...
"-" ...
<IDENTIFIER> ...
<IDENTIFIER> ...
"(" ...
where line should be separated and it works)After I have your comment I will certainly get a java ee developer in the future!) – skoriy Apr 23 '19 at 19:01