jsf-2

Why is JSF considered MVP but not MVVM framework

大憨熊 提交于 2019-12-13 19:10:14
问题 From the wiki page about JSF I've learnt that it's considered as an MVP framework. But I cannot realy understand why. Actully, beans do not contain a reference to View in themselves. There's also a data bidinig mechanism between Facelets and Managed beans. So I would say that Managed Beans are more ViewModel than Presenter , as that Presenter usually contain a View interface in itself like in that example. QUESTION : Why is JSF considered MVP but not MVVM framework? 回答1: MVVM is mainly a

jsf 2 best one managed bean multiple views

喜夏-厌秋 提交于 2019-12-13 19:09:34
问题 I`m kind of noob to JSF and I'm trying to figure out which would be the most elegant solution for the following scenario: Let's say that I have a user managed bean called UserMB: @ManagedBean public class UserMB { private User user; private List<User> users; // getters and setters here public void addUser(User user){ // do add user logic here } public List<User> listAllUsers(){ // do list All users logic here } @PostConstruct private void init(){ // populate List<user> users - for the

submit not working inside <ui:repeat>

旧街凉风 提交于 2019-12-13 18:41:26
问题 I am trying to comment on status that is retrieved from the database. Whenever I am submitting the comment for specific status I am getting the exception.I have used <ui:repeat> to repeat the commandButtons. I don't know if the commandButton can be put inside <ui:repeat> or not. It would be really helpful if somebody could point out my mistake. I am having the exact same problem when I am using dataTable instead of ui:repeat. The problem is that multiple commandButton are possibly getting

ui:repeat in o:tree not working as expected

拈花ヽ惹草 提交于 2019-12-13 18:28:43
问题 I'm using a omnifaces o:tree of "branches" where each branch has a "list of leafs" with the attribute "color" which should be editable in the tree. - branch 0 - leaf 0 (color = "green") - leaf 1 (color = "yellow") - branch 1 - leaf 0 (color = "purple") - branch 1_0 - leaf 1 (color = "red") - leaf 2 (color = "orange") - leaf 3 (color = "brown") Adding/removing branches and adding leafs to any branch works fine and as expected. Also the rendering of any complex tree including all the list of

How to use multipart/form-data encoding in application running on GlassFish 3.1.1

余生颓废 提交于 2019-12-13 18:16:16
问题 I have a JSF 2.0 application running under GlassFish 3.1.1, and I wish to use the new FileUpload component in PrimeFaces 3.0.1, which requires that form data be encoded as multipart/form-data , as in: <h:form id="quoteform" enctype="multipart/form-data"> However, as soon as I add the above enctype attribute to my form, it no longer works - the bean methods tied to my submit and cancel buttons are never invoked. I did find a reference to an issue with Mojarra (part of GlassFish I believe) and

Change URL on ajax navigation

扶醉桌前 提交于 2019-12-13 18:16:14
问题 I have a JSF application and I want the URL in browser address bar be changed on navigation. When I'm on Home.xhtml and I submit a form, it shows the next page AppHome.xhtml , but the URL in browser address bar is not changed. Here's the submit button: <p:commandButton value="Connect" update="panel" id="ajax" action="#{user.check}" styleClass="ui-priority-primary"/> Here is the navigation rule: <navigation-rule> <from-view-id>/Home.xhtml</from-view-id> <navigation-case> <from-outcome>Success<

WEB.XML error-page in JSF 2.0

[亡魂溺海] 提交于 2019-12-13 17:59:26
问题 I'm using JSF2 and Glassfish 3.0. I have a very simple application and I'm trying to set up some default error pages for 404 and 500 error. This is the WEB.XML section: <error-page> <exception-type>404</exception-type> <location>/error.xhtml</location> </error-page> <error-page> <exception-type>500</exception-type> <location>/error.xhtml</location> </error-page> Even though error.xhtml exists, In the browser I still get the standard HTTP Status 404 - warning. 回答1: The <exception-type> should

JSF HtmlCommandButton programmatically - Bean method not called if ajax turned off

流过昼夜 提交于 2019-12-13 17:42:56
问题 I'm trying to create an HtmlCommandButton programmatically, following the example here http://javaevangelist.blogspot.ch/2013/01/jsf-21-tip-of-day-programmatically.html Everything works fine (i.e., the actionListener is called) if I add the ajax behavior, it doesn't work if ajax is turned off. Backing bean: @Named @RequestScoped public class CommandBean implements Serializable { public String generateUUID() { return java.util.UUID.randomUUID().toString(); } } Solution 1 (with ajax) private

Can I make JSF2 skip rendering my custom tag without modifying the tag itself?

一笑奈何 提交于 2019-12-13 17:07:31
问题 I've started my own custom taghandler (pure XHTML, no Renderer) using BalusC's template, let's call it bean:input - the typical label, input, message trio. It's used like this: <h:panelGrid columns="3"> <bean:input label="input1:" bean="#{bean1}" property="name" /> <bean:input label="input2:" bean="#{bean2}" property="name" /> <bean:input label="input3:" bean="#{bean3}" property="name" /> </h:panelGrid> Trouble is, the inputs are mutually exclusive (ie, only one of them should appear). Which

Primefaces ManyCheckbox inside ui:repeat calls setter method only for last loop

删除回忆录丶 提交于 2019-12-13 16:45:24
问题 I have a <p:selectManyCheckbox> inside <ui:repeat> , getting it's items from a List of a certain Object Class (provided by <ui:repeat> -variable) and is supposed to save the chosen items into another List of the same Object Class. But it calls the setter method #{cartBean.setSelectedExtras} only for the last entry (last iteration of <ui:repeat> ). <ui:repeat var="item" value="#{category.items}"> <p:selectManyCheckbox id="extraCheckbox" value="#{cartBean.selectedExtras}" layout="pageDirection"