jsf-2

JSF / Java Design Question

烈酒焚心 提交于 2019-12-23 04:40:37
问题 I am running JSF 2.0 I currently have one java controller that is called Contacts.java. Inside there I have a list of addresses stored as a member variable List<Addresses> addresses; When my application loads it displays a bunch of contacts and you are able to click on a contact to "open it" to view its data. When you click on the contact the contactId is passed to a method that populates the List based on the contactId. It in turn then displays the data. I also have a bunch of functionality

primefaces - editable dynamic table

牧云@^-^@ 提交于 2019-12-23 04:39:08
问题 DISCLAIMER - THIS IS NOT DUP OF Is it possible to use p:cellEditor inside a p:columns tag? (read both first) I am trying to adapt this solution to my context - http://forum.primefaces.org/viewtopic.php?f=3&t=13275 I have a dynamic table like this Managed Bean @ManagedBean @ViewScoped public class MyMB implements Serializable { private List<String> columns = new ArrayList<String>(); private List<Map<String,String>> data; private List<Map<String,String>> filteredData; private String

Primefaces: commandButton in confirmDialog cannot update datatable in the same form

烈酒焚心 提交于 2019-12-23 04:27:38
问题 I have 1 datatable which includes Edit and Delete command buttons in each row. Delete button shows a confirm dialog onclick, and by actionListener, sets the currentObject variable to the object that it belongs to in the same row. In the confirm dialog, Yes is also a command button, and it calls delete(object) method of the bean. Everything works fine. Delete function is below: public void delete(ActionEvent actionEvent) { categoryRepository.delete(currentCategory); currentCategory = new

JSF -Set global font type for the excel sheet in JSF using HSSFFont in Apache POI

孤者浪人 提交于 2019-12-23 04:22:28
问题 I have an option to export the datatable to an excel sheet. I am tryin to set the font type as "Calibri" for all the cell in the sheet. But the below code is assigning only the font type for the header not for the rest of the cells How can I able to set the font type globally for all the cell in the sheet ? public void exportToXLS(Object document) { HSSFWorkbook wb = (HSSFWorkbook) document; HSSFSheet sheet = wb.getSheetAt(0); wb.setSheetName(0, "report_lists"); // set sheet name sheet

Perform validation on domain model

大兔子大兔子 提交于 2019-12-23 04:14:20
问题 Our business domain model has complex validation rules, which can only be executed when the model has been updated. Something like this: public classs MyDomainModel { public DomainValidationContext getValidationContext() { ... } } We don't want to extract these, since: it would mean duplication of the validation rules. List item some rules are only "soft-rules" which should result in warning messages without stopping further processing. We considered duplicating the DomainModel in the

jsf 2 method parameters action listener

白昼怎懂夜的黑 提交于 2019-12-23 04:13:20
问题 Is there a way to pass a variable into a method param: <h:commandButton value="Add to Order" actionListener="#{orderBasket.addItems(currentItem.id)}"/> This always seems to pass 0 into the method for some reason. 回答1: That's only possible when you use action instead of actionListener <h:commandButton value="Add to Order" action="#{orderBasket.addItems(currentItem.id)}"/> and you're running a Servlet 3.0 / EL 2.2 capable container (Tomcat 7, Glassfish 3, JBoss 6, etc) and your web.xml is

Execute Javascript *after* ajax update

余生长醉 提交于 2019-12-23 04:11:40
问题 I need to execute a certain javascript function after the ajax update has been applied. I tried jsf.ajax.addOnEvent(ch.ergon.newom.ajaxUpdate) to get informed about the request, but that seems to be execute after the ajax response arrived, but before it got applied (that is: the content got updated). How can I execute a JavaScript function after the content got updated by JSF-ajax? 回答1: Actually, this will be called three times. One before the ajax request is sent, one after the ajax response

Can I use hibernate entity annotations with bean validation

痴心易碎 提交于 2019-12-23 04:11:32
问题 To use bean validation for form fields in JSF 2, you can use annotations in the bean like @Length(max=5) . However, since these constraints are already defined in my Hibernate entity object, for example: @Column(name = "FIELDX", length = 5) , I was wondering if there's a way to use them for the validation? 回答1: No, you can't. And you shouldn't, because: validation logic might change while field definition is retained only a few of the constraints can be mapped to column definitions 来源: https:

Is there a way to get JSF to work with Generic setters and getters

徘徊边缘 提交于 2019-12-23 03:56:04
问题 Is there a way to get JSF to work with generic entities as described below: Property.java public interface MyProperty<T> { void setMyValue(T value); T getMyValue(T value); } In my application T could Date , String , Integer or Long only MyObject.java public class MyObject { List<MyProperty<?>> properties; public List<MyProperty<?>> getProperties() { return properties; } } MyController.java @Named("controller") @RequestScoped public class MyController { MyObject myObject; public void

Target Unreachable, 'null' returned null in JSF form [duplicate]

删除回忆录丶 提交于 2019-12-23 03:48:13
问题 This question already has answers here : Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable (14 answers) Closed 4 years ago . I tested this source code: Bean: private NewAccountObj na; public class NewAccountObj { private int userid; ............ public NewAccountObj(int userid.............) { this.userid = userid; ............ } public int getUserid() { return userid; } ............... } // Getters public NewAccountObj getDataList() { return na; } JSF Page: <h