richfaces

checks for constraint violation before persisting an entity

耗尽温柔 提交于 2019-11-30 11:28:07
What is the best mechanism for preventing constraint violation checks before creation | modification of an entity? Suppose if the 'User' entity has 'loginid' as the unique constraint, would it be wise to check if there is an user entry already with this loginid name before creation or modification. OR Would you let the database throw an ConstraintViolationException and handle this message appropriately in the UI layer. Where should such checks be enforced in the jboss seam framework. Note: Currently no such checks are enforced on the seam-gen code. We currently use Seam 2.2, Richfaces with

Sending OutputStream to browser and let browser save it [duplicate]

冷暖自知 提交于 2019-11-30 10:37:40
This question already has an answer here: How to provide a file download from a JSF backing bean? 4 answers I want to export Data from a Rich Faces Data Table I have created outputStream from the data in the Data Table. Now want to send this OutputStream to browser and let it save. How can I do this? FileOutputStream stream = new FileOutputStream(new File(PATH)); OutputStream out = myMthodToCreateOutPutStream(); Now how to save this out to browser . It's not clear where you are reading your data from. You need to create an InputStream to read the data. Then, you first need to set the response

How do I stop richfaces adding borders to panels and calendars?

血红的双手。 提交于 2019-11-30 09:06:10
I'm hoping to use a custom richfaces skin to handle the bulk of my presentation work. Unfortunately richfaces renders borders around every cell in a calendar component and around each panel. I would like to turn them off so that day numbers site in an open grid with no borders. There is no obvious way to do that using skins or attributes of the calendar control. I could use custom CSS but I'd prefer to work with the framework to completely remove the border related properties from the stylesheets created by richfaces rather than work against the framework and override everything using ugly CSS

Is there a way to create dynamically <rich:tab> elements?

纵饮孤独 提交于 2019-11-30 09:02:41
问题 Let say that I want to create a variable set of <rich:tab> elements within a <rich:tabPanel> component. So I tried to do that way: <rich:tabPanel switchType="client" ...> <ui:repeat value="#{myBean.myTabs}" var="tab"> <rich:tab name="#{tab.name}" label="#{tab.label}"/> </ui:repeat> </rich:tabPanel> But it didn't work, as no tab is rendered. I also got the following message in the logs: j_id174: tab panel has no enabled or rendered tabs! This problem seems to be encountered by others people,

How to collect values of an UIInput component inside an UIData component in bean's action method?

不羁的心 提交于 2019-11-30 06:04:13
问题 I'm trying to collect values of an UIInput component inside an UIData component during bean's action method in order to validate duplicate values. I tried to bind the UIInput component to a bean property and getting its value, but it prints null . If I place it outside the datatable, then it prints the expected value. Is there something wrong with the datatable? <rich:dataTable binding="#{bean.table}" value="#{bean.data}" var="item"> <h:column> <f:facet name="header"> <h:outputText value=

How to add a message to a specific component from JSF backing bean

*爱你&永不变心* 提交于 2019-11-30 04:52:41
I have an h:inputText and an h:message connected to it: <h:inputText id="myText" value="#{myController.myText}" /> <a4j:outputPanel> <h:message for="myText" .../> </a4j:outputPanel> I want to send a message to it from java, in a manner like: FacesContext.getCurrentInstance().addMessage(arg0, arg1); which is sent to h:messages, but to a specific id in a specific form. How can I do this? (Without implementing validation bean or validation method - meaning without throwing validation exception). Arjan Tijms You need to provide the so called client id , which you'll find on UIComponent . The

JSF, RichFaces, pagination

心不动则不痛 提交于 2019-11-30 03:26:18
问题 I know there are quite a number of posts regarding JSF paginatin here, but none of them satisfed me. To split pretty big data into pages I was going to use RichFaces Data scroller component. It appeared to be suitable for that, but it looks like it does "artificial" pagination. What i don't like here is that it loads all data and then merely displays part of it. At least it appears to do so. Correct me if i'm wrong. Rich faces have nice demos, but by some reason they skip bean definitions-

HTTP response header content disposition for attachments

眉间皱痕 提交于 2019-11-30 01:03:33
Background Write an XML document to a browser's response stream and cause the browser to display a "Save As" dialog. Problem Consider the following download() method: HttpServletResponse response = getResponse(); BufferedWriter bw = new BufferedWriter( new OutputStreamWriter( response.getOutputStream() ) ); String filename = "domain.xml"; String mimeType = new MimetypesFileTypeMap().getContentType( filename ); // Prints "application/octet-stream" System.out.println( "mimeType: " + mimeType ); // response.setContentType( "text/xml;charset=UTF-8" ); response.setContentType( mimeType ); response

Localization with bean validation in JSF

空扰寡人 提交于 2019-11-30 00:45:30
I made a MVC based website using JSF 2.0 and RichFaces 4. Every input text validation is been done using bean validation annotations. I am using Hibernate Validator as bean validation implementation. How can I display a localized message? If I use @NotNull(message="<h:outputText value=\"#{msg['Mymessage']}\" />") then it literally displays <h:outputText value="#{msg['Mymessage']}" /> as message. How is this caused and how can I solve it? You should and can not put JSF tags in the message. Also, JSF's own resource bundle won't be used to resolve localized validation messages. JSR303 bean

Can Jetty be used as a Java EE lightweight application server?

穿精又带淫゛_ 提交于 2019-11-29 21:06:48
问题 In the scope of deploying small Java EE web applications at various client sites, I am searching for an easy application server solution. I think I remember hearing that it was possible to use Jetty as a JavaEE 6 lightweight application server but I can't seem to find more evidence on this right now on the web. Knowing that my development environment is JSF2 + RichFaces, CDI (Weld) and JPA 2 => NO EJBs at this point), is Jetty a possible solution for me? If yes, could you point me to some