Search Results

Search found 1116 results on 45 pages for 'jsf'.

Page 1/45 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Session Report: What’s New in JSF: A Complete Tour of JSF 2.2

    - by Janice J. Heiss
    On Wednesday, Ed Burns, Consulting Staff Member at Oracle, presented a session, CON3870 -- “What’s New in JSF: A Complete Tour of JSF 2.2,” in which he provided an update on recent developments in JavaServer Faces 2.2. He began by emphasizing that, “JavaServer Faces 2.2 continues the evolution of the Java EE standard user interface technology. Like previous releases, this iteration is very community-driven and transparent.” He pointed out that since JSF was introduced at the 2001 JavaOne Keynote, it has had a long and successful run and has found a home in applications where the UI logic resides entirely on the server where the model and UI logic is. In such cases, the browser performs fairly simple functions. However, developers can take advantage of the power of browsers, something that Project Avatar is focused on by letting developers author their applications so the UI logic is running on the client and communicating to the back end via RESTful web services. “Most importantly,” remarked Burns, “JSF 2.2 offers a really good migration path because even in the scope of one application you could have an app written with JSF that has its UI logic on the server and, on a gradual basis, you could migrate parts of the app over to use client-side technologies. This can be done at any level of granularity – per page or per collection of pages. It all depends on what you want to do.” His presentation, which focused on the basic new features of JSF 2.2, began by restating the scope of JSF and encouraged attendees to check out Roger Kitain’s session: CON5133 “Techniques for Responsive Real-Time Web UIs.” Burns explained that JSF has endured because, “We still need web apps that are maintainable, localizable, quick to build, accessible, secure, look great and are fun to use.” It is used on every continent – the curious can go here to check out where its unofficial usage is tracked. He emphasized the significance of the UI logic being substantially on the server. This: Separates Component Semantics from Rendering, Allows components to “own” their little patch of the UI -- encode/decode, And offers a well-defined lifecycle: Inversion of Control. Burns reminded attendees that JSR-344, the spec for JSF 2.2, is now on Java Community Process 2.8, a revised version of the JCP that allows for more openness and transparency. He then offered some tools for community access to JSF 2.2:    * Public java.net projects spec http://jsf-spec.java.net/ impl http://jsf.java.net/ Open Source: GPL+Classpath Exception    * Mailing Lists [email protected]                                Public readable archive, JSPA signed member read/write [email protected]                                     Public readable archive, any java.net member read/write                         All mail sent to jsr344-experts is sent to users. * Issue Tracker spec http://jsf-spec.java.net/issues/ impl http://jsf.java.net/issues/ JSF 2.2, which is JSR 344, has a Public Review Draft planned by December 2012 with no need for a Renewal Ballot. The Early Draft Review of JSR 344 was published on December 8, 2011. Interested developers are encouraged to offer their input. Six Big Ticket Features of JSF 2.2 Burns summarized the six big ticket features of JSF 2.2:* HTML5 Friendly Markup Support Pass through attributes and elements * Faces Flows* Cross Site Request Forgery Protection* Loading Facelets via ResourceHandler* File Upload Component* Multi-Templating He explained that he called it “HTML 5 friendly” because there is really nothing HTML 5 specific about it -- it could be 4. But it enables developers to use new elements that are present in HTML5 without having a JSF component library that is written to take advantage of those specifically. It gives the page author the ability to use plain HTML5 to write their page, but to still take advantage of the server-side available in JSF. He presented a demo showing JSF 2.2’s ability to leverage the expressiveness of HTML5. Burns then explained the significance of face flows, which offer function points and quantify how much work has taken place, something of great value to JSF users. He went on to talk about JSF 2.2.’s cross-site request forgery protection (CSRF) and offered details about how it protects applications against attack. Then he talked about JSF 2.2’s File Upload Component and explained that the final specification will have Ajax and non-Ajax support. The current milestone has non-Ajax support implemented. He then went on to explain its capacity to add facelets through ResourceHandler. Previously, JSF 2.0 added Facelets and ResourceHandler as disparate units; now in JSF 2.2 the two concepts are unified. Finally, he explained the concept of multi-templating in JSF 2.2 and went on to discuss more medium-level features of the release. For an easy, low maintenance way of staying in touch with JSF developments go to JSF’s Twitter page where every month or so, important updates are offered.

    Read the article

  • error with redirect using listener JSF 2.0

    - by Ray
    I have a index.xhtml page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <f:view> <ui:insert name="metadata" /> <f:event type="preRenderView" listener="#{item.show}" /> <h:body></h:body> </f:view> </html> And in bean class with scope session this method public void show() throws IOException, DAOException { ExternalContext externalContext = FacesContext.getCurrentInstance() .getExternalContext(); //smth String rootPath = externalContext.getRealPath("/"); String realPath = rootPath + "pages\\template\\body\\list.xhtml"; externalContext.redirect(realPath); } i think that I should redirect to next page but I have "browser can't show page" and list.xhtml (if I do this page as welcome-page I haven't error, it means that error connected with redirect) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <h:body> <ui:composition template="/pages/layouts/mainLayout.xhtml"> <ui:define name="content"> <h:form></h:form></ui:define></ui:composition> </h:body> </html> in consol i didn't have any error. in web.xml <welcome-file-list> <welcome-file>index.xhtml</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern> </servlet-mapping> What can be the reason this problem?

    Read the article

  • Difference between $ and # in ADF/JSF/JSP

    - by pavan.pvj
    Found this one interesting. So, picked it from one of the books and posting here.JSP 2.1 and JSF 1.2 - both of them use a unified Expression language. One major and the most obvious difference is between $ and #. JSP 2.1 uses $ and JSF 1.2 uses # in an EL. $ - immediate evaluation# - deferred evaluation$ - $ syntax executes expressions eagerly/immediately, which means that the result is returned immediately when the page renders.# - # syntax defers the expression evaluation to a point defined by the implementing technology. In general, JSF uses deferred EL evaluation because of its multiple lifecycle phases in which events are handled. To ensure the model is prepared before the values are accessed by EL, it must defer EL evaluation until the appropriate point in the life cycle.Note: This is picked up from Oracle Fusion Developer Guide (ISBN: 9780071622547). There is also a very good article here:http://java.sun.com/products/jsp/reference/techart/unifiedEL.html

    Read the article

  • JSF 2 -- Composite component with optional listener attribute on f:ajax

    - by Dave Maple
    I have a composite component that looks something like this: <!DOCTYPE html> <html xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:dm="http://davemaple.com/dm-taglib" xmlns:rich="http://richfaces.org/rich" xmlns:cc="http://java.sun.com/jsf/composite" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"> <cc:interface> <cc:attribute name="styleClass" /> <cc:attribute name="textBoxStyleClass" /> <cc:attribute name="inputTextId" /> <cc:attribute name="labelText" /> <cc:attribute name="tabindex" /> <cc:attribute name="required" default="false" /> <cc:attribute name="requiredMessage" /> <cc:attribute name="validatorId" /> <cc:attribute name="converterId" /> <cc:attribute name="title"/> <cc:attribute name="style"/> <cc:attribute name="unicodeSupport" default="false"/> <cc:attribute name="tooltip" default="false"/> <cc:attribute name="tooltipText" default=""/> <cc:attribute name="tooltipText" default=""/> <cc:attribute name="onfail" default=""/> <cc:attribute name="onpass" default=""/> </cc:interface> <cc:implementation> <ui:param name="converterId" value="#{! empty cc.attrs.converterId ? cc.attrs.converterId : 'universalConverter'}" /> <ui:param name="validatorId" value="#{! empty cc.attrs.validatorId ? cc.attrs.validatorId : 'universalValidator'}" /> <ui:param name="component" value="#{formFieldBean.getComponent(cc.attrs.inputTextId)}" /> <ui:param name="componentValid" value="#{((facesContext.maximumSeverity == null and empty component.valid) or component.valid) ? true : false}" /> <ui:param name="requiredMessage" value="#{! empty cc.attrs.requiredMessage ? cc.attrs.requiredMessage : msg['validation.generic.requiredMessage']}" /> <ui:param name="clientIdEscaped" value="#{fn:replace(cc.clientId, ':', '\\\\\\\\:')}" /> <h:panelGroup layout="block" id="#{cc.attrs.inputTextId}ValidPanel" style="display:none;"> <input type="hidden" id="#{cc.attrs.inputTextId}Valid" value="#{componentValid}" /> </h:panelGroup> <dm:outputLabel for="#{cc.clientId}:#{cc.attrs.inputTextId}" id="#{cc.attrs.inputTextId}Label">#{cc.attrs.labelText}</dm:outputLabel> <dm:inputText styleClass="#{cc.attrs.textBoxStyleClass}" tabindex="#{cc.attrs.tabindex}" id="#{cc.attrs.inputTextId}" required="#{cc.attrs.required}" requiredMessage="#{requiredMessage}" title="#{cc.attrs.title}" unicodeSupport="#{cc.attrs.unicodeSupport}"> <f:validator validatorId="#{validatorId}" /> <f:converter converterId="#{converterId}" /> <cc:insertChildren /> <f:ajax event="blur" execute="@this" render="#{cc.attrs.inputTextId}ValidPanel #{cc.attrs.inputTextId}Msg" onevent="on#{cc.attrs.inputTextId}Event" /> </dm:inputText> <rich:message for="#{cc.clientId}:#{cc.attrs.inputTextId}" id="#{cc.attrs.inputTextId}Msg" style="display: none;" /> <script> function on#{cc.attrs.inputTextId}Event(e) { if(e.status == 'success') { $('##{clientIdEscaped}\\:#{cc.attrs.inputTextId}').trigger($('##{cc.attrs.inputTextId}Valid').val()=='true'?'pass':'fail'); } } $('##{clientIdEscaped}\\:#{cc.attrs.inputTextId}').bind('fail', function() { $('##{clientIdEscaped}\\:#{cc.attrs.inputTextId}, ##{clientIdEscaped}\\:#{cc.attrs.inputTextId}Label, ##{cc.attrs.inputTextId}Msg, ##{cc.id}Msg').addClass('error'); $('##{cc.id}Msg').html($('##{clientIdEscaped}\\:#{cc.attrs.inputTextId}Msg').html()); #{cc.attrs.onfail} }).bind('pass', function() { $('##{clientIdEscaped}\\:#{cc.attrs.inputTextId}, ##{clientIdEscaped}\\:#{cc.attrs.inputTextId}Label, ##{cc.attrs.inputTextId}Msg, ##{cc.id}Msg').removeClass('error'); $('##{cc.id}Msg').html($('##{clientIdEscaped}\\:#{cc.attrs.inputTextId}Msg').html()); #{cc.attrs.onpass} }); </script> <a4j:region rendered="#{facesContext.maximumSeverity != null and !componentValid}"> <script> $(document).ready(function() { $('##{clientIdEscaped}\\:#{cc.attrs.inputTextId}').trigger('fail'); }); </script> </a4j:region> </cc:implementation> </html> I'd like to be able to add an optional "listener" attribute which if defined would add an event listener to my f:ajax but I'm having trouble figuring out how to accomplish this. Any help would be appreciated.

    Read the article

  • JSF 2.0 Dynamic Views

    - by Robe Eleckers
    Hello, I'm working on a web project which uses JSF 2.0, PrimeFaces and PrettyFaces as main frameworks / libraries. The pages have the following (common) structure: Header, Content, Footer. Header: The Header always contains the same menu. This menu is a custom component, which generates a recursive html <ul><li> list containing <a href="url"> html links, this is all rendered with a custom renderer. The link looks like 'domain.com/website/datatable.xhtml?ref=2'. Where the ref=2 used to load the correct content from the database. I use prettyfaces to store this request value in a backingbean. Question 1: Is it ok to render the <a href> links myself, or should I better add an HTMLCommandLink from my UIComponent and render that in the encodeBegin/End? Question 2: I think passing variables like this is not really the JSF 2.0 style, how to do this in a better way? Content: The content contains dynamic data. It can be a (primefaces) datatable, build with dynamic data from the database. It can also be a text page, also loaded from the database. Or a series of graphs. You got the point, it's dynamic. The content is based on the link pressed in the header menu. If the content is of type datatable, then I put the ref=2 variable to a DataTableBean (via prettyfaces), which then loads the correct datatable from the database. If the content is of type chart, I'll put it on the ChartBean. Question 3: Is this a normal setup? Ideally I would like to update my content via Ajax. I hope it's clear :)

    Read the article

  • JSF 2.0: Preserving component state across multiple views

    - by tlind
    The web application I am developing using MyFaces 2.0.3 / PrimeFaces 2.2RC2 is divided into a content and a navigation area. In the navigation area, which is included into multiple pages using templating (i.e. <ui:define>), there are some widgets (e.g. a navigation tree, collapsible panels etc.) of which I want to preserve the component state across views. For example, let's say I am on the home page. When I navigate to a product details page by clicking on a product in the navigation tree, my Java code triggers a redirect using navigationHandler.handleNavigation(context, null, "/detailspage.jsf?faces-redirect=true") Another way of getting to that details page would be by directly clicking on a product teaser that is shown on the home page. The corresponding <h:link> would lead us to the details page. In both cases, the expansion state of my navigation tree (a PrimeFaces tree component) and my collapsible panels is lost. I understand this is because the redirect / h:link results in the creation of a new view. What is the best way of dealing with this? I am already using MyFaces Orchestra in my project along with its conversation scope, but I am not sure if this is of any help here (since I'd have to bind the expansion/collapsed state of the widgets to a backing bean... but as far as I know, this is not possible). Is there a way of telling JSF which component states to propagate to the next view, assuming that the same component exists in that view? I guess I could need a pointer into the right direction here. Thanks! Update 1: I just tried binding the panels and the tree to a session-scoped bean, but this seems to have no effect. Also, I guess I would have to bind all child components (if any) manually, so this doesn't seem like the way to go. Update 2: Binding UI components to non-request scoped beans is not a good idea (see link I posted in a comment below). If there is no easier approach, I might have to proceed as follows: When a panel is collapsed or the tree is expanded, save the current state in a session-scoped backing bean (!= the UI component itself) The components' states are stored in a map. The map key is the component's (hopefully) unique, relative ID. I cannot use the whole absolute component path here, since the IDs of the parent naming containers might change if the view changes, assuming these IDs are generated programmatically. As soon as a new view gets constructed, retrieve the components' states from the map and apply them to the components. For example, in case of the panels, I can set the collapsed attribute to a value retrieved from my session-scoped backing bean.

    Read the article

  • JSF SelectOneMenuItem onselect attribute

    - by William
    I have created selectOneMenuItem(JSF).I placed my events on valueChangeListener / onchange like that <h:selectOneMenu id="ddl" value="#{Foo.attr}" onchange="submit()" valueChangeListener="#{Foo.renderFoo}"> When I select one vlaue from selectOneMenuItem then event fires.Now when I reselect that value ,then event doesn't fire (because this is the valueChangeListener event) so it doesn't fire.I want that event should fire on every selection even on again the same selection.I found onselect but unable to find that is it right and how can i use this onselect.Anyu help would be greatly appreciable

    Read the article

  • Why JSF Matters (to You)

    - by reza_rahman
          "Those who have knowledge, don’t predict. Those who predict, don’t have knowledge."                                                                                                    – Lao Tzu You may have noticed Thoughtworks recently crowned the likes AngularJS, etc imminent successors to server-side web frameworks. They apparently also deemed it necessary to single out JSF for righteous scorn. I have to say as I was reading the analysis I couldn't help but remember they also promptly jumped on the Ruby, Rails, Clojure, etc bandwagon a good few years ago seemingly similarly crowing these dynamic languages imminent successors to Java. I remember thinking then as I do now whether the folks at Thoughtworks are really that much smarter than me or if they are simply more prone to the Hipster buzz of the day. I'll let you make the final call on that one. I also noticed mention of "J2EE" in the context of JSF and had to wonder how up-to-date or knowledgeable the person writing the analysis actually was given that the term was basically retired almost a decade ago. There's one thing that I am absolutely sure about though - as a long time pretty happy user of JSF, I had no choice but to speak up on what I believe JSF offers. If you feel the same way, I would encourage you to support the team behind JSF whose hard work you may have benefited from over the years. True to his outspoken character PrimeFaces lead Cagatay Civici certainly did not mince words making the case for the JSF ecosystem - his excellent write-up is well worth a read. He specifically pointed out the practical problems in going whole hog with bare metal JavaScript, CSS, HTML for many development teams. I'll admit I had to smile when I read his closing sentence as well as the rather cheerful comments to the post from actual current JSF/PrimeFaces users that are apparently supposed to be on a gloomy death march. In a similar vein, OmniFaces developer Arjan Tijms did a great job pointing out the fact that despite the extremely competitive server-side Java Web UI space, JSF seems to manage to always consistently come out in either the number one or number two spot over many years and many data sources - do give his well-written message in the JAX-RS user forum a careful read. I don't think it's really reasonable to expect this to be the case for so many years if JSF was not at least a capable if not outstanding technology. If fact if you've ever wondered, Oracle itself is one of the largest JSF users on the planet. As Oracle's Shay Shmeltzer explains in a recent JSF Central interview, many of Oracle's strategic products such as ADF, ADF Mobile and Fusion Applications itself is built on JSF. There are well over 3,000 active developers working on these codebases. I don't think anyone can think of a more compelling reason to make sure that a technology is as effective as possible for practical development under real world conditions. Standing on the shoulders of the above giants, I feel like I can be pretty brief in making my own case for JSF: JSF is a powerful abstraction that brings the original Smalltalk MVC pattern to web development. This means cutting down boilerplate code to the bare minimum such that you really can think of just writing your view markup and then simply wire up some properties and event handlers on a POJO. The best way to see what this really means is to compare JSF code for a pretty small case to other approaches. You should then multiply the additional work for the typical enterprise project to try to understand what the productivity trade-offs are. This is reason alone for me to personally never take any other approach seriously as my primary web UI solution unless it can match the sheer productivity of JSF. Thanks to JSF's focus on components from the ground-up JSF has an extremely strong ecosystem that includes projects like PrimeFaces, RichFaces, OmniFaces, ICEFaces and of course ADF Faces/Mobile. These component libraries taken together constitute perhaps the largest widget set ever developed and optimized for a single web UI technology. To begin to grasp what this really means, just briefly browse the excellent PrimeFaces showcase and think about the fact that you can readily use the widgets on that showcase by just using some simple markup and knowing near to nothing about AJAX, JavaScript or CSS. JSF has the fair and legitimate advantage of being an open vendor neutral standard. This means that no single company, individual or insular clique controls JSF - openness, transparency, accountability, plurality, collaboration and inclusiveness is virtually guaranteed by the standards process itself. You have the option to choose between compatible implementations, escape any form of lock-in or even create your own compatible implementation! As you might gather from the quote at the top of the post, I am not a fan of crystal ball gazing and certainly don't want to engage in it myself. Who knows? However far-fetched it may seem maybe AngularJS is the only future we all have after all. If that is the case, so be it. Unlike what you might have been told, Java EE is about choice at heart and it can certainly work extremely well as a back-end for AngularJS. Likewise, you are also most certainly not limited to just JSF for working with Java EE - you have a rich set of choices like Struts 2, Vaadin, Errai, VRaptor 4, Wicket or perhaps even the new action-oriented web framework being considered for Java EE 8 based on the work in Jersey MVC... Please note that any views expressed here are my own only and certainly does not reflect the position of Oracle as a company.

    Read the article

  • JSF Open new window and display bean data

    - by JSFPRINTER
    I am running JSF 2.0 and the latest version of Primefaces 2.2RC1 I believe. I am trying to create a printer friendly window. When the user clicks on a p:commandLink I want a new window to open and display a xhtml file I have named printView.xhtml. Now I can get the window working fine using JavaScript window.open but when I open the new window it will not render any values it just displays everything as #{myBean.value}. Does anyone know how to properly open a window and extend the current scope of the application into that window so I can call all of my managed beans properly and display the values etc. etc.

    Read the article

  • JSF: Avoid nested update calls

    - by dhroove
    I don't know if I am on right track or not still asking this question. I my JSF project I have this tree structure: <p:tree id="resourcesTree" value="#{someBean.root}" var="node" selectionMode="single" styleClass="no-border" selection="#{someBean.selectedNode}" dynamic="true"> <p:ajax listener="#{someBean.onNodeSelect}" update=":centerPanel :tableForm :tabForm" event="select" onstart="statusDialog.show();" oncomplete="statusDialog.hide();" /> <p:treeNode id="resourcesTreeNode" > <h:outputText value="#{node}" id="lblNode" /> </p:treeNode> </p:tree> I have to update this tree after I added something or delete something.. But whenever I update this still its nested update also call I mean to say it also call to update these components ":centerPanel :tableForm :tabForm"... This give me error that :tableForm not found in view because this forms load in my central panel and this tree is in my right panel.. So when I am doing some operation on tree is it not always that :tableForm is in my central panel.. (I mean design is something like this only) So now my question is that can I put some condition or there is any way so that I can specify when to update nested components also and when not.... In nut shell is there any way to update only :resoucesTree is such a way that nested updates are not called so that I can avoid error... Thanks in advance.

    Read the article

  • Cross field validation in jsf h:datatable using p:calendar

    - by Matt Broekhuis
    I noticed this question was asked, but it has not been answered correctly. I have a datatable that has two columns start date and end date. Both contain primefaces p:calendar controls in them. I need to ensure that for each row that the date in column1 is not after the date in column2. I would like to tie this into the JSF validation framework, but I'm having trouble. i've tried marking the datatable rowStatePreserved="true" , this allows me to get the values, but something is still wrong as when it fails, all the values in the first row overwrite all the other values. What am I doing wrong, or should I be using a completely different strategy? xhtml code <h:form> <f:event type="postValidate" listener="#{bean.doCrossFieldValidation}"/> <p:dataTable id="eventDaysTable" value="#{course.courseSchedules}" var="_eventDay" styleClass="compactDataTable" > <p:column id="eventDayStartColumn"> <f:facet name="header"> Start </f:facet> <p:calendar id="startDate" required="true" value="#{_eventDay.startTime}" pattern="MM/dd/yyyy hh:mm a"/> </p:column> <p:column id="eventDayEndColumn"> <f:facet name="header"> End </f:facet> <p:calendar id="endDate" required="true" value="#{_eventDay.endTime}" pattern="MM/dd/yyyy hh:mm a"/> </p:column> </p:dataTable> </h:form> validationCode public void doCrossFieldValidation(ComponentSystemEvent cse) { UIData eventsDaysStable = (UIData) cse.getComponent().findComponent("eventDaysTable"); if (null != eventsDaysStable && eventsDaysStable.isRendered()) { Iterator<UIComponent> startDateCalendarIterator = eventsDaysStable.findComponent("eventDayStartColumn").getChildren().iterator(); Iterator<UIComponent> endDateCalendarIterator = eventsDaysStable.findComponent("eventDayEndColumn").getChildren().iterator(); while (startDateCalendarIterator.hasNext() && endDateCalendarIterator.hasNext()) { org.primefaces.component.calendar.Calendar startDateComponent = (org.primefaces.component.calendar.Calendar) startDateCalendarIterator.next(); org.primefaces.component.calendar.Calendar endDateComponent = (org.primefaces.component.calendar.Calendar) endDateCalendarIterator.next(); Date startDate = (Date) startDateComponent.getValue(); Date endDate = (Date) endDateComponent.getValue(); if (null != startDate && null != endDate && startDate.after(endDate)) { eventScheduleChronologyOk = false; startDateComponent.setValid(false); endDateComponent.setValid(false); } } if (!eventScheduleChronologyOk) { showErrorMessage(ProductManagementMessage.PRODUCT_SCHEDULE_OUT_OF_ORDER); } } }

    Read the article

  • Unable to edit a database row from JSF

    - by user1924104
    Hi guys i have a data table in JSF which displays all of the contents of my database table, it displays it fine, i also have a delete function that can successfully delete from the database fine and updates the data table fine however when i try to update the database i get the error java.lang.IllegalArgumentException: Cannot convert richard.test.User@129d62a7 of type class richard.test.User to long below is the code that i have been using to delete the rows in the database that is working fine : public void delete(long userID) { PreparedStatement ps = null; Connection con = null; if (userID != 0) { try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root"); String sql = "DELETE FROM user1 WHERE userId=" + userID; ps = con.prepareStatement(sql); int i = ps.executeUpdate(); if (i > 0) { System.out.println("Row deleted successfully"); } } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); ps.close(); } catch (Exception e) { e.printStackTrace(); } } } } i simply wanted to edit the above code so it would update the records instead of deleting them so i edited it to look like : public void editData(long userID) { PreparedStatement ps = null; Connection con = null; if (userID != 0) { try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root"); String sql = "UPDATE user1 set name = '"+name+"', email = '"+ email +"', address = '"+address+"' WHERE userId=" + userID; ps = con.prepareStatement(sql); int i = ps.executeUpdate(); if (i > 0) { System.out.println("Row updated successfully"); } } catch (Exception e) { e.printStackTrace(); } finally { try { con.close(); ps.close(); } catch (Exception e) { e.printStackTrace(); } } } } and the xhmtl is : <p:dataTable id="dataTable" var="u" value="#{userBean.getUserList()}" paginator="true" rows="10" editable="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15"> <p:column> <f:facet name="header"> User ID </f:facet> #{u.userID} </p:column> <p:column> <f:facet name="header"> Name </f:facet> #{u.name} </p:column> <p:column> <f:facet name="header"> Email </f:facet> #{u.email} </p:column> <p:column> <f:facet name="header"> Address </f:facet> #{u.address} </p:column> <p:column> <f:facet name="header"> Created Date </f:facet> #{u.created_date} </p:column> <p:column> <f:facet name="header"> Delete </f:facet> <h:commandButton value="Delete" action="#{user.delete(u.userID)}" /> </p:column> <p:column> <f:facet name="header"> Delete </f:facet> <h:commandButton value="Edit" action="#{user.editData(u)}" /> </p:column> currently when you press the edit button it will only update it with the same values as i haven't yet managed to get the datatable to be editable with the database, i have seen a few examples with an array list where the data table gets its values from but never a database so if you have any advice on this too it would be great thanks

    Read the article

  • jsf flash.keep and redirects does not seem to work

    - by user384706
    Hi, I am trying to use JSF 2.0 flash via redirects. I have a class named UserBean (ManagedScoped and RequestScoped). It has a method called getValuesFromFlash which essentially gets the values from the flash and sets the coresponding properties of the UserBean public void getValuesFromFlash() { Flash flash = FacesContext.getCurrentInstance().getExternalContext().getFlash(); firstName= (String) flash.get("firstName"); lastName = (String) flash.get("lastName"); } In the entry page the <h:inputText> are bound to the flash. Snippet follows: Entry.xhtml <h:form> <table> <tr> <td>First Name:</td> <td> <h:inputText id="fname" value="#{flash.firstName}" required="true"/> <h:message for="fname" /> </td> </tr> <tr> <td>Last Name:</td> <td> <h:inputText id="lname" value="#{flash.lastName}" required="true"/> <h:message for="lname" /> </td> </tr> </table <p><h:commandButton value="Submit" action="confirmation?faces-redirect=true" /></p> </h:form> In confirmation.xhtml these values are supposed to be displayed but they are not. Snippet follows: <table> <tr> <td>First Name:</td> <td> <h:outputText value="#{flash.keep.firstName}" /> </td> </tr> <tr> <td>Last Name:</td> <td> <h:outputText value="#{flash.keep.lastName}"/> </td> </tr> </table> <h:form> <p><h:commandButton value="Confirm" action="finished?faces-redirect=true" /></p> </h:form> In finished.xhtml I want all these to be displayed so: <h:body> <h:form> #{userBean.getValuesFromFlash( )} <table> <tr> <td>First Name:</td> <td> <h:outputText value="#{userBean.firstName}" /> </td> </tr> <tr> <td>Last Name:</td> <td> <h:outputText value="#{userBean.lastName}"/> </td> </tr> </table> </h:form> </h:body> Instead when I get redirected to confirmation.xhtml neither first nor last name is displayed, despite I used flash.keep Also in finished.xhtml I get org.apache.el.parser.ParseException: Encountered " "(" "( "" at line 1, column 30. Was expecting one of: "}" ... "." If I remove the parenthesis from the expression #{userBean.getValuesFromFlash( )} and make it = #{userBean.getValuesFromFlash} javax.el.ELException: /done.xhtml: Property 'getValuesFromFlash' not found on type com.UserBean But why no property??It is a method! Why is the method not visible? What I am doing wrong here please? I am using JSF2.0 (MyFaces), Eclipse Helios and Tomcat 6 (Have also tried in Tomcat 7 but no luck). Any help is appreciated. Thanks!

    Read the article

  • Execute a Managed bean from a JSF view in WEB-INF folder

    - by JonathanVila
    We are initiating in Spring + Primefaces development and the first problem we have encountered is about storing the xhtml pages into the WEB-INF folder. When we use a faces form in a view located inside the WEB-INF folder, then the commandButton does not execute the managed bean method. Our bean : In fact we think the problem is that with JSF , the pages are rendered using a link to the same page as the action of the form, so if the page is located in WEB-INF it is not public accessible. We know that having all our xhtml views in the web folder instead of WEB-INF actually solves the issue, but we would like to store that pages into WEB-INF. Thank you.

    Read the article

  • JSF - Unhide jsf component when clicking another component.

    - by Ben
    Hi, I'm trying to have a button that brings up an upload dialog. The way i'm trying to achieve this is similar to this: <h:outputText value="Click Me" id="testit"> <a4j:support reRender="hideme" event="onclick" action="#{actions.switchTestRendered}"/> </h:outputText> <h:outputText id="hideme" value="back" rendered="#{actions.testRendered}"/> With code in the backing bean: private boolean testRendered = false; public String switchTestRendered(){ setTestRendered(!isTestRendered()); System.out.println("Current Status:"+isTestRendered()); return "success"; } public void setTestRendered(boolean testRendered) { this.testRendered = testRendered; } public boolean isTestRendered() { return testRendered; } When I press the 'click me' label I can see that the switchTestRendered is run but the 'hideme' component does not reveal. Any suggestions? Thanks!

    Read the article

  • Userful Resources on ADF/JSF/JDEVELOPER

    - by vijaykumar.yenne
    In most of my interactions with the partner developer community who are working on either Webcenter Projects or ADF related Projects, there are constant questions that come up on the documentation or samples or step by step instructions for novices. Though most of the resources are available online on the OTN site, there seems to be a difficulty in getting hold of the right resource for their job to be done, which i am yet to solve. However here is a list of resources that you should have been to if you in the oracle world and building rich internet based applications using JSF/ADF. 1. If you have just started with JDeveloper and wanted to the different nuances of ADF developement and want to deepen your knowledge you should definitely go through these tutorials: http://www.oracle.com/technology/products/jdev/11/cuecards111/index.html 2. Everything about JDEV - includes the IDE download, demos, sample code, best practices etc. http://www.oracle.com/technology/products/jdev/index.html 3. All About ADF: http://www.oracle.com/technology/products/adf/index.html 4. Know more about ADF Faces : http://www.oracle.com/technology/products/adf/index.html 5. If you want to deepen your knowledge here is the aggregate list of all the blogs by our internal development teams and experts from around the globe. This is really an interesting feed especially when you want to do a deep dive on various aspects and want to be an expert in the oracle UI world. http://www.connotea.org/user/jdeveloper Last but not the least, you should always leverage the entire community whenever you run into any issues : http://forums.oracle.com

    Read the article

  • JSF:Resourcebundle Problem with Internationalization

    - by Sven
    I implemented internationalization like in that tutorial! When I change the language in my app. It works. But only until the next request happens. Then language settings are reset to my standard language -.- What am I missing here: LanguageBean.java @ManagedBean(name="language") @SessionScoped public class LanguageBean implements Serializable{ private static final long serialVersionUID = 1L; private String localeCode; private static Map<String,Object> countries; static{ countries = new LinkedHashMap<String,Object>(); countries.put("Deutsch", Locale.GERMAN); //label, value countries.put("English", Locale.ENGLISH); } public Map<String, Object> getCountriesInMap() { return countries; } public String getLocaleCode() { return localeCode; } public void setLocaleCode(String localeCode) { this.localeCode = localeCode; } //value change event listener public void countryLocaleCodeChanged(ValueChangeEvent e){ String newLocaleValue = e.getNewValue().toString(); //loop country map to compare the locale code for (Map.Entry<String, Object> entry : countries.entrySet()) { if(entry.getValue().toString().equals(newLocaleValue)){ FacesContext.getCurrentInstance() .getViewRoot().setLocale((Locale)entry.getValue()); } } } } my facelets template: <h:selectOneMenu value="#{language.localeCode}" onchange="submit()" valueChangeListener="#{language.countryLocaleCodeChanged}"> <f:selectItems value="#{language.countriesInMap}" /> </h:selectOneMenu> faces-config: <application> <locale-config> <default-locale>de</default-locale> </locale-config> <resource-bundle> <base-name>org.dhbw.stg.wwi2008c.mopro.ui.text</base-name> <var>msg</var> </resource-bundle> </application>

    Read the article

  • JSF : Better way to check for existence of <h:message for="id"/>

    - by user552809
    I have a form in which validation error message needs to be displayed below the input elements. The error needs to be highlighted by showing an error bubble around the error message and the input text. To achieve this, I need to check for the existence of h:messages for individual elements. I am able to check for the existence of global error messages as follows <h:panelGroup rendered="#{not empty facesContext.messages}"> </h:panelGroup> How I can check the same for specific client id (say first name). So something like faceContent.messages("creditCardNo") A solution I have currently is to create a custom resolver but was wondering if there is a better solution.

    Read the article

  • JSF 2.0 method invocation with argument from var of dataGrid

    - by little_b
    Hello I use primefaces with facelets and i have a quastion: for example i have dataGrid and i want to call method of bean, that registered in faces-config, to include some dynamic content: <p:dataGrid var="provider" value="#{paymentFormBean.providers}"> <ui:include src="contentFactory.getSpecificForm('some attribute')"/> </p:dataGrid> How could i invoke getSpecificForm method with argument from var of dataGrid? Something like: <p:dataGrid var="provider" value="#{paymentFormBean.providers}"> <ui:include src="contentFactory.getSpecificForm(provider.formName)"/> </p:dataGrid> Could anyone help me? Thank you

    Read the article

  • JSF manual refresh issue

    - by k.elgohary
    I need your help . i am developing a simple project with jsf2.0 and primefaces 3.2. I have 2 pages first is the page1.xhtml whci contains : <p:column> <p:panel header="#{ct.coTypeName}" > <h:panelGrid columns="1" width="100" height="100"> <h:outputText value="#{ct.coTypeId}" /> <p:commandLink action="distributer/distributersList.xhtml"> <h:graphicImage url="/resources/images/homePagecartoonBusinessMan.jpg" width="100" height="100"/> <f:param name="bt" value="dist" /> <f:param name="ti" value="#{ct.coTypeId}" /> </p:commandLink> </h:panelGrid> </p:panel> </p:column> </p:dataGrid> When i press The command link it forwarded me to another page "distributer/distributersList.xhtml" which have a selectOneMenu which doesn't show its items until i refresh the page manually . <f:selectItems value="#{bussinessOwnersViewerMB.cities}" var="city" itemLabel="#{city.cityName}" itemValue="#{city.cityId}"/> </p:selectOneMenu>

    Read the article

  • JSF dynamic ui:include

    - by Ray
    In my app I have tutor and student as roles of user. And I decide that main page for both will be the same. But menu will be different for tutors and users. I made to .xhtml page tutorMenu.xhtml and student.xhtml. And want in dependecy from role include menu. For whole page I use layout and just in every page change content "content part" in ui:composition. In menu.xhtml <h:body> <ui:composition> <div class="menu_header"> <h2> <h:outputText value="#{msg['menu.title']}" /> </h2> </div> <div class="menu_content"> <?:if test="#{authenticationBean.user.role.roleId eq '2'}"> <ui:include src="/pages/content/body/student/studentMenu.xhtml"/> </?:if> <?:if test= "#{authenticationBean.user.role.roleId eq '1'}"> <ui:include src="/pages/content/body/tutor/tutorMenu.xhtml" /> </?:if> </div> </ui:composition> I know that using jstl my be not better solution but I can't find other. What is the best decision of my problem?

    Read the article

  • flex and jsf access the same instance of bean

    - by David
    i integrate a flex app in a jsf-icefaces app (in a jspx site with the ice:outputmedia-tag) and want to access the same instance of a bean from flex by remote, that jsf inject. i already connect with blazeds to a java-bean. this bean - like all other beans - get other beans by injection of jsf, but when i access the bean by remote from flex it doesnt hold the injected beans (like localizer and accesmanager, both session scoped) and i can't connect to the jsf session (FacesContext.getCurrentInstance() is null). this is because flex create a new instance of the bean and it’s not the same current instance, that jsf inject, i think. i can connect from flex to the database by create a new entity manager in the java bean, but that's not what i want, because it's again another entity manager...i want persist and get data over the accessmanager-bean. i know exadel fiji and flamingo, but i couldn't work with fiji, because my jsf app include the icefaces components and then it doesn't work with richfaces which fiji needs. and flamingo work only with jboss seam and spring. is it right? i also read about the spring-flex-integration, but the jsf application did not create with spring and i don't want to integrate spring in such a large jsf app. yesterday i read about the FlexFactory interface. this interface i have to implement in my own Factory and set it in the service-config.xml of blazeds as a factory read this. i still implement my own factory but i only get application scoped beans over the servlet context which i get over FlexContext.getServletContext().getAttribute("Bean"); and not session scoped beans... i hope there is a chance to connect throw flex and jsf... thanks!

    Read the article

  • How get Tomahawk functionality with JSF 2.0 (Glassfish V3)

    - by Thorbjørn Ravn Andersen
    I've started to upgrade an existing application written with JSF 1.1 and MyFaces Tomahawk 1.1 to JSF 2.0 to get facelets etc. I've now run into the snag that apparently Tomahawk is not JSF 2.0 compatible as it expects the stand-alone version of Facelets instead of the built-in to JSF 2.0 with the following error: org.apache.catalina.LifecycleException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! com.sun.facelets.tag.jsf.ComponentHandler (it appears to be placed in javax.faces.view.facelets now). I have looked around and there doesn't seem to be a JSF 2.0 facelet compatible version of Tomahawk. I only believe I need t:updateActionListener (inside t:dataTable) and the rowSpan facility of t:panelGroup. Is all this functionality available in JSF 2.0 directly, or must I locate a new library giving this? Any suggestions?

    Read the article

  • add jsf project facet in eclipse/ why need it?

    - by user384706
    Hi, I started on JSF2.0. I followed a tutorial with no problem and all worked fine! I used Eclipse Helios. But I noticed something I can not understand. The tutorial said to add Project Facet for JSF 2. I did no such thing and all worked ok. So to follow tutorial exactly I did: Right-click on Project -Properties- Project Facets And JavaServer Faces check-box was not ticked. I assume this is what the tutorial means by Project Facet. I clicked on it and a Further Configuration Needed link appeared. I followed the link to a JSF capabilities (Modify Faceted Project) dialog, I selected as User library, my library of JSF(which is MyFaces) but I got the error message: Found multiple versions of the required class javax.faces.FactoryFinder. What is this error? Can't I add project facet after creating my project? And what do I need the project facet for? My (trivial) code indicates that JSF works ok, so what is the project Facet useful for? Thanks!

    Read the article

  • JSF inter-portlet communication with Oracle WebCenter

    - by Alexander Rudat
    Normal 0 21 false false false DE X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Calibri","sans-serif";}

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >