I am using the following rich:editor control to create a new message. I choose Heading 1 under Format drop down and entered some text and persist the entry. But when I try to edit the message it fails with the following error on load. How should I fix this issue?
An error occurred during conversion seam text to html
<s:decorate template="/layout/edit.xhtml">
<ui:define name="label">Message</ui:define>
<rich:editor required="true" id="messageField" theme="advanced" useSeamText="true" viewMode="visual" autoResize="true" value="#{newsHome.instance.message}">
<f:param name="theme_advanced_buttons1" value="newdocument,separator,cut,copy,paste,separator,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,hr,removeformat,visualaid,separator,sub,sup"/>
<f:param name="theme_advanced_buttons2" value="bullist,numlist,separator,outdent,indent,blockquote,separator,undo,redo,separator,link,unlink,anchor,separator,image,cleanup,help,code,separator,forecolor,backcolor"/>
<f:param name="theme_advanced_buttons3" value="fontselect,fontsizeselect,formatselect,styleselect,separator,charmap"/>
<f:param name="theme_advanced_resizing" value="true"/>
<f:param name="theme_advanced_toolbar_location" value="top" />
<f:param name="theme_advanced_toolbar_align" value="left" />
</rich:editor>
</s:decorate>
That sounds like a problem we had with rich:editor whenever someone entered content with an odd number of underscores. It was caused by a bug in RichFaces, and we fixed it by upgrading RichFaces to 3.3.3.
Related
I just upgraded to JSF 2.3 & Wildfly 14 (from 2.0 and 13) and primefaces 6.2.5.
I noticed a strange behavior when i use a command button. I have 2 forms and when a push the button of the first form, the input of the second form is validated and the error (in this case required errors) are displayed in a p:message :
<h:form id="form1" prependId="false">
<p:commandButton id="save" value="Save" actionListener="#{myBean.save()}" update="#form">
<f:actionListener binding="#{myBean.reloadResults()}" />
</p:commandButton>
<p:messages id="msgs" severity="error,warn" escape="false">
<p:autoUpdate />
</p:messages>
...
</h:form>
<p:dialog >
<h:form id="form2" >
<p:messages severity="error,warn" escape="false">
<p:autoUpdate />
</p:messages>
<div>
<p:calendar id="myDate" value="#{myBean.myDate}" required="true" />
</div>
...
</h:form>
</p:dialog>
I was expecting only the content of the first form to be processed and validated. This was the case with wildfly 13 and jsf 2.0.
Any idea?
You have not specified attribute process in your command button. Default value of this is #all which will validate all Forms.
Please use process="#form" to avoid validation and process of other form.
Updated code is as below:
<p:commandButton id="save" value="Save" actionListener="#{myBean.save()}" update="#form" process="#form">
<f:actionListener binding="#{myBean.reloadResults()}" />
</p:commandButton>
I have to apologize for not posting the entire code but it would have been to big. I found out what the problem was. It's related to this bug:
https://github.com/primefaces/primefaces/issues/4122
I have a panelgrid of 4 columns but with 10 elements in it.
The whole ajax communication was then broken. Fix is coming in PF 6.3
I'm using PF 5.3 on Glassfish 4.1. I need a printer functionality. But I just can not get even this simple example work. Everything else is just working fine. The button and the image from the following example are being rendered, but p:printer is not working. What I'm doing wrong? Could it be a some kind of configuration issue?
<h:body>
<p:graphicImage id="img" value="/resources/img/test/datatable.png" />
<h:form>
<p:commandButton value="Print Image" type="button">
<p:printer target="img" />
</p:commandButton>
</h:form>
</h:body>
You need to have an h:head in your page for javascript resources to be loaded. These are needed for the p:commandButton and p:printer to work.
Sorry JSF is not my main language
I have a JSF Composite Component named validatedInputTextQuestion. It's essentially a bold label, then a textbox on first line.. next line is a note about said inputText, and below that is where my validation message would show.
<cc:implementation>
<b>#{cc.attrs.questionLabel} : </b>
<h:inputText value="#{cc.attrs.bindingValue}" id="checkSpecs" required="#{cc.attrs.required}" size="15" label="#{cc.attrs.errorLabel}">
<f:validateLength minimum="#{cc.attrs.minLength}" maximum="#{cc.attrs.maxLength}" />
</h:inputText>
<br />
<b>#{cc.attrs.notes}</b>
<br />
<h:message for="checkSpecs" style="color:red" />
<br />
</cc:implementation>
not all instances of this template have a note. but when I test out this page there is a extra break above my error message. Which is to be expected as that is what my template does... What i'd like to know is if there is a dynamic way of having this note attribute take up space if there is data.. I know in Silverlight I could use a grid and set a row definition height of Auto... or use a boolean to visibilty converter, but i can't find the equivalent in JSF. Can someone help point me to a solution for this?
Here is my registration.xhtml page I have made using Java Server Faces. What I'm trying to do is reset the panel of entries. To do this, i have simply labelled a button reset and put the page address in the action field so that the page re-loads so that the field is cleared. I was wondering if there was a more correct way of doing this... Thanks. (No insults about my lack of knowledge please, I am a complete novice)
<h:form>
<h:commandButton value="Register" action="someotherpage.xhtml"/>
<h:commandButton value="RESET" action="registration.xhtml"/>
</h:form>
</h:panelGrid>
</h:body>
</html>
In case you don't need to execute any kind of special code in the back, you can clear the form using the following button:
<h:commandButton type="reset" value="RESET" />
I am using a spring bean with flow scope which has a primesfaces's StreamedContent field and the image does not show up. Any ideas on how to make this work with flow scope? It works fine when it is a managed bean with request scope and also when it is a spring bean with session/prototype/singleton scope.
Below is some sample code:
flow:
<input name="springBean" required="false"/>
<view-state id="testFlow">
<transition on="post" to="testFlow" />
</view-state>
xhtml file:
<ui:define name="body">
<h:form>
<p:graphicImage value="#{springBean.barcode}" cache="false"/>
<br />
<h:outputText value="This is a test flow" />
<br />
Message From Spring = #{springBean.text}<br />
<h:inputText value="#{springBean.text}" style="width:200px" />
<h:commandButton action="post" value="Update" />
</h:form>
</ui:define>
application context:
<import resource="flowConfig.xml" />
<bean name="springBean" class="swfproject.MessageHolder" scope="flow">
<property name="text" value="This was defined in Spring" />
</bean>
The only way I have found so far is to extend GraphicImage component and make it store binary content in the Session. See How to make Primefaces graphicImage work with Spring Web Flow