[jboss-user] [JBoss Seam] - well-formed character problem
pete007
do-not-reply at jboss.com
Tue Feb 12 10:38:09 EST 2008
Hi, I am getting the following message in different use-cases:
Error Parsing /router.xhtml: Error Traced[line: 22] The content of elements must consist of well-formed character data or markup.
First one is, when I use german Umlaute like ä.
How do I write this Characters correctly into the xhtml-document?
the other one is maybe a thinking error by myself. I am trying to iterate over a String-Array and to print all elements to screen, in this case in a html-drop-down-select-box.
At first, I had this code, which worked, but it was very slow, because it called router.getEndNodes() for every element.
| <select name="end" rendered="#{router.endNodes!=null}">
| <c:forEach var="w" items="${router.endNodes}">
| <option value="${w}">${w}</option>
| </c:forEach>
| </select>
I changed the getEndNodes-Method to cache the Strings and not load them from the database at every method call.
@Transient public String[] getEndpointNames()
| { if(namearray==null) { namearray = loadEndNodes(); } return namearray; }
| @Transient public String[] loadEndpointNames()
| { ArrayList<String> nl = (ArrayList<String>) entityManager.createQuery("select name from Endpoint order by name").getResultList();
| String[] na = new String[nl.size()]; int counter = 0;
| for(String name: nl) { na[counter++] = name; }
| return na; }
But this is still very slow (about 5 seconds for 200 short string elements).
So I thought about caching the String[] in the html/jsp/xml-page itself by assigning it to a temporary variable:
<% String[] endNodes = ${router.endNodes}; %>
| <select name="end" rendered="#{endNodes!=null}">
| <c:forEach var="w" items="${endNodes}">
| <option value="${w}">${w}</option>
| </c:forEach>
| </select>
And then I get again the above error message from the parser.
Do I have to wrap the statement, some characters, did I type it wrong or is it not possible to do such an assignment at all?
By the way, Is there no predefined tag for select-boxes?
If someone has a better solution for the drop-down-box, please post it. I'm not bound to any datatypes, it's only strings defined in a database.
Thanks in advance, Peter
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128816#4128816
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128816
More information about the jboss-user
mailing list