Search Results

Search found 1589 results on 64 pages for 'servlet'.

Page 53/64 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • How to send exceptions to exceptionController?

    - by ivar
    <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="mappedHandlers"> <set> <ref bean="exceptionController" /> </set> </property> <property name="defaultErrorView" value="tiles/content/error" /> </bean> I'm trying to send exceptions to a controller so I can create a redirect. If I comment out the mappedHandlers part then the error tile is displayed but it is only a tile. The rest of the tiles load normally. I need to make a redirect in the controller so I can show an error page not just an error tile. I can't find enough information or an example how the exception invokes some method in exceptionController.

    Read the article

  • Thread Code...anything wrong with this, must use java 1.4

    - by bmw0128
    I have a servlet automatically firing up when the app server starts, and in its init(), I'm making another thread: init(){ new FooThread() } in FooThread(), i want to periodically check the status of a DB value, then depending on the value, make a web service call. When these two tasks complete, I want the thread to sleep to wait a certain period then repeat. This cycle would just continue forever. FooThread: public class FooThread implements Runnable{ Thread t; FooThread(){ t = new Thread(this, "BBSThread"); logger.info("*** about to start " + t.getName()); t.start(); logger.info("*** started: " + t); } public void run() { try{ while(true){ //do the db check, then conditionally do the web services call logger.info("*** calling sleep() ***"); Thread.sleep(50000); logger.info("*** now awake ***"); } } catch (InterruptedException e) { System.out.println("*** FooThread interrupted"); } } }

    Read the article

  • JSP::Confused with the session objects

    - by Legend
    I just started exploring Java Servlets and JSP and am a little confused about the sessions object. Inside a servlet I have this: public class SampleServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(true); session.setAttribute("_session", "_value"); response.sendRedirect("page2.jsp"); } } Now, inside page2.jsp, there is a session object as well, but when I do this <% out.print(session.getAttribute("_session")) %> it gives me an error. Can someone tell me the right way of doing this? As to what I am trying to do, I want to share some session variables.

    Read the article

  • Maven + Tomcat acceleration

    - by Bar
    I am writing a web application with Maven in the Eclipse IDE, and use Tomcat servlet container. So, I run Maven like this: mvn clean compile. It is reasonable that after this oepration I must re-run Tomcat so it can reinitialize the context (Sysdeo Tomcat launcher helps a lot). The problem is Maven execution and subsequebt Tomcat re-running takes noticable amount of time (like 10+ seconds for Maven and 20+ sec. for Tomcat, because of logging, Hibernate mappings, etc.) every time I do it. Is there any automated and more faster solution for these two operatioins? As I see it, a way better solution can be moving re-compiled classes only to the target dir.

    Read the article

  • How to load an entity by a key other than primary key?

    - by stacker
    In a customized servlet (seam 2.1.2) this works fine TableNameHome tableNameHome = (TableNameHome) Component.getInstance( "tableNameHome " ); tableName entity = tableNameHome.getInstance(); entity.setXXX(); tableNameHome.persit(); However this one fails: entityManager = tableNameHome .getEntityManager(); Query query = entityManager.createQuery( "SELECT b FROM tablename b WHERE b.box_id = :key2nd" ); query.setParameter( "key2nd", value); List results = query.getResultList(); and leads to this error message: org.hibernate.hql.ast.QuerySyntaxException: tablename is not mapped [SELECT b FROM tablename b WHERE b.key2nd = :key2nd] In EJB 2.1 I could implement other finder-methods. EntityHome.find() searches only by primary key. What do I need to do in order to query by a different criteria than primary key?

    Read the article

  • receive a responseText in ajax but without div tag

    - by kawtousse
    Hi everyone I want to know if there is any other way whithout using a div tag to receive response html when sending parameter whith ajax. I'am asking because when iam building the select in other servlet and returning the result to jsp it receive the responsehtml in a div tag when we use the famous: x = xhr.responseText; document.getElementById('param').innerHTML = x; with param is the id of div tag. Note: this works fine when populating ddl but its constraint are multiple for my case. Thinks.

    Read the article

  • Best way to notify several java applets/applications of a change on a server

    - by Dustin
    I need to know the best (fastest) way to have a server (preferably a php based one, but a jsp/servlet one could be set up as well using google app engine) notify several java applets/applications that a change has occurred to the data. The way i am picturing this to work will be very similar to that of the way i think an online java game (like Runescape) works User 1: Changes data on server. Server: returns success to User 1, notifies connected computers of change. Connected Computer 1: processes change, returns success to server. Connected Computer 2: processes change, returns success to server. Connected Computer 3: processes change, returns success to server. Connected Computer 4: processes change, returns success to server. I am hoping to have this entire process complete in half a second, and not involve polling as there will be long durations of nothing, followed by a sudden moment where 4 events happen in succession.

    Read the article

  • MySQL Connection Error with JSP

    - by voidmain
    Hello, I am trying to connect to mysql database from jsp page. The connection code is as below InitialContext ic=new InitialContext(); DataSource ds=(DataSource)ic.lookup("jdbc:mysql://localhost:3306/"); Connection con=ds.getConnection(); Statement stmt = con.createStatement(); when i open the page i get the following error javax.servlet.ServletException: javax.naming.NamingException: Lookup failed for 'jdbc:mysql://localhost:3306/' in SerialContext [Root exception is javax.naming.NameNotFoundException: jdbc:mysql:] can some one please tell me what is wrong with this...

    Read the article

  • On Linux do people chroot a Java Web Application or use IPTables and run as non-root?

    - by Adam Gent
    When you run a Java Servlet Container that you would like to serve both static and dynamic content on port 80 you have the classic question of whether to run the server as: As root in hopefully a chroot jail if you can (haven't gotten this working yet) As a non root user and then use IPTables to forward port 80 to some other port (1024) that the container is running on Both: As a non root user, IPTables, and chroot jail. The problem with opt. 1 is the complexity of chrooting and still the security problems of running root.The problem with opt. 2 is that each Linux distro has a different way of persisting IPTables. Option 3 of course is probably idea but very hard to setup. Finally every distro has the annoying differences in daemon scripts. What do people find as the best distro agnostic solution and are there resources to show how to do this?

    Read the article

  • How can we compute the LAST page with JPA?

    - by Kevin
    I would like to implement pagination in my Servlet/EJB/JPA-Hibernate project, but I can't figure out how only one page from the query and know the number of pages I must display I use setFirstResult(int first) ; setMaxResults(int max) ; and that's working alright, but how can I know how many pages I will have in total? (Hibernate is my JPA provider, but I would prefer using only JPA if possible) UPDATE: COUNT() seems to be the better/easiest solution; but what can be the cost of SELECT COUNT(*) FROM ... in comparison with executeQuery("SELECT * FROM ...).getListResult().size() ?

    Read the article

  • the way to get a value from a hidden type correctly

    - by kawtousse
    hey, in a html table i construct in each row an edit buttton like the following: retour.append("<input type=\"hidden\" id=\"id_"+nomTab+"_"+compteur+"\" value=\""+object.getIdDailyTimeSheet()+"\" name=\"hd_"+compteur+"\" />"); this is the hidden type then i do the following: retour.append("<button id=edit name=edit type=button onClick= editarow()>"); retour.append("<img src=edit.gif />"); retour.append("</button>"); retour.append("</td>"); here i am using the hidden type to differenciate between my rows with it. Now I am trying to get the parameter called here: value=\""+object.getIdDailyTimeSheet() in my servlet to do an update query based on the IdDailyTimeSheet. I didn't untill know find the way to get this value every time i click the edit button (i do its submit with the javascript). thanks for help.

    Read the article

  • Include multiple jars with classpathentry

    - by ripper234
    I have an eclipse's .classpath file that looks like this: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="test"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> <classpathentry kind="lib" path="/libraries/jee/servlet-api.jar"/> <classpathentry kind="lib" path="/libraries/junit/junit-4.6.jar"/> <classpathentry kind="lib" path="/libraries/log4j/log4j-1.2.15.jar"/> </classpath> I'd like to add a whole directory of jars to the classpath - I like eclipse (or more precisely, our ant-based build process that uses .classpath format) to know several jars that reside in a single directory, without specifying them directly. How can I do that?

    Read the article

  • delete a row in html table using a hidden type and javascript

    - by kawtousse
    Hi, I have a table with HTML constructed using my servlet class. When trying to delete a row in this table using a javascript function I must first of all put different id to separate elements.and i resolove it with hidden type like that: retour.append("<td>"); retour.append("<input type=\"hidden\" id=\"id_"+nomTab+"_"+compteur+"\" value=\""+object.getIdDailyTimeSheet()+"\"/>"); retour.append("<button id=\"del\" name=\"del\" type=\"button\" onClick=DeleteARow('+id_"+nomTab+"_"+compteur+"')>"); retour.append("<img src=icon_delete.gif />"); retour.append("</button>"); retour.append("</td>"); As you can see each element has a delete button. What i want to know how can i delete one row. thinks.

    Read the article

  • How to step into the world of J2EE?

    - by Michael Lai
    I am new to J2ee. I have experience in Java core, JSP,Servlet, XML, HTML, What should i learn to step into the world of J2EE? Framework(Spring, Hibernate, Struts)? But the framework is too abstract for me.I saw lots of job post which requires frameworks, some jobs require EJB,JPA. I do not where to start. Any experts can give me hints on that? I found the tutorial of J2EE 5 published by ORACLE is not easy to understand. Too much jargon....

    Read the article

  • URL decoding Japanese characters etc. in Java

    - by DanieL
    I have a servlet that receives some POST data. Because this data is x-www-form-urlencoded, a string such as ???? would be encoded to &#12469;&#12508;&#12486;&#12531;. How would I unencode this string back to the correct characters? I have tried using URLDecoder.decode("encoded string", "UTF-8"); but it doesn't make a difference. The reason I would like to unencode them, is because, before I display this data on a webpage, I escape & to &amp; and at the moment, it is escaping the &s in the encoded string so the characters are not showing up properly.

    Read the article

  • Best way to manage the persistence of a form state, to and from a database

    - by Laurent.B
    In a JSP/Servlet webapp, I have to implement a functionality that allows a user to save or restore a form state, that latter containing for instance some search criteria. In other words, the user must be able to save or restore field values of a form, at any time. On the same page that contains that form, there's also another little form that allows him to name his form state before saving it. Then, later he'll be able to recall that state, via a combobox, and refill dynamically the form with the state he selected. I know how to implement that by hand but I would prefer not to reinvent the wheel then I'd like to know if there are some frameworks managing that kind of functionality ? A mix between JSP taglib, filter class, jQuery or other JavaScript frameworks... My research has not give anything yet. Thank you in advance.

    Read the article

  • How to determine page generation time with Struts 2 ?

    - by Samuel_xL
    I'm using Struts 2 and I'd like to determine the page generation time without an external profiler. I can easily profile the actions execute() method, but I don't know how to include the time spent before (in dispatchers, interceptors...) and after (time taken by the servlet corresponding to the view ("jsp time")). Is there simple way to do this ? And if there isn't, how could I, at least, profile the "jsp time" (maybe a tag I'm not aware of ?) ? I think it would be accurate enough to just take in account action time + jsp time. Thanks.

    Read the article

  • regarding java programming language

    - by giri
    Hi I am java professional since last one year. I am pretty familier with core java and JSP and SERVLET technologies.Now I am hired by a telcom company where java is not used.The question I like to ask here is how to keep java enviornment around me so that I should not be unfamiler with java. As I come from company I get much time to work with java. I like to know any real time projects in java available so that I can work with java also. Please let me know... Thanks in advance

    Read the article

  • A typical lifecycle of a Hibernate object in a web app - ?

    - by EugeneP
    Describe please a typical lifecycle of a Hibernate object (that maps to a db table) in a web app. Suppose, you create a new instance of an object and persist in the db. But during the app lifetime you'll be working on a detached object and finally you need to update it in the database, for example on exit. How does it look like with hibernate and spring? p.s. Can transactions and sessions live between servlet transitions? So that we opened 1 session and use it in all servlets without a need to reopen it?

    Read the article

  • J2ME linking interfaces.

    - by user554031
    Hey guys, I've been working with J2ME for a short while, however I've been unable to find anything regarding my query. I'm wanting to link interfaces, I.E A to B to C. Similar to a card layout. Information on each interface changes based on the choices the user made previously. For example City - Cinema - Cinema Listings. The eventual target is to create a MIDlet that displays information from a database (I understand a midlet needs to connect to a servlet which connects to the DB). Thanks in advance for you're time.

    Read the article

  • External files (css, js) in embedded jetty

    - by user1938185
    With jetty, you can easily produce "html" response importing external file like : <head> <link rel="stylesheet" type="text/css" href="myStyle.css"> <script src="myScript.js"></script> <head> However, where do you put myStyle.css and myScript.js, when jetty is embedded? Especially when the jetty server is a large OpenSource project not written by you? Is there by any chance a nice out.println(???); in the servlet.doGet that would provide the answer, or something similar?

    Read the article

  • JCP.Next - Early Adopters of JCP 2.8

    - by Heather VanCura
    JCP.Next is a series of three JSRs (JSR 348, JSR 355 and JSR 358), to be defined through the JCP process itself, with the JCP Executive Committee serving as the Expert Group. The proposed JSRs will modify the JCP's processes  - the Process Document and Java Specification Participation Agreement (JSPA) and will apply to all new JSRs for all Java platforms.   The first - JCP.next.1, or more formally JSR 348, Towards a new version of the Java Community Process - was completed and put into effect in October 2011 as JCP 2.8. This focused on a small number of simple but important changes to make our process more transparent and to enable broader participation. We're already seeing the benefits of these changes as new and existing JSRs adopt the new requirements. The second - JSR 355, Executive Committee Merge, is also Final. You can read the JCP 2.9 Process Document .  As part of the JSR 355 Final Release, the JCP Executive Committee published revisions to the JCP Process Document (version 2.9) and the EC Standing Rules (version 2.2).  The changes went into effect following the 2012 EC Elections in November. The third JSR 358, A major revision of the Java Community Process was submitted in June 2012.  This JSR will modify the Java Specification Participation Agreement (JSPA) as well as the Process Document, and will tackle a large number of complex issues, many of them postponed from JSR 348. For these reasons, the JCP EC (acting as the Expert Group for this JSR), expects to spend a considerable amount of time working on. The JSPA is defined by the JCP as "a one-year, renewable agreement between the Member and Oracle. The success of the Java community depends upon an open and transparent JCP program.  JSR 358, A major revision of the Java Community Process, is now in process and can be followed on java.net. The following JSRs and Spec Leads were the early adopters of JCP 2.8, who voluntarily migrated their JSRs from JCP 2.x to JCP 2.8 or above.  More candidates for 2012 JCP Star Spec Leads! JSR 236, Concurrency Utilities for Java EE (Anthony Lai/Oracle), migrated April 2012 JSR 308, Annotations on Java Types (Michael Ernst, Alex Buckley/Oracle), migrated September 2012 JSR 335, Lambda Expressions for the Java Programming Language (Brian Goetz/Oracle), migrated October 2012 JSR 337, Java SE 8 Release Contents (Mark Reinhold/Oracle) – EG Formation, migrated September 2012 JSR 338, Java Persistence 2.1 (Linda DeMichiel/Oracle), migrated January 2012 JSR 339, JAX-RS 2.0: The Java API for RESTful Web Services (Santiago Pericas-Geertsen, Marek Potociar/Oracle), migrated July 2012 JSR 340, Java Servlet 3.1 Specification (Shing Wai Chan, Rajiv Mordani/Oracle), migrated August 2012 JSR 341, Expression Language 3.0 (Kin-man Chung/Oracle), migrated August 2012 JSR 343, Java Message Service 2.0 (Nigel Deakin/Oracle), migrated March 2012 JSR 344, JavaServer Faces 2.2 (Ed Burns/Oracle), migrated September 2012 JSR 345, Enterprise JavaBeans 3.2 (Marina Vatkina/Oracle), migrated February 2012 JSR 346, Contexts and Dependency Injection for Java EE 1.1 (Pete Muir/RedHat) – migrated December 2011

    Read the article

  • org.apache.sling.scripting.jsp.jasper.JasperException: Unable to load tag handler class [migrated]

    - by Babak Behzadi
    I'm developing an Apache Sling WCMS and using java tag libs to rendering some data. I defined a jsp tag lib with following descriptor and handler class: TLD file contains: <?xml version="1.0" encoding="UTF-8"?> <taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"> <tlib-version>1.0</tlib-version> <short-name>taglibdescriptor</short-name> <uri>http://bob/taglibs</uri> <tag> <name>testTag</name> <body-content>tagdependent</body-content> <tag-class>org.bob.taglibs.test.TestTagHandler</tag-class> </tag> </taglib> Tag handler class: package org.bob.taglibs.test; import javax.servlet.jsp.tagext.TagSupport; public class TestTagHandler extends TagSupport{ @Override public int doStartTag(){ try { pageContext.getOut().print("<h1>Helloooooooo</h1>"); } catch(Exception e) { return SKIP_BODY; } return EVAL_BODY_INCLUDE; } } I packaged the tag lib as BobTagLib.jar and deployed it as a bundle using Sling Web Console. I used this tag lib in a jsp page deployed in my Sling repository: index.jsp: <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib prefix="bob" uri="http://bob/taglibs" %> <html> <head><title>Simple jsp page</title></head> <body> <bob:testTag/> </body> </html> Calling the page cause the following exception: org.apache.sling.scripting.jsp.jasper.JasperException: /apps/TagTest/index.jsp(7,5) Unable to load tag handler class "org.bob.taglibs.test.TestTagHandler" for tag "bob:testTag" ... Can any one get me a solution? In advance, any help is apreciated.

    Read the article

  • Oracle Utilities Application Framework V4.2.0.0.0 Released

    - by ACShorten
    The Oracle Utilities Application Framework V4.2.0.0.0 has been released with Oracle Utilities Customer Care And Billing V2.4. This release includes new functionality and updates to existing functionality and will be progressively released across the Oracle Utilities applications. The release is quite substantial with lots of new and exciting changes. The release notes shipped with the product includes a summary of the changes implemented in V4.2.0.0.0. They include the following: Configuration Migration Assistant (CMA) - A new data management capability to allow you to export and import Configuration Data from one environment to another with support for Approval/Rejection of individual changes. Database Connection Tagging - Additional tags have been added to the database connection to allow database administrators, Oracle Enterprise Manager and other Oracle technology the ability to monitor and use individual database connection information. Native Support for Oracle WebLogic - In the past the Oracle Utilities Application Framework used Oracle WebLogic in embedded mode, and now, to support advanced configuration and the ExaLogic platform, we are adding Native Support for Oracle WebLogic as configuration option. Native Web Services Support - In the past the Oracle Utilities Application Framework supplied a servlet to handle Web Services calls and now we offer an alternative to use the native Web Services capability of Oracle WebLogic. This allows for enhanced clustering, a greater level of Web Service standards support, enchanced security options and the ability to use the Web Services management capabilities in Oracle WebLogic to implement higher levels of management including defining additional security rules to control access to individual Web Services. XML Data Type Support - Oracle Utilities Application Framework now allows implementors to define XML Data types used in Oracle in the definition of custom objects to take advantage of XQuery and other XML features. Fuzzy Operator Support - Oracle Utilities Application Framework supports the use of the fuzzy operator in conjunction with Oracle Text to take advantage of the fuzzy searching capabilities within the database. Global Batch View - A new JMX based API has been implemented to allow JSR120 compliant consoles the ability to view batch execution across all threadpools in the Coherence based Named Cache Cluster. Portal Personalization - It is now possible to store the runtime customizations of query zones such as preferred sorting, field order and filters to reuse as personal preferences each time that zone is used. These are just the major changes and there are quite a few more that have been delivered (and more to come in the service packs!!). Over the next few weeks we will be publishing new whitepapers and new entries in this blog outlining new facilities that you want to take advantage of.

    Read the article

  • How-to logout from ADF Security

    - by frank.nimphius
    Normal 0 false false false EN-US X-NONE X-NONE /* 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:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} ADF Security configures an authentication servlet, AuthenticationServlet, in the web.xml file that also provides a logout functionality. Developers can invoke the logout by a redirect performed from an action method in a managed bean as shown next  public String onLogout() {   FacesContext fctx = FacesContext.getCurrentInstance();   ExternalContext ectx = fctx.getExternalContext();   String url = ectx.getRequestContextPath() +              "/adfAuthentication?logout=true&end_url=/faces/Home.jspx";       try {     ectx.redirect(url);   } catch (IOException e) {     e.printStackTrace();   }   fctx.responseComplete();   return null; } To use this functionality in your application, change the Home.jspx reference to a public page of yours that the user is redirected to after successful logout. Note that for a successful logout, authentication should be through form based authentication. Basic authentication is known as browser sign-on and re-authenticates users after the logout redirect. Basic authentication is confusing to many developers for this reason.

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >