Search Results

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

Page 32/45 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Update rich:dataTable binding on Ajax selectionchange

    - by MilkJug
    I want to find the current selection of the data table whenever a selection changes. I can update other items using: <a4j:ajax render=":tmp,:tmp2" event="selectionchange"> But I cannot find the current selection - I think the major issue is that the UIExtendedDataTable backing does not get updated on the Ajax request. Is there a way to update the current selection on a selectionchange (Using RichFaces 4)?

    Read the article

  • Use from value from backing bean in javascript

    - by AlfonsSocken
    What I want is to use a boolean value from applicationContext.xml (Jboss configuration file) in my javascript. Currently I use Spring to inject a value configured in applicationContext.xml into my backingbean. Then I put an output text in my jsp like this <h:outputText id="idValue" styleClass="foo" value="" rendered="#{bean.isRendered}"/> In my JavaScript I try following jQuery(function(){ bRedirect = jQuery("#foo").value != undefined; ... All this looks so terrible to me, even though it works fine. There must be a smarter way than doing what I do. Note that I am running JSF1.2 and therefore must use jQuery instead of $ and also select by unique class (foo) and not by id, which may be bad practice as well. Thank you in advance. alfons

    Read the article

  • p:commandButton update doesn't work in ui:include

    - by Roberto de Santis
    Hi guys. I want to update a part of a page by PPR. This is the part of page that i want to update: <h:panelGroup id="aggiungiAuto" rendered="#{!autoBean.operazioneOk}"> <ui:include src="../component/aggiungi_auto.xhtml"/> </h:panelGroup> While this is the commandButton present in aggiungi_auto.xhtml <p:commandButton value="Submit" update="growl aggiungiAuto aggiungiFoto" actionListener="#{autoBean.insert}"/> Any Idea?

    Read the article

  • Correct way to manage multiple h:inputText?

    - by Mirco Attocchi
    I've an h:dataTable to display my item information (in my case a customer support request) and for each row I'd like to put an h:inputText and h:commandButton to add a comment to the desired item. I've no problem with action, but my question is about the correct way to manage many h:inputText and related value on backbean. I'm not sure that is correct to make all h:inputText set the value to the same backbean property. Any suggestions? Thanks all.

    Read the article

  • Auto-create ManagedBean problem

    - by Debbech
    I need to instanciate a ManagedBean manually in jsp code. I used the following code : FacesContext context = FacesContext.getCurrentInstance(); ActorBean bean = (ActorBean) context.getApplication().createValueBinding("#{actorBean}").getValue(context); response.getWriter().print(bean.getChaine()); but I still get a NullPointerException ! :( Any suggestion please. This is the stacktracelog: 11 juin 2010 12:33:44 org.apache.catalina.core.StandardWrapperValve invoke GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception java.lang.NullPointerException at org.apache.jsp.jspx.portal_jsp._jspService(portal_jsp.java:157) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source)

    Read the article

  • How to change the background color of a h:inputText control inside a rich:Panel

    - by kiransri
    I need to change the background color of some h:inputText controls inside a rich panel based on a condition. This is to distinguish these controls as readonly. I tried using styleClass and style properties but both did not work. styleClass is ignored and style colors only half of the textbox. 1) styleClass code : In css : .readonlycontrol { background-color: #C0C0C0; } In .xhtml page: <rich:panel styleClass="inputpanel"> <f:facet name="header" > <h:outputText value= "#{cardreqmsg.apptinfo}"/> </f:facet> <h:panelGrid columns="4" cellpadding="2" border="0"> <h:inputText id ="name" styleClass="readonlycontrol" readonly="true"/> ......... 2) style code: <h:inputText id ="name" readonly="true" style="background-color:#C0C0C0"/> Any help would be greatly appreciated

    Read the article

  • Is it possible to pass Calendar new date in the bean without listener?

    - by isabsent
    I am trying to pass new date from PrimeFaces p:calendar (placed in p:dataTable column) to the backing bean: <p:column > <p:calendar value="#{bean.date}">` <p:ajax /> </p:calendar> </p:column> It does not update bean.date. Variants with <p:ajax update="@this" event="change"/> <p:ajax update="@this" event="select"/> do not update bean.date too. The only way I have found is using of listener. However, I suppose, there should be a way without listener implementation like for simple facelets: <p:column> <h:inputText value="#{bean.note}" > <f:ajax/> </h:inputText> </p:column> that works fine for me. Does anybody know how to get it working!?

    Read the article

  • Set required attribute of two h:selectManyCheckbox

    - by BRabbit27
    I have two h:selectManyCheckBox with the required attribute set to true. What I want is that the required attribute of both of the components work together. Only display the error message if and only if both of the selected items list are empty. Right now my problem is that the message displays if either one of them is empty. Here's my code: <rich:panel> <f:facet name="header"> <h:outputText value="Actualización de catálogos"/> </f:facet> <h:panelGrid columns="4"> <h:outputLabel for="actualizarCatalogoPEC" value="Actualizar catálogos PEC"/> <h:selectBooleanCheckbox id="actualizarCatalogoPEC" value="#{administrationBean.actualizaTodosPecChecked}"> <f:ajax event="click" render="todosCatalogosPEC"/> </h:selectBooleanCheckbox> <h:outputLabel for="actualizarCatalogoSAGARPA" value="Actualizar catálogos SAGARPA"/> <h:selectBooleanCheckbox id="actualizarCatalogoSAGARPA" value="#{administrationBean.actualizaTodosSagarpaChecked}"> <f:ajax event="click" render="todosCatalogosSAGARPA"/> </h:selectBooleanCheckbox> <a4j:outputPanel id="todosCatalogosPEC"> <h:selectManyCheckbox id="selectCatalogosPEC" disabled="#{administrationBean.actualizaTodosPecChecked}" required="true" value="#{administrationBean.catalogosPecSeleccionados}" requiredMessage="Seleccione al menos un catálogo" layout="pageDirection"> <f:selectItems value="#{administrationBean.catalogosPecOptions}"/> </h:selectManyCheckbox> </a4j:outputPanel> <h:panelGroup/> <a4j:outputPanel id="todosCatalogosSAGARPA"> <h:selectManyCheckbox id="selectCatalogosSAGARPA" disabled="#{administrationBean.actualizaTodosSagarpaChecked}" required="true" value="#{administrationBean.catalogosSagarpaSeleccionados}" requiredMessage="Seleccione al menos un catálogo" layout="pageDirection" > <f:selectItems value="#{administrationBean.catalogosSagarpaOptions}"/> </h:selectManyCheckbox> </a4j:outputPanel> <h:panelGroup/> <rich:message id="messageCatalogosPEC" for="selectCatalogosPEC"/> <h:panelGroup/> <rich:message id="messageCatalogosSAGARPA" for="selectCatalogosSAGARPA"/> <h:panelGroup/> <a4j:commandButton value="Actualizar catálogos" render="messageCatalogosPEC" action="#{administrationBean.doActualizaCatalogos}"/> </h:panelGrid> </rich:panel> Cheers

    Read the article

  • Seam reRender component in partial; reRender across naming containers

    - by meed2000
    Hello, I'm using seam to develop a simple web app. Using a4j commandButton in many places, with the property reRender="componentName" componentName is in most places a a4j outputPanel Which always worked, until I used a template. with include of two different views. reRender applied to the whole view does work, but reRender applied to an inner component does not. Same issue with page rules, all action I had defined are not functioning any more. Is this a problem with Seam, did someone experience this? <a4j:outputPanel id="panel1"> <h:form> <div class="section"> // whatever code </div> <a4j:commandButton id="button1" value="Add" action="#{bean1.action()}" reRender="panel1"/> <h:commandButton id="reset" value="Reset" action="#{bean1.reset}"/> </h:form> </a4j:outputPanel>

    Read the article

  • Not reaction to pressing button

    - by Orange91
    I have a ring in primefaces: <h:form> <p:ring id="ring" value="#{ringBean.images}" var="image" styleClass="image-ring" easing="easeInOutBack"> <p:graphicImage value="./../../images/#{image.image}" width="150" height="150"/> <p:commandButton value="#{image.name}" action="#{image.action}" /> </p:ring> </h:form> My RingBean: @ManagedBean @RequestScoped public class RingBean implements Serializable{ private List<PersonImage> images; private PersonImage selectedPerson; public RingBean() { images = new ArrayList<PersonImage>(); images.add(new PersonImage("person3.png", "Pacjent", "patientList")); images.add(new PersonImage("person4.png", "Admin", "adminList")); images.add(new PersonImage("person5.png", "Lekarz", "doctorList")); images.add(new PersonImage("person6.png", "Sekretarka", "secretaryList")); images.add(new PersonImage("person7.png", "Nieaktywni", "inactiveList")); } public List<PersonImage> getImages() { return images; } public PersonImage getSelectedPerson() { return selectedPerson; } public void setSelectedPerson(PersonImage selectedPerson) { this.selectedPerson = selectedPerson; } } PersonImage class: public class PersonImage { String image; String name; String action; public PersonImage() { } public PersonImage(String image, String name, String action) { this.image = image; this.name = name; this.action = action; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAction() { return action; } public void setAction(String action) { this.action = action; } } faces-config: <navigation-case> <from-outcome>adminList</from-outcome> <to-view-id>/protected/admin/adminList.xhtml</to-view-id> <redirect/> </navigation-case> <navigation-case> <from-outcome>doctorList</from-outcome> <to-view-id>/protected/admin/doctorList.xhtml</to-view-id> <redirect/> </navigation-case> <navigation-case> <from-outcome>patientList</from-outcome> <to-view-id>/protected/admin/patientList.xhtml</to-view-id> <redirect/> </navigation-case> <navigation-case> <from-outcome>secretaryList</from-outcome> <to-view-id>/protected/admin/secretaryList.xhtml</to-view-id> <redirect/> </navigation-case> When i pressed my button, not reaction. Why? I added the action in button: And in Ring I add: images.add(new PersonImage("person4.png", "Admin", "adminList")); action is adminList. Why this not work? When i changed in button: <p:commandButton value="#{image.name}" action="adminList" /> all work. Why? Both construction returned identical string.

    Read the article

  • Custom Tag Issue

    - by user1304570
    I got a problem in making custom tag in jsf2.0 for authentication.Actually I made a sample it get run successfully But When i am merging it with my project Its component class get skipped out.But When I remove Follwing entry from web.xml <context-param> <param-name> org.jboss.jbossfaces.JSF_CONFIG_NAME </param-name> <param-value>MyFaces-2.0</param-value> </context-param> It get run success fully .But It show a red line text in every page of my project i.e One or more resources have the target of 'head', but no 'head' component has been defined within the view.**

    Read the article

  • <o:massAttribute> affects another components in same <h:panelGrid>

    - by Ignacio Ayuste
    I'm using the new version of OmniFaces 1.8.1, and particullary I start to use the new tag: <o:massAttribute>. Basically, I have the following form with conditionally rendered and disabled fields: <h:form id="formABMProducto"> <h:panelGrid id="datosProducto" columns="4"> <o:massAttribute name="rendered" value="#{cc.attrs.page != 'baja'}"> <h:outputLabel for="codigo" ... /> <h:inputText id="codigo" ... /> <rich:message for="codigo" /> <h:panelGroup /> </o:massAttribute> <o:massAttribute name="rendered" value="#{cc.attrs.page eq 'baja'}"> <h:outputLabel for="codigo" .../> <rich:autocomplete id="codigoProducto" ... /> <rich:message for="codigo" /> <h:panelGroup /> </o:massAttribute> <o:massAttribute name="disabled" value="#{cc.attrs.disableComponents}"> <h:outputLabel for="nombre" ... /> <h:inputTextarea id="nombre" ... /> <rich:message for="nombre" /> <span /> <h:outputLabel for="descripcion" ... /> <h:inputTextarea id="descripcion" ... /> <rich:message for="descripcion" /> <span /> </o:massAttribute> <h:outputLabel value="#{msgs['producto.abm.panel.proveedor.tipo']}" for="CmbTipoProveedor"/> <rich:select id="CmbTipoProveedor" ... /> <rich:message for="CmbTipoProveedor" /> <a4j:commandButton ... /> </h:panelGrid> </h:form> However, when I open the page, the third <o:massAttribute> is also disabling another input fields codigo and codigoProducto. I think this isn't the expected behaviour.

    Read the article

  • jQuery does not work anymore after re-rendring any RichFaces component

    - by Manish Kumar
    I have a page which contains following components: 1 Button 1 drop down list using jQuery 1 button whose on click event changes a text box value using jQuery 2 another buttons shown on hover If I change the dropdown value, or press a button, then the page is re-rendered by ajax. After that, jQuery does not work anymore. If I refresh the page, then jQuery works fine. How is this caused and how can I solve it?

    Read the article

  • can't edit my h:datatable

    - by Mike
    hi! i have this code: <h:form> <rich:dataTable value="#{my.lreqs}" var="req" id="reqs" width="630px" > <rich:column label="Value" styleClass="schColL" width="90px" style="text-align:center"> <f:facet name="header"> <h:outputText value="#{my.colValue}" /> </f:facet> <h:inputText value="#{req.value}" > </h:inputText> </rich:column> </rich:dataTable> <h:commandButton value="Save" action="#{my.saveChanges}" ></h:commandButton> </h:form> and this is my bean: private List<Detail> lreqs; public List<Detail> getLreqs() { return lreqs; } public void setLreqs(List<Detail> lreqs) { this.lreqs = lreqs; } public void saveChanges() { firstNewValue = lreqs.get(0).getValue(); } but when i click save - a new value in req.value field is not being saved! why is it?

    Read the article

  • Backing Bean not getting values sent by javascript

    - by Developer106
    I have three drop down lists whose values are been copied to <h:inputHidden> components by the following JavaScript function: function getBirthDate() { var months = document.getElementById("months") var hidden1 = document.getElementById("formsignup:monthField"); hidden1.value = months.options[months.selectedIndex].text; var days = document.getElementById("days"); var hidden2 = document.getElementById("formsignup:dayField"); hidden2.value = days.options[days.selectedIndex].value; var years = document.getElementById("years"); var hidden3 = document.getElementById("formsignup:yearField"); hidden3.value = years.options[years.selectedIndex].value; } Here are the three <h:inputHidden> components: <h:inputHidden value="#{signupBean.month}" id="monthField"/> <h:inputHidden value="#{signupBean.day}" id="dayField"/> <h:inputHidden value="#{signupBean.year}" id="yearField"/> This is the command button that is supposed to invoke the function that copies the values to the inputs and then submits them to the backing bean. <h:commandButton image="images/images/signup1.png" styleClass="joinnow" id="joinus" action="#{signupBean.save}" onclick="getBirthDate()" /> But they arrive as null in the backing bean. How is this caused and how can I solve it?

    Read the article

  • refresh a <ui:composition when j_security_check connection interrupted (http 408)

    - by José Osuna Barrios
    I have a "j_security_check connection interrupted (http code 408)" and proposed solution is <meta http-equiv="refresh" content="#{session.maxInactiveInterval}"/> by http://stackoverflow.com/a/2141274/1852036 but my page structure is a composition using a template.xhtml and a view.xhtml like a <ui:composition: my template.xhtml: <html ... <f:view ... <h:body ... <ui:insert name="content"> ... my view.xhtml to refresh when session.maxInactiveInterval <ui:composition ... <ui:define name="content"> ... may anyone help me to do this? I want to refresh this <ui:composition view, I can't use <meta http-equiv="refresh" content="#{session.maxInactiveInterval}"/> on template.xhtml because it's used by several views

    Read the article

  • How to change h:outputText value by JavaScript?

    - by Peter
    I already tested with 2 inputText, It runs well for example var tdate = document.getElementById('txtDate'); //h:inputText var tdt = document.getElementById('txtDateTime'); //h:inputText tdate.onchange = function(){ tdt.value = tdate.value; }; How can I change the value of " tdt " - h:outputText? var tdate = document.getElementById('txtDate'); //h:inputText var tdt = document.getElementById('txtDateTime'); //h:outputText

    Read the article

  • Accessing Application Scoped Bean Causes NullPointerException

    - by user2946861
    What is an Application Scoped Bean? I understand it to be a bean which will exist for the life of the application, but that doesn't appear to be the correct interpretation. I have an application which creates an application scoped bean on startup (eager=true) and then a session bean that tries to access the application scoped bean's objects (which are also application scoped). But when I try to access the application scoped bean from the session scoped bean, I get a null pointer exception. Here's excerpts from my code: Application Scoped Bean: @ManagedBean(eager=true) @ApplicationScoped public class Bean1 implements Serializable{ private static final long serialVersionUID = 12345L; protected ArrayList<App> apps; // construct apps so they are available for the session scoped bean // do time consuming stuff... // getters + setters Session Scoped Bean: @ManagedBean @SessionScoped public class Bean2 implements Serializable{ private static final long serialVersionUID = 123L; @Inject private Bean1 bean1; private ArrayList<App> apps = bean1.getApps(); // null pointer exception What appears to be happening is, Bean1 is created, does it's stuff, then is destroyed before Bean2 can access it. I was hoping using application scoped would keep Bean1 around until the container was shutdown, or the application was killed, but this doesn't appear to be the case.

    Read the article

  • updating a properties file in a web application

    - by AmiraGL
    i have a properties file (under rsources folder) in which i'm stocking a variable (key=value), i need to update it when a user insert a new value or update the older one , so can i do it ? i have doubts because it's a web application so it' simply a war deployed in the server so how it is possible to access the .properties file and change it directly from the code . if it's not possible is there another solution ? Any Help will be apprecited Many thanks

    Read the article

  • AFTER INVOKE_APPLICATION(5) is being skipped in my h:datatable

    - by Mike
    hi! i have this code: <h:form> <rich:dataTable value="#{my.lreqs}" var="req" id="reqs" width="630px" > <rich:column label="Value" styleClass="schColL" width="90px" style="text-align:center"> <f:facet name="header"> <h:outputText value="#{my.colValue}" /> </f:facet> <h:inputText value="#{req.value}" > </h:inputText> </rich:column> </rich:dataTable> <h:commandButton value="Save" action="#{my.saveChanges}" ></h:commandButton> </h:form> and this is my bean: private List<Detail> lreqs; public List<Detail> getLreqs() { return lreqs; } public void setLreqs(List<Detail> lreqs) { this.lreqs = lreqs; } but when i click save - a new value in req.value field is not being saved! i added phaseTracker and realised that my AFTER INVOKE_APPLICATION(5). why is it?

    Read the article

  • URL getRequestParameterMap not working

    - by DD
    I'm using IceFaces 1.8.2 and trying to get a parameter from the URL using: ((HttpServletRequest) FacesContext.getCurrentInstance() .getExternalContext().getRequest()).getParameter(name); This works fine on the inital request. However, when I do a partialSubmit on a component, it stops working. I'm assuming that its to do with how requests are processed when partial submits are done. Is there a workaround? At the moment, I'm having to ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext() .getRequest()).getQueryString(); and manually pass the query string. Thanks.

    Read the article

  • Quels jeux de composants open source utilisez-vous pour vos développements en JSF ? Partagez votre expérience

    Bonjour, L'équipe Java renouvelle l'initiative du sondage des jeux de composants Open Source utilisés dans les développements en JSF. Un précédent sondage couvrant la période 2008 à 2011 est disponible ici. Sans être exhaustif, les plus connus sont : Primefaces (sans doute le plus populaire maintenant) Richfaces Icefaces Apache Myfaces Tomahawk Apache Myfaces Trinidad Apache Myfaces Tobago Autres Nous souhaiterions par le biais de ce sondage que vous puissiez partager votre expérience concernant ces jeux de composants. Merci de la...

    Read the article

  • Simple HTML5 Friendly Markup Sample

    - by Geertjan
    From a demo done by David Heffelfinger (who has a great Java EE 7 screencast series here), on HTML5 friendly markup. index.xhtml:  <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:jsf="http://xmlns.jcp.org/jsf"> <title>Data Entry Page</title> <body> <form method="POST" jsf:id='form'> <table> <tr> <td>Name:</td> <td><input jsf:id='name' type="text" jsf:value="${person.name}" /></td> </tr> <tr> <td>City</td> <th><input jsf:id='city' type="text" jsf:value="${person.city}"/></th> </tr> <tr> <td><input type="submit" value="Submit" jsf:action="confirmation" /></td> </tr> </table> </form> </body> </html> confirmation.xhtml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Data Confirmation Page</title> </head> <body> <h1>#{person.name}</h1> from <h2>#{person.city}</h2> </body> </html> Person.java: package org.demo; import javax.enterprise.inject.Model; @Model public class Person { String name; String city; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } }

    Read the article

  • JPA 2?EJB 3.1?JSF 2????????! WebLogic Server 12c?????????Java EE 6??????|WebLogic Channel|??????

    - by ???02
    2012?2???????????????WebLogic Server 12c?????????Java EE 6?????????????????????????????????????????????????????????????Oracle Enterprise Pack for Eclipse 12c??WebLogic Server 12c(???)????Java EE 6??????3??????????????????????????????JPA 2.0??????????·?????????EJB 3.1???????·???????????????(???)???????O/R?????????????JPA 2.0 Java EE 6????????????????????Web?????????????3?????(3????)???????·????????????·????????????????????????????????JPA(Java Persistence API) 2.0???EJB(Enterprise JavaBeans) 3.1???JSF(JavaServer Faces) 2.0????3????????????????·???????????JPA??Java??????????????·?????????????O/R?????????????????????·???????????EJB?Session Bean??????????????????·??????????????????????JSF??????????????????????????????????????? ??????JPA????Oracle Database??EMPLOYEES?????Java??????????????????????Entity Bean??????XML?????????????????????????XML????????????????????????????????????????????????????·?????????????????????????????????????????????????????????????Java EE 6??????JPA 2.0??????????·???????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????Oracle Enterprise Pack for Eclipse(OEPE)??????File????????New?-?Other??????? ??????New??????????????????????????Web?-?Dynamic Web Project???????Next????????????????Dynamic Web Project?????????????Project name????OOW???????????Target Runtime????New Runtime????????? ???New Server Runtime Environment???????????????Oracle?-?Oracle WebLogic Server 12c(12.1.1)???????Next???????????????????????????WebLogic home????C:\Oracle\Middleware\wlserver_12.1???????Finish?????????????WebLogic Home????????????????????????Java home?????????????????????Finish??????????????????????Dynamic Web Project????????????????Finish??????????????????JPA 2.0??????????·?????? ???????????????JPA 2.0???????????????·??????????????????Eclipse??Project Explorer?(??????·???)?????????OOW?????????????????????????????·???????????????Properties?????????????????·???·????????????????????????????Project Facets?????????????JPA??????(?????????????Details?????JPA 2.0?????????????????????)???????????????????Further configuration available????????? ???Modify Faceted Project??????????????????????????????????Connection????????????????????????????Add Connection????????? ??????New Connection Profile????????????????Connection Profile Type????Oracle Database Connection??????Next???????????? ???Specify a Driver and Connection Details???????Drivers????Oracle Database 10g Driver Default???????????Properties?????????????????????SIDxeHostlocalhostPort number1521User nameHRPasswordhr ???????????Test Connection??????????????????Ping Succeeded!?????????????????????????????Finish???????????Modify Faceted Project????????OK????????????????Properties for OOW????????OK?????????????????? ?????????Eclipse????????????????OOW?????????????????·???????????????JPA Tools?-?Generate Entities from Tables...??????? ????Generate Custom Entities???????????????????????????????Schema????HR??????Tables????EMPLOYEES???????????Next???????????? ???????????Next???????????Customize Default Entity Generation??????Package????model???????Finish?????????????JPQL?????????? ?????????Oracle Database??EMPLOYEES??????????????????·????model.Employee.java?????????????????????????????????·?????OOW????Java Resources?-?src?-?model???????Employee.java????????????????????????????????·???Employee????(Employee.java)?package model; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import java.util.Set; import javax.persistence.Column;<...?...>/**  * The persistent class for the EMPLOYEES database table.  *  */ @Entity  // ?@Table(name="EMPLOYEES")  // ?// Apublic class Employee implements Serializable {        private static final long serialVersionUID = 1L;       @Id  // ?       @Column(name="EMPLOYEE_ID")        private long employeeId;        @Column(name="COMMISSION_PCT")        private BigDecimal commissionPct;        @Column(name="DEPARTMENT_ID")        private BigDecimal departmentId;        private String email;        @Column(name="FIRST_NAME")        private String firstName;       @Temporal( TemporalType.DATE)  //?       @Column(name="HIRE_DATE")        private Date hireDate;        @Column(name="JOB_ID")        private String jobId;        @Column(name="LAST_NAME")        private String lastName;        @Column(name="PHONE_NUMBER")        private String phoneNumber;        private BigDecimal salary;        //bi-directional many-to-one association to Employee<...?...>}  ???????????????·???????????????????????????????????????????@Table(name="")??????@Table??????????????????????????????????????? ?????????????????????????????????????·???????????????? ?????????????????????????????SQL?Data?????????? ???????????????A?????JPA?????????JPQL(Java Persistence Query Language)?????????????JPQL?????SQL???????????????????????????????????????????????????????????????????????????????????Employee.selectByNameEmployee??firstName????????????????????employeeId????????? ?????????????????????import java.util.Date;import java.util.Set;import javax.persistence.Column;<...?...>/**  * The persistent class for the EMPLOYEES database table.  *  */ @Entity  // ?@Table(name="EMPLOYEES")  // ?@NamedQueries({       @NamedQuery(name="Employee.selectByName" , query="select e from Employee e where e.firstName like :name order by e.employeeId")})<...?...> ?????????·??????OOW?-?JPA Content?-?persistent.xml??????Connection???????????????Database????JTA data source:???jdbc/test????????????????????????Java EE 6??????JPA 2.0???????????????????????????????????·??????????????????????????????????????SQL????????????????????????·????????????·??????????????XML??????????????????1??????????????????????????????????????????????????????????????????EJB 3.1????????·???????????EJB 3.1????????·?????????????????EJB 3.1?Stateless Session Bean?????·????????????????·???????????????????·??????????????????? EJB3.1?????JPA 2.0???????????·???????????????????????XML???????????????????????????????EJB 3.1?????????·????EJB?????????????????????????????????????????????????????????????? ????????EJB 3.1?Session Bean?????·????????????????????????????????????????????????????public List<Employee> getEmp(String keyword)firstName????????????Employee?????? ????????????????????·???????????OOW????????????·???????????????New?-?Other???????????????????????????????????EJB?-?Session Bean(EJB 3.x)??????NEXT????????????????????Create EJB 3.x Session Bean?????????????Java Package????ejb???class name????EmpLogic???????????State Type????Stateless?????????No-interface???????????????????????Finish???????????? ?????????Stateless Session Bean??????·?????EmpLogic.java????????????????????EmpLogic????·????????EJB?????????????Stateless Session Bean?????????@Stateless?????????????????????????????????????EmpLogic????(EmpLogic.java)?package ejb;import javax.ejb.LocalBean;import javax.ejb.Stateless;<...?...>import model.Employee;@Stateless@LocalBeanpublic class EmpLogic {       public EmpLogic() {       }} ??????????????????????????????????????·???????????????????????import??????????????????EmpLogic??????????????????????????·???????????????????????import????????(EmpLogic.java)?package ejb;import javax.ejb.LocalBean;import javax.ejb.Stateless;import javax.persistence.EntityManager;  // ?import javax.persistence.PersistenceContext;  // ?<...?...>import model.Employee;@Stateless@LocalBeanpublic class EmpLogic {      @PersistenceContext(unitName = "OOW")  // ?      private EntityManager em;  // ?       public EmpLogic() {       }} ?????????·???????JPA???????????????????·????????????????????????????CRUD???????????????????·????????????EntityManager???????????????????????????1????????????????·???????????????????????@PersistenceContext?????unitName?????????????persistence.xml????persistence-unit???name?????????????? ???????EmpLogic?????·???????????????????????????????????????????????????????????????????????????????EmpLogic????????·???????(EmpLogic.java)?package ejb;import java.util.List;  // ? import javax.ejb.LocalBean;import javax.ejb.Stateless;import javax.persistence.EntityManager;  // ? import javax.persistence.PersistenceContext;  // ? <...?...>import model.Employee;@Stateless@LocalBeanpublic class EmpLogic {       @PersistenceContext(unitName = "OOW")  // ?        private EntityManager em;  // ?        public EmpLogic() {       }      @SuppressWarnings("unchecked")  // ?      public List<Employee> getEmp(String keyword) {  // ?             StringBuilder param = new StringBuilder();  // ?             param.append("%");  // ?             param.append(keyword);  // ?             param.append("%");  // ?             return em.createNamedQuery("Employee.selectByName")  // ?                    .setParameter("name", param.toString()).getResultList();  // ?      }} ???EJB 3.1???Stateless Session Bean?????????? ???JSF 2.0???????????????????????????????????????????????????JAX-RS????RESTful?Web??????????????????????

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >