Search Results

Search found 3678 results on 148 pages for 'jsf jsp el'.

Page 36/148 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • spring mvc forward to jsp

    - by jerluc
    I currently have my web.xml configured to catch 404s and send them to my spring controller which will perform a search given the original URL request. The functionality is all there as far as the catch and search go, however the trouble begins to arise when I try to return a view. <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver" p:order="1"> <property name="mediaTypes"> <map> <entry key="json" value="application/json" /> <entry key="jsp" value="text/html" /> </map> </property> <property name="defaultContentType" value="application/json" /> <property name="favorPathExtension" value="true" /> <property name="viewResolvers"> <list> <bean class="org.springframework.web.servlet.view.BeanNameViewResolver" /> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value="" /> </bean> </list> </property> <property name="defaultViews"> <list> <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" /> </list> </property> <property name="ignoreAcceptHeader" value="true" /> </bean> This is a snippet from my MVC config file. The problem lies in resolving the view's path to the /WEB-INF/jsp/ directory. Using a logger in my JBoss setup, I can see that when I test this search controller by going to a non-existent page, the following occurs: Server can't find the request Request is sent to 404 error page (in this case my search controller) Search controller performs search Search controller returns view name (for this illustration, we'll assume test.jsp is returned) Based off of server logger, I can see that org.springframework.web.servlet.view.JstlView is initialized once my search controller returns the view name (so I can assume it is being picked up correctly by the InternalResourceViewResolver) Server attempts to return content to browser resulting in a 404! A couple things confuse me about this: I'm not 100% sure why this isn't resolving when test.jsp clearly exists under the /WEB-INF/jsp/ directory. Even if there was some other problem, why would this result in a 404? Shouldn't a 404 error page that results in another 404 theoretically create an infinite loop? Thanks for any help or pointers! Controller class [incomplete]: @Controller public class SiteMapController { //-------------------------------------------------------------------------------------- @Autowired(required=true) private SearchService search; @Autowired(required=true) private CatalogService catalog; //-------------------------------------------------------------------------------------- @RequestMapping(value = "/sitemap", method = RequestMethod.GET) public String sitemap (HttpServletRequest request, HttpServletResponse response) { String forwardPath = ""; try { long startTime = System.nanoTime() / 1000000; String pathQuery = (String) request.getAttribute("javax.servlet.error.request_uri"); Scanner pathScanner = new Scanner(pathQuery).useDelimiter("\\/"); String context = pathScanner.next(); List<ProductLightDTO> results = new ArrayList<ProductLightDTO>(); StringBuilder query = new StringBuilder(); String currentValue; while (pathScanner.hasNext()) { currentValue = pathScanner.next().toLowerCase(); System.out.println(currentValue); if (query.length() > 0) query.append(" AND "); if (currentValue.contains("-")) { query.append("\""); query.append(currentValue.replace("-", " ")); query.append("\""); } else { query.append(currentValue + "*"); } } //results.addAll(this.doSearch(query.toString())); System.out.println("Request: " + pathQuery); System.out.println("Built Query:" + query.toString()); //System.out.println("Result size: " + results.size()); long totalTime = (System.nanoTime() / 1000000) - startTime; System.out.println("Total TTP: " + totalTime + "ms"); if (results == null || results.size() == 0) { forwardPath = "home.jsp"; } else if (results.size() == 1) { forwardPath = "product.jsp"; } else { forwardPath = "category.jsp"; } } catch (Exception ex) { System.err.println(ex); } System.out.println("Returning view: " + forwardPath); return forwardPath; } }

    Read the article

  • jsf and eclipse setup. Lib in Explorer is different than lib in tomcat. How come?

    - by user384706
    Hi, I am starter in JSF2.0, and I have a question related to Eclipse (I am using Helios). 1)I create a Dynamic Project 2)I add JSF project facet. 3)I choose JSF user library (I have created it using MyFaces) All ok so far. I notice though that in the Project Explorer in WebContent/WEB-INF/lib the lib directory is empty instead of having MyFaces jars. The application works fine though. I looked into this and the jars are actually being placed in the corresponding lib directory of the app deployed under wtpwebapps of the Tomcat instance of eclipse in the .pluggins directory. Ok, it works but IMHO it is incorrect to have the Project Explorer inconsistent with the directories actually deployed. I.e. lib is shown empty in Project Explorer but with jars under wtpwebapps. Am I wrong to dislike this inconsistency? Is this how it should work or am I doing something wrong in the way I am setting my project? Thanks!

    Read the article

  • How to Plug a Small Hole in NetBeans JSF (Join Table) Code Generation

    - by MarkH
    I was asked recently to provide an assist with designing and building a small-but-vital application that had at its heart some basic CRUD (Create, Read, Update, & Delete) functionality, built upon an Oracle database, to be accessible from various locations. Working from the stated requirements, I fleshed out the basic application and database designs and, once validated, set out to complete the first iteration for review. Using SQL Developer, I created the requisite tables, indices, and sequences for our first run. One of the tables was a many-to-many join table with three fields: one a primary key for that table, the other two being primary keys for the other tables, represented as foreign keys in the join table. Here is a simplified example of the trio of tables: Once the database was in decent shape, I fired up NetBeans to let it have first shot at the code. NetBeans does a great job of generating a mountain of essential code, saving developers what must be millions of hours of effort each year by building a basic foundation with a few clicks and keystrokes. Lest you think it (or any tool) can do everything for you, however, occasionally something tosses a paper clip into the delicate machinery and makes you open things up to fix them. Join tables apparently qualify.  :-) In the case above, the entity class generated for the join table (New Entity Classes from Database) included an embedded object consisting solely of the two foreign key fields as attributes, in addition to an object referencing each one of the "component" tables. The Create page generated (New JSF Pages from Entity Classes) worked well to a point, but when trying to save, we were greeted with an error: Transaction aborted. Hmm. A quick debugger session later and I'd identified the issue: when trying to persist the new join-table object, the embedded "foreign-keys-only" object still had null values for its two (required value) attributes...even though the embedded table objects had populated key attributes. Here's the simple fix: In the join-table controller class, find the public String create() method. It will look something like this:     public String create() {        try {            getFacade().create(current);            JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("JoinEntityCreated"));            return prepareCreate();        } catch (Exception e) {            JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));            return null;        }    } To restore balance to the force, modify the create() method as follows (changes in red):     public String create() {         try {            // Add the next two lines to resolve:            current.getJoinEntityPK().setTbl1id(current.getTbl1().getId().toBigInteger());            current.getJoinEntityPK().setTbl2id(current.getTbl2().getId().toBigInteger());            getFacade().create(current);            JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("JoinEntityCreated"));            return prepareCreate();        } catch (Exception e) {            JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));            return null;        }    } I'll be refactoring this code shortly, but for now, it works. Iteration one is complete and being reviewed, and we've met the milestone. Here's to happy endings (and customers)! All the best,Mark

    Read the article

  • Base de Datos Oracle, su mejor opción para reducir costos de IT

    - by Ivan Hassig
    Por Victoria Cadavid Sr. Sales Cosultant Oracle Direct Uno de los principales desafíos en la administración de centros de datos es la reducción de costos de operación. A medida que las compañías crecen y los proveedores de tecnología ofrecen soluciones cada vez más robustas, conservar el equilibrio entre desempeño, soporte al negocio y gestión del Costo Total de Propiedad es un desafío cada vez mayor para los Gerentes de Tecnología y para los Administradores de Centros de Datos. Las estrategias más comunes para conseguir reducción en los costos de administración de Centros de Datos y en la gestión de Tecnología de una organización en general, se enfocan en la mejora del desempeño de las aplicaciones, reducción del costo de administración y adquisición de hardware, reducción de los costos de almacenamiento, aumento de la productividad en la administración de las Bases de Datos y mejora en la atención de requerimientos y prestación de servicios de mesa de ayuda, sin embargo, las estrategias de reducción de costos deben contemplar también la reducción de costos asociados a pérdida y robo de información, cumplimiento regulatorio, generación de valor y continuidad del negocio, que comúnmente se conciben como iniciativas aisladas que no siempre se adelantan con el ánimo de apoyar la reducción de costos. Una iniciativa integral de reducción de costos de TI, debe contemplar cada uno de los factores que  generan costo y pueden ser optimizados. En este artículo queremos abordar la reducción de costos de tecnología a partir de la adopción del que según los expertos es el motor de Base de Datos # del mercado.Durante años, la base de datos Oracle ha sido reconocida por su velocidad, confiabilidad, seguridad y capacidad para soportar cargas de datos tanto de aplicaciones altamente transaccionales, como de Bodegas de datos e incluso análisis de Big Data , ofreciendo alto desempeño y facilidades de administración, sin embrago, cuando pensamos en proyectos de reducción de costos de IT, además de la capacidad para soportar aplicaciones (incluso aplicaciones altamente transaccionales) con alto desempeño, pensamos en procesos de automatización, optimización de recursos, consolidación, virtualización e incluso alternativas más cómodas de licenciamiento. La Base de Datos Oracle está diseñada para proveer todas las capacidades que un área de tecnología necesita para reducir costos, adaptándose a los diferentes escenarios de negocio y a las capacidades y características de cada organización.Es así, como además del motor de Base de Datos, Oracle ofrece una serie de soluciones para optimizar la administración de la información a través de mecanismos de optimización del uso del storage, continuidad del Negocio, consolidación de infraestructura, seguridad y administración automática, que propenden por un mejor uso de los recursos de tecnología, ofrecen opciones avanzadas de configuración y direccionan la reducción de los tiempos de las tareas operativas más comunes. Una de las opciones de la base de datos que se pueden provechar para reducir costos de hardware es Oracle Real Application Clusters. Esta solución de clustering permite que varios servidores (incluso servidores de bajo costo) trabajen en conjunto para soportar Grids o Nubes Privadas de Bases de Datos, proporcionando los beneficios de la consolidación de infraestructura, los esquemas de alta disponibilidad, rápido desempeño y escalabilidad por demanda, haciendo que el aprovisionamiento, el mantenimiento de las bases de datos y la adición de nuevos nodos se lleve e cabo de una forma más rápida y con menos riesgo, además de apalancar las inversiones en servidores de menor costo. Otra de las soluciones que promueven la reducción de costos de Tecnología es Oracle In-Memory Database Cache que permite almacenar y procesar datos en la memoria de las aplicaciones, permitiendo el máximo aprovechamiento de los recursos de procesamiento de la capa media, lo que cobra mucho valor en escenarios de alta transaccionalidad. De este modo se saca el mayor provecho de los recursos de procesamiento evitando crecimiento innecesario en recursos de hardware. Otra de las formas de evitar inversiones innecesarias en hardware, aprovechando los recursos existentes, incluso en escenarios de alto crecimiento de los volúmenes de información es la compresión de los datos. Oracle Advanced Compression permite comprimir hasta 4 veces los diferentes tipos de datos, mejorando la capacidad de almacenamiento, sin comprometer el desempeño de las aplicaciones. Desde el lado del almacenamiento también se pueden conseguir reducciones importantes de los costos de IT. En este escenario, la tecnología propia de la base de Datos Oracle ofrece capacidades de Administración Automática del Almacenamiento que no solo permiten una distribución óptima de los datos en los discos físicos para garantizar el máximo desempeño, sino que facilitan el aprovisionamiento y la remoción de discos defectuosos y ofrecen balanceo y mirroring, garantizando el uso máximo de cada uno de los dispositivos y la disponibilidad de los datos. Otra de las soluciones que facilitan la administración del almacenamiento es Oracle Partitioning, una opción de la Base de Datos que permite dividir grandes tablas en estructuras más pequeñas. Esta aproximación facilita la administración del ciclo de vida de la información y permite por ejemplo, separar los datos históricos (que generalmente se convierten en información de solo lectura y no tienen un alto volumen de consulta) y enviarlos a un almacenamiento de bajo costos, conservando la data activa en dispositivos de almacenamiento más ágiles. Adicionalmente, Oracle Partitioning facilita la administración de las bases de datos que tienen un gran volumen de registros y mejora el desempeño de la base de datos gracias a la posibilidad de optimizar las consultas haciendo uso únicamente de las particiones relevantes de una tabla o índice en el proceso de búsqueda. Otros factores adicionales, que pueden generar costos innecesarios a los departamentos de Tecnología son: La pérdida, corrupción o robo de datos y la falta de disponibilidad de las aplicaciones para dar soporte al negocio. Para evitar este tipo de situaciones que pueden acarrear multas y pérdida de negocios y de dinero, Oracle ofrece soluciones que permiten proteger y auditar la base de datos, recuperar la información en caso de corrupción o ejecución de acciones que comprometan la integridad de la información y soluciones que permitan garantizar que la información de las aplicaciones tenga una disponibilidad de 7x24. Ya hablamos de los beneficios de Oracle RAC, para facilitar los procesos de Consolidación y mejorar el desempeño de las aplicaciones, sin embrago esta solución, es sumamente útil en escenarios dónde las organizaciones de quieren garantizar una alta disponibilidad de la información, ante fallo de los servidores o en eventos de desconexión planeada para realizar labores de mantenimiento. Además de Oracle RAC, existen soluciones como Oracle Data Guard y Active Data Guard que permiten replicar de forma automática las bases de datos hacia un centro de datos de contingencia, permitiendo una recuperación inmediata ante eventos que deshabiliten por completo un centro de datos. Además de lo anterior, Active Data Guard, permite aprovechar la base de datos de contingencia para realizar labores de consulta, mejorando el desempeño de las aplicaciones. Desde el punto de vista de mejora en la seguridad, Oracle cuenta con soluciones como Advanced security que permite encriptar los datos y los canales a través de los cueles se comparte la información, Total Recall, que permite visualizar los cambios realizados a la base de datos en un momento determinado del tiempo, para evitar pérdida y corrupción de datos, Database Vault que permite restringir el acceso de los usuarios privilegiados a información confidencial, Audit Vault, que permite verificar quién hizo qué y cuándo dentro de las bases de datos de una organización y Oracle Data Masking que permite enmascarar los datos para garantizar la protección de la información sensible y el cumplimiento de las políticas y normas relacionadas con protección de información confidencial, por ejemplo, mientras las aplicaciones pasan del ambiente de desarrollo al ambiente de producción. Como mencionamos en un comienzo, las iniciativas de reducción de costos de tecnología deben apalancarse en estrategias que contemplen los diferentes factores que puedan generar sobre costos, los factores de riesgo que puedan acarrear costos no previsto, el aprovechamiento de los recursos actuales, para evitar inversiones innecesarias y los factores de optimización que permitan el máximo aprovechamiento de las inversiones actuales. Como vimos, todas estas iniciativas pueden ser abordadas haciendo uso de la tecnología de Oracle a nivel de Base de Datos, lo más importante es detectar los puntos críticos a nivel de riesgo, diagnosticar las proporción en que están siendo aprovechados los recursos actuales y definir las prioridades de la organización y del área de IT, para así dar inicio a todas aquellas iniciativas que de forma gradual, van a evitar sobrecostos e inversiones innecesarias, proporcionando un mayor apoyo al negocio y un impacto significativo en la productividad de la organización. Más información http://www.oracle.com/lad/products/database/index.html?ssSourceSiteId=otnes 1Fuente: Market Share: All Software Markets, Worldwide 2011 by Colleen Graham, Joanne Correia, David Coyle, Fabrizio Biscotti, Matthew Cheung, Ruggero Contu, Yanna Dharmasthira, Tom Eid, Chad Eschinger, Bianca Granetto, Hai Hong Swinehart, Sharon Mertz, Chris Pang, Asheesh Raina, Dan Sommer, Bhavish Sood, Marianne D'Aquila, Laurie Wurster and Jie Zhang. - March 29, 2012 2Big Data: Información recopilada desde fuentes no tradicionales como blogs, redes sociales, email, sensores, fotografías, grabaciones en video, etc. que normalmente se encuentran de forma no estructurada y en un gran volumen

    Read the article

  • Place the business logic in Java Beans?

    - by Lirik
    I was reading this page and I found the following statement: MVC in Java Server Pages Now that we have a convenient architucture to separate the view, how can we leverage that? Java Server Pages (JSP) becomes more interesting because the HTML content can be separated from the Java business objects. JSP can also make use of Java Beans. The business logic could be placed inside Java Beans. If the design is architected correctly, a Web Designer could work with HTML on the JSP site without interfering with the Java developer. Interestingly in my textbook I pulled the following quote: In the MVC architecture... the original request is always handled by a servlet. The servlet invokes the business logic and data access code and creates beans to represent the results (that’s the model). Then, the servlet decides which Java Server Page is appropriate to present those particular results and forwards the request there (the JSP is the view). The servlet decides what business logic code applies and which JSP should present the results (the servlet is the controller). The two statements seem slightly contradicting. What is the best way to use beans: should we place business logic in them or should we only place results in them? Are there ways in which beans are inadequate for representing a model?

    Read the article

  • custom tag 'cannot be resolved to a type'

    - by lotus99t
    I have a custom tag, packaged into a library jar that is included in my web apps war file. I get the following error: An error occurred at line: 66 in the jsp file: /WEB-INF/jsp/portlet/portfolio/operations/operationsInfo.jsp org.apache.jsp.tag.meta.form.WidgetFactory_tag cannot be resolved to a type 63: <c:forEach var="fldCfg" items="${config.page.fields}" > 64: <tr> 65: <td><form:Label fld="${fldCfg}"/></td> 66: <td><form:WidgetFactory fld="${fldCfg}" decodesMap="${decodesMap}" command="${operationsInfoBean}" dateFormat="${preferredDateFormat}"/></td> 67: </tr> 68: </c:forEach> 69: </table> But it doesn't seem to complain about Label which is in the same taglib. I've confirmed that the jar is in the war and that the tag file is in the jar and the that the TLD (in META-INF) expressly defines 'WidgetFactory' Why am I getting this error?

    Read the article

  • Hibernate+PostgreSQL throws JDBCConnectionException: Cannot open connection

    - by Omer Salmanoglu
    false true auto thread org.postgresql.Driver 1234 jdbc:postgresql://localhost/postgres postgres public org.hibernate.dialect.PostgreSQLDialect false true org.hibernate.transaction.JDBCTransactionFactory false false false false 100 When I press "Save" button I get the following exception: javax.servlet.ServletException: org.hibernate.exception.JDBCConnectionException: Cannot open connection javax.faces.webapp.FacesServlet.service(FacesServlet.java:325) root cause javax.faces.el.EvaluationException: org.hibernate.exception.JDBCConnectionException: Cannot open connection javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) root cause org.hibernate.exception.JDBCConnectionException: Cannot open connection org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:98) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142) org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85) org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344) $Proxy108.beginTransaction(Unknown Source) com.yemex.beans.CompanyBean.saveOrUpdate(CompanyBean.java:52) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.apache.el.parser.AstValue.invoke(AstValue.java:196) org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98) javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) root cause java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost/postgres java.sql.DriverManager.getConnection(Unknown Source) java.sql.DriverManager.getConnection(Unknown Source) org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133) org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:142) org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85) org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1463) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:344) $Proxy108.beginTransaction(Unknown Source) com.yemex.beans.CompanyBean.saveOrUpdate(CompanyBean.java:52) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) org.apache.el.parser.AstValue.invoke(AstValue.java:196) org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98) javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102) javax.faces.component.UICommand.broadcast(UICommand.java:315) javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775) javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267) com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)

    Read the article

  • sending parameters with ajax

    - by kawtousse
    I am trying to send parameters that I get from a table in my jsp to other JSP using ajax. I am using the followinf function to send all values to JSP: ajaxForm but I don't know why the send failed every time I run it: Here is the javascript function: function editarow() { var xhr = getXhr(); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { selects = xhr.responseText; // On se sert de innerHTML pour rajouter les options a la liste document.getElementById('prjsel').innerHTML = selects; } }; var row, firstNameCell, lastNameCell; var table = document.getElementById("sheet"); var buttons = table.getElementsByTagName("button"); for (var i = 0; i < buttons.length; i++) { if (buttons[i].name == "edit") { buttons[i].onclick = function() { row = this.parentNode.parentNode; // The first name cell is the first child NameCell1 = findElement(row.firstChild); NameCell2 = findElement(NameCell1.nextSibling); NameCell3 = findElement(NameCell2.nextSibling); NameCell4 = findElement(NameCell3.nextSibling); NameCell5 = findElement(NameCell4.nextSibling); NameCell6 = findElement(NameCell5.nextSibling); NameCell7 = findElement(NameCell6.nextSibling); // `innerHTML` pour obtenir la valeur /*alert("name 1 is " + NameCell1.innerHTML); alert("name 2 is " + NameCell2.innerHTML); alert("name 3 is " + NameCell3.innerHTML); alert("name 4 is " + NameCell4.innerHTML); alert("name 5 is " + NameCell5.innerHTML); alert("name 6 is " + NameCell6.innerHTML); alert("name 7 is " + NameCell7.innerHTML);*/ } } } xhr.open("POST", "ajaxForm.jsp", true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.send("NameCell1="+NameCell1,"NameCell2="+NameCell2,"NameCell3="+NameCell3,"NameCell4="+NameCell4,"NameCell5="+NameCell5,"NameCell6="+NameCell6,"NameCell7="+NameCell7 ); } After I get the value from the table I want to send all of them to the ajaxForm.jsp.

    Read the article

  • Can the overuse of custom taglibs disrupt the outsourcing of html designers?

    - by Renato Gama
    Yesterday me and a friend were talking about the overuse of custom taglibs! We create taglibs for everything! We create taglibs in order to wrap jQuery UI elements (tabs, button, etc), and other plugins elements as well. We often wrap them together in a single component. We use taglibs in a point that we almost have no pure html within the body tag. Our question is: is this a healthy habit??? Imagine two situations: 1) We hire an html designer and have the cost of a month for him to learn all this stuff. 2) We want to outsource the html development but no company would get our taglib library to learn, OR it become more expensive. We love taglibs as its been a lovely shortcut for javascipt development as we write it only once. What would be the best practices in this sense, and what would you suggest? We are looking for a future-proof solution (or an argument that agrees with ours).

    Read the article

  • Failed to obtain JDBC Driver for MySQL under Tomcat environment

    - by Michael Mao
    Hi all: I've been trying to obtain the Driver class for JDBC connection to MySQL. The workstation is running on Linux, Fedora 10. I have manually set up the classpath variable for Java by CLI like this: bash-3.2$ echo $CLASSPATH /home/cmao/public_html/jsp/mysql-connector-java-5.1.12-bin.jar This shows that I've added the lastest mysql connection jar archive to my CLASSPATH variable. I've created a test JSP page which can be found here And source code for this page is: <%@page language="java"%> <%@page import="java.sql.*"%> <%@page import="java.util.*"%> <html> <head> <title>UTS JDBC MySQL connection test page</title> </head> <body> <% Connection con = null; out.print("Java version is : " + System.getProperty("java.version") + "<br />"); out.print("Tomcat version is : " + application.getServerInfo() + "<br />"); out.print("Servlet version is: " + application.getMajorVersion() + "<br />"); out.print("JSP version is : " + JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion() +"<br />"); //out.print("Java classpath is : " + System.getProperty("java.class.path")+ "<br />"); //out.print("JSP classpath is : " + appliaction.getAttribute("org.apache.catalina.jsp_classpath") + "<br />"); //out.print("Tomcat classpath is : " + System.getProperty("org.apache.tomcat.common.classpath") + "<br />"); try { Class c = Class.forName("com.mysql.jdbc.Driver"); } catch(Exception e) { out.println("Error! Failed to obtain JDBC driver for MySQL... Missing class \"com.mysql.jdbc.Driver\"<br />"); } %> </body> </html> None of those commented out line would work, various Jsper Expetions would be thrown. You can check those Error pages from the following links: classpath Error page catalina Error page tomcat Error page It seems, from my limited knowledge of JSP and Servlet, the Tomcat environment "ignores" my Java CLASSPATH? In which case I cannot configure the MySQL JDBC package to let my Servlets(a JSP is but a Servlet anyway) work. I am not sure how to fix this issue. would it be better if I use an IDE like Eclipse or NetBeans and create a real Java "web app" so that everything can be "self-configured" by the usage of a web.config XML configuration file? So that I can certainly bypass this Tomcat environment restriction? Many thanks for the suggestions in advance.

    Read the article

  • Backbone events not firing (this.el undefined) & general feedback on use of the framework

    - by Leo
    I am very new to backbone.js and I am struggling a little. I figured out a way to get data from the server (in json) onto the screen successfully but am I doing it the right/best way? I know there is something wrong because the only view which contains a valid this.el is the parent view. I suspect that because of this, the events of the view are not firing ()... What is the best way forward? Here is the code: var surveyUrl = "/api/Survey?format=json&callback=?"; $(function () { AnswerOption = Backbone.Model.extend({}); AnswerOptionList = Backbone.Collection.extend({ initialize: function (models, options) { this.bind("add", options.view.render); } }); AnswerOptionView = Backbone.View.extend({ initialize: function () { this.answerOptionList = new AnswerOptionList(null, { view: this }); _.bindAll(this, 'render'); }, events: { "click .answerOptionControl": "updateCheckedState" //does not fire because there is no this.el }, render: function (model) { // Compile the template using underscore var template = _.template($("#questionAnswerOptionTemplate").html(), model.answerOption); $('#answerOptions' + model.answerOption.questionId + '>fieldset').append(template); return this; }, updateCheckedState: function (data) { //never hit... } }); Question = Backbone.Model.extend({}); QuestionList = Backbone.Collection.extend({ initialize: function (models, options) { this.bind("add", options.view.render); } }); QuestionView = Backbone.View.extend({ initialize: function () { this.questionlist = new QuestionList(null, { view: this }); _.bindAll(this, 'render'); }, render: function (model) { // Compile the template using underscore var template = _.template($("#questionTemplate").html(), model.question); $("#questions").append(template); //append answers using AnswerOptionView var view = new AnswerOptionView(); for (var i = 0; i < model.question.answerOptions.length; i++) { var qModel = new AnswerOption(); qModel.answerOption = model.question.answerOptions[i]; qModel.questionChoiceType = ChoiceType(); view.answerOptionList.add(qModel); } $('#questions').trigger('create'); return this; } }); Survey = Backbone.Model.extend({ url: function () { return this.get("id") ? surveyUrl + '/' + this.get("id") : surveyUrl; } }); SurveyList = Backbone.Collection.extend({ model: Survey, url: surveyUrl }); aSurvey = new Survey({ Id: 1 }); SurveyView = Backbone.View.extend({ model: aSurvey, initialize: function () { _.bindAll(this, 'render'); this.model.bind('refresh', this.render); this.model.bind('change', this.render); this.model.view = this; }, // Re-render the contents render: function () { var view = new QuestionView(); //{el:this.el}); for (var i = 0; i < this.model.attributes[0].questions.length; i++) { var qModel = new Question(); qModel.question = this.model.attributes[0].questions[i]; view.questionlist.add(qModel); } } }); window.App = new SurveyView(aSurvey); aSurvey.fetch(); }); -html <body> <div id="questions"></div> <!-- Templates --> <script type="text/template" id="questionAnswerOptionTemplate"> <input name="answerOptionGroup<%= questionId %>" id="answerOptionInput<%= id %>" type="checkbox" class="answerOptionControl"/> <label for="answerOptionInput<%= id %>"><%= text %></label> </script> <script type="text/template" id="questionTemplate"> <div id="question<%=id %>" class="questionWithCurve"> <h1><%= headerText %></h1> <h2><%= subText %></h2> <div data-role="fieldcontain" id="answerOptions<%= id %>" > <fieldset data-role="controlgroup" data-type="vertical"> <legend> </legend> </fieldset> </div> </div> </script> </body> And the JSON from the server: ? ({ "name": "Survey", "questions": [{ "surveyId": 1, "headerText": "Question 1", "subText": "subtext", "type": "Choice", "positionOrder": 1, "answerOptions": [{ "questionId": 1, "text": "Question 1 - Option 1", "positionOrder": 1, "id": 1, "createdOn": "\/Date(1333666034297+0100)\/" }, { "questionId": 1, "text": "Question 1 - Option 2", "positionOrder": 2, "id": 2, "createdOn": "\/Date(1333666034340+0100)\/" }, { "questionId": 1, "text": "Question 1 - Option 3", "positionOrder": 3, "id": 3, "createdOn": "\/Date(1333666034350+0100)\/" }], "questionValidators": [{ "questionId": 1, "value": "3", "type": "MaxAnswers", "id": 1, "createdOn": "\/Date(1333666034267+0100)\/" }, { "questionId": 1, "value": "1", "type": "MinAnswers", "id": 2, "createdOn": "\/Date(1333666034283+0100)\/" }], "id": 1, "createdOn": "\/Date(1333666034257+0100)\/" }, { "surveyId": 1, "headerText": "Question 2", "subText": "subtext", "type": "Choice", "positionOrder": 2, "answerOptions": [{ "questionId": 2, "text": "Question 2 - Option 1", "positionOrder": 1, "id": 4, "createdOn": "\/Date(1333666034427+0100)\/" }, { "questionId": 2, "text": "Question 2 - Option 2", "positionOrder": 2, "id": 5, "createdOn": "\/Date(1333666034440+0100)\/" }, { "questionId": 2, "text": "Question 2 - Option 3", "positionOrder": 3, "id": 6, "createdOn": "\/Date(1333666034447+0100)\/" }], "questionValidators": [{ "questionId": 2, "value": "3", "type": "MaxAnswers", "id": 3, "createdOn": "\/Date(1333666034407+0100)\/" }, { "questionId": 2, "value": "1", "type": "MinAnswers", "id": 4, "createdOn": "\/Date(1333666034417+0100)\/" }], "id": 2, "createdOn": "\/Date(1333666034377+0100)\/" }, { "surveyId": 1, "headerText": "Question 3", "subText": "subtext", "type": "Choice", "positionOrder": 3, "answerOptions": [{ "questionId": 3, "text": "Question 3 - Option 1", "positionOrder": 1, "id": 7, "createdOn": "\/Date(1333666034477+0100)\/" }, { "questionId": 3, "text": "Question 3 - Option 2", "positionOrder": 2, "id": 8, "createdOn": "\/Date(1333666034483+0100)\/" }, { "questionId": 3, "text": "Question 3 - Option 3", "positionOrder": 3, "id": 9, "createdOn": "\/Date(1333666034487+0100)\/" }], "questionValidators": [{ "questionId": 3, "value": "3", "type": "MaxAnswers", "id": 5, "createdOn": "\/Date(1333666034463+0100)\/" }, { "questionId": 3, "value": "1", "type": "MinAnswers", "id": 6, "createdOn": "\/Date(1333666034470+0100)\/" }], "id": 3, "createdOn": "\/Date(1333666034457+0100)\/" }, { "surveyId": 1, "headerText": "Question 4", "subText": "subtext", "type": "Choice", "positionOrder": 4, "answerOptions": [{ "questionId": 4, "text": "Question 4 - Option 1", "positionOrder": 1, "id": 10, "createdOn": "\/Date(1333666034500+0100)\/" }, { "questionId": 4, "text": "Question 4 - Option 2", "positionOrder": 2, "id": 11, "createdOn": "\/Date(1333666034507+0100)\/" }, { "questionId": 4, "text": "Question 4 - Option 3", "positionOrder": 3, "id": 12, "createdOn": "\/Date(1333666034507+0100)\/" }], "questionValidators": [{ "questionId": 4, "value": "3", "type": "MaxAnswers", "id": 7, "createdOn": "\/Date(1333666034493+0100)\/" }, { "questionId": 4, "value": "1", "type": "MinAnswers", "id": 8, "createdOn": "\/Date(1333666034497+0100)\/" }], "id": 4, "createdOn": "\/Date(1333666034490+0100)\/" }], "id": 1, "createdOn": "\/Date(1333666034243+0100)\/" })

    Read the article

  • How to display formated Calendar type in JSTL?

    - by maectpo
    Hi, I am using Calendar type in Java and I would like to display formated date in jstl. I was trying: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <fmt:parseDate var="date" type="date" dateStyle="short" value="${photo.dateCreated}" /> <c:out value="${data}" /> But it doesn't work: java.text.ParseException: Unparseable date Can JSP format "Calendar" type?

    Read the article

  • Set request attributes when a Form is POSTed

    - by ssahmed555
    Is there any way to set request attributes (not parameters) when a form is posted? The problem I am trying to solve is: I have a JSP page displaying some data in a couple of dropdown lists. When the form is posted, my Controller servlet processes this request (based on the parameters set/specified in the form) and redirects to the same JSP page that is supposed to display addition details. I now want to display the same/earlier data in the dropdown lists without having to recompute or recalculate to get that same data. And in the said JSP page, the dropdown lists in the form are populated by data that is specified through request attributes. Right now, after the Form is POSTed and I am redirected to the same JSP page the dropdown lists are empty because the necessary request attributes are not present. I am quite the n00b when it comes to web apps, so an obvious & easy solution to this problem escapes me at the moment! I am open to suggestions on how to restructure the control flow in the Servlet. Some details about this app: standard Servlet + JSP, JSTL, running in Apache Tomcat 6.0. Thanks.

    Read the article

  • errorPage directive works, but error-page in web.xml doesn't?

    - by danb
    I get jsp exceptions causing a forward to my error page when I put this at the top of my JSPs... <%@ page errorPage="/error.page" %> but when I try to do it globally with web.xml like so: <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/error.page</location> </error-page> I just get a blank page... I've also tried putting /error.jsp in the location element.. but no love with that either.. I am triggering an exception with a jsp that just contains this: <%if(true)throw new RuntimeException("test exception");%> I do see the exception in the console from tomcat but I just can't get that error page to show without a directive on every jsp... am I missing something simple here?

    Read the article

  • How to handle exceptions from an image-generating Servlet?

    - by ssahmed555
    I have a simple (Servlet, JSP, and JSTL) web app whose main functionality is displaying images retrieved from a back-end server. The controller servlet forwards the user to a JSP that in turn uses another Servlet to display the resulting image on that same JSP. Further down, the JSP has a line similar to: <a href="<c:out value='${imageURL}'/>"><img src="<c:out value='${imageURL}'/>" alt="image view" border="1"></a> which invokes a GET request on the image-generating servlet causing it to generate the image. My question is: how do I handle Exceptions thrown by this image-generating servlet? I already have an error page defined (in web.xml) to handle ServletException within my web app but this doesn't work for this image-generating Servlet, and results in the following errors showing up in my Tomcat server logs: SEVERE: Exception Processing ErrorPage[exceptionType=javax.servlet.ServletException, location=/WEB-INF/ExceptionPage.jsp] java.lang.IllegalStateException: Cannot reset buffer after response has been committed What's my recourse in this situation? I'd like to be able to handle Exceptions thrown from this image-generating Servlet, and display some error on the main UI or forward the user to another error page.

    Read the article

  • Error 404--Not Found (while using apache and weblogic)

    I have an application deployed in weblogic, and am using apche server.Normally, when I enter the url for the application, it should display a jsp (1) kind of please wait then this one will redirect to another jsp (2). the problem is when I enter the url of the application, it displays jsp (1) "please wait" and while redirecting it gives the error (Error 404--Not Found). What do you think the problem is ?

    Read the article

  • better JSP server setup on windows?

    - by phill
    I'm currently running my jsp pages on a windows 2003 server, apache tomcat 5.5 setup. My process involved is as follows: make change to .java file compile .java file restart apache tomcat service refresh browser check c:\program files\apache software foundation\tomcat 5.5\logs This is beyond cumbersome. Is there a better development platform to develop jsp pages which makes life alot easier? thanks in advance

    Read the article

  • How to get selected row index in JSF datatable?

    - by Nitesh Panchal
    I have a databale on index.xhtml <h:dataTable style="border: solid 2px black;" value="#{IndexBean.bookList}" var="item" binding="#{IndexBean.datatableBooks}"> <h:column> <h:commandButton value="Edit" actionListener="#{IndexBean.editBook}"> <f:param name="index" value="#{IndexBean.datatableBooks.rowIndex}"/> </h:commandButton> </h:column> </h:dataTable> My bean: @ManagedBean(name="IndexBean") @ViewScoped public class IndexBean implements Serializable { private HtmlDataTable datatableBooks; public HtmlDataTable getDatatableBooks() { return datatableBooks; } public void setDatatableBooks(HtmlDataTable datatableBooks) { this.datatableBooks = datatableBooks; } public void editBook() throws IOException{ int index = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("index").toString()); System.out.println(index); } } My problem is that I always get the same index in server log even though I click the different edit buttons. Imagine that there is one collection which is supplied to the datatable. I have not shown that in bean. If I change scope from ViewScope to RequestScope it works fine. What can be the problem with @ViewScoped? Thanks in advance :) EDIT: <h:column> <h:commandButton value="Edit" actionListener="#{IndexBean.editBook}" /> </h:column> public void editBook(ActionEvent ev) throws IOException{ if (ev.getSource() != null && ev.getSource() instanceof HtmlDataTable) { HtmlDataTable objHtmlDataTable = (HtmlDataTable) ev.getSource(); System.out.println(objHtmlDataTable.getRowIndex()); } }

    Read the article

  • JSF ui:repeat and f:ajax giving wrong value for h:inputText after rerender.

    - by Andrew
    I have a list of questions and I can display them ok using a ui:repeat, but after clicking the Edit button the rerendered inputText is given the wrong question.id. For some reason, if you click Edit on the first item, the inputText value assigned is that of the second item in the list, even though other outputs (other than the h:inputText element) are correct. <h:form id="questionnaireForm"> <ui:repeat value="#{ProjectManager.currentProject.preQuestions}" var="question" varStatus="current" id="preQuestionsRepeat"> <div> <ui:fragment rendered="#{!question.editing}"> <f:ajax render="@form"> <p>#{question.id} #{question.questionText}</p> <h:inputText value="#{question.id}"/> <h:commandLink styleClass="link" action="#{question.setEditing}" value="Edit"> </h:commandLink> </f:ajax> </ui:fragment> </div> <div> <ui:fragment rendered="#{question.editing}"> <f:ajax render="@form"> <p>#{question.id} #{question.questionText}</p> <h:inputText value="#{question.id}"/> </f:ajax> </ui:fragment> </div> </ui:repeat> </h:form> Obviously I don't really want to edit the id. I just want the correct question.something to show up in my inputText :-) Perhaps I'm not using correctly? It seems fine according to my reading so far. Many thanks for your assistance.

    Read the article

  • JSF: How to get the selected item from selectOneMenu if its rendering is dynamic?

    - by Dzmitry Zhaleznichenka
    At my view I have two menus that I want to make dependent, namely, if first menu holds values "render second menu" and "don't render second menu", I want second menu to be rendered only if user selects "render second menu" option in the first menu. After second menu renders at the same page as the first one, user has to select current item from it, fill another fields and submit the form to store values in database. Both the lists of options are static, they are obtained from the database once and stay the same. My problem is I always get null as a value of the selected item from second menu. How to get a proper value? The sample code of view that holds problematic elements is: <h:selectOneMenu id="renderSecond" value="#{Bean.renderSecondValue}" valueChangeListener="#{Bean.updateDependentMenus}" immediate="true" onchange="this.form.submit();" > <f:selectItems value="#{Bean.typesOfRendering}" /> </h:selectOneMenu><br /> <h:selectOneMenu id="iWillReturnYouZeroAnyway" value="#{Bean.currentItem}" rendered="#{Bean.rendered}" > <f:selectItems value="#{Bean.items}" /> </h:selectOneMenu><br /> <h:commandButton action="#{Bean.store}" value="#Store" /> However, if I remove "rendered" attribute from the second menu, everything works properly, except for displaying the menu for all the time that I try to prevent, so I suggest the problem is in behavior of dynamic rendering. The initial value of isRendered is false because the default item in first menu is "don't render second menu". When I change value in first menu and update isRendered with valueChangeListener, the second menu displays but it doesn't initialize currentItem while submitting. Some code from my backing bean is below: public void updateDependentMenus(ValueChangeEvent value) { String newValue = (String) value.getNewValue(); if ("render second menu" == newValue){ isRendered = true; } else { isRendered = false; } } public String store(){ System.out.println(currentItem); return "stored"; }

    Read the article

  • Why does ICEfaces send dispose-window request on page unload when using view-scoped bean?

    - by woflrevo
    in our application ICEfaces always sends a dispose-window request just before navigating to another JSF Page. as much as i understand this should not happen when having org.icefaces.lazyWindowScope set to true and there is no window-scoped bean involved in current request. but it happens on each link and makes our UI less responsive. but we don't have any window-scoped bean in our application. is that a bug in icefaces that the dispose request is sent when using view-scoped beans? Is it possible to disable? ViewScope is defined in JSF not in ICEfaces, it should work without this dispose request i guess... @ManagedBean(name="viewScopeBean") @ViewScoped public class ViewScopeBean { public void doSomething(){ // } } And here the example jsf: <ice:form> <ice:commandButton value="doSomething" action="#{viewScopeBean.doSomething}"/> <h:link outcome="index" value="Link to same page"/> </ice:form> To reproduce do the following using the code above: open firebug's net tab and activate persist option click doSomething-Button click "link to same page" = dispose-window will be send before navigation Dispose Request Parameters: ice.submit.type=ice.dispose.window ice.window=4guthcbue javax.faces.ViewState=-8138151632882151449%3A-6709064564386098402 Environment: ICEfaces-EE 2.0.0.GA ICEpush-EE 2.0.0.GA Mojarra 2.1.1 JRockit 1.6.0_22 WebLogic Server 10.3.4.0 ICEfaces Configuration: org.icefaces.render.auto: true [default] org.icefaces.autoid: true [default] org.icefaces.aria.enabled: true [default] org.icefaces.blockUIOnSubmit: false [default] org.icefaces.compressDOM: false [default] org.icefaces.compressResources: true [default] org.icefaces.connectionLostRedirectURI: /pages/main.jsf org.icefaces.deltaSubmit: false [default] org.icefaces.lazyPush: true [default] org.icefaces.sessionExpiredRedirectURI: /pages/main.jsf org.icefaces.standardFormSerialization: false [default] org.icefaces.strictSessionTimeout: false [default] org.icefaces.windowScopeExpiration = 1000 [default] org.icefaces.mandatoryResourceConfiguration: null [default] org.icefaces.uniqueResourceURLs: true [default] org.icefaces.lazyWindowScope: true [default] org.icefaces.disableDefaultErrorPopups: false [default]

    Read the article

  • JSF submit dataTable and openpopup window after? is this possible?

    - by raimun
    Is it possible to just submit a dataTable instead of the entire form and then open a popupwindow after the submit? My dataTable has textboxes in it and the popup window is actually dependent on the data/values found in these textboxes. Since the user can change the values of the textboxes, I am required to get the latest values from the dataTables before the popup is opened. the popup is opened through a button found in each row of the datatable. i am using JSF2. thanks.

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >