Search Results

Search found 696 results on 28 pages for 'servlets'.

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

  • Asynchronous Processing = Spanning Threads = Valid?

    - by jens
    Hello Experts, am I allowed (without any sideeffects) to create and start a new Thread() from within a doGet() Method of a servlet? Or does this somehow leak ressources? Is it valid to also pass the "Session" Object into the Thread to later save the result of my asynchronous processing (I will synchronized correctly) in the session? Or will this leak ressources when using the session "in indepedant threads"? = What would happen if the session meanwhile would be expired by the webcontainer as it has timedout and I will access it from my thread? Or would could this also lead to the sideffect, that storing the session in the thread will prevent the webcontainer from expiring the session at all (and therefore finally leak ressources as the sessions do not get cleared up)? (I know there are other Solutions, like working with DB-(Job)Records, JMS or Servlets 3.0) but I need so solve the problem as described by spanning a new Thread within doGet.) Thank you very much!! Jens

    Read the article

  • Porting from GAE to TomCat or another servlet server

    - by bach
    Hi guys, I'm unhappy from GAE because - One can't have a global variable and the 'synchronize' keyword. Instead one have to catch a basically DB transcational exception and retry in a while loop - which will eat all my free CPU time and will start costing me money as I reach the google's qouata. Is it safe to use synchronize inside a doPost() in tomcat? (i guess that it's ok as long as all the servlets are running on on 1 VM?). If not in all tomcat configurations, how do I configure tomcat to make it safe? How can I convert a GAE app to my own tomcat server? - How to install DataNucleus Access Platform on tomcat? Best regards

    Read the article

  • Websites using JEE

    - by Rob
    Hi guys, I have a simple question, but I can't find out the answer. I'm wondering if we can see that a website is built using the JEE technology, or servlets/JSP. I think it could be possible to look for specials pages from the server (404, wrong parameters, ...) in some cases, but what about the everyday use ? In fact, I look for a collection of great (or wide used) website using the java technology, and I can't really find a list of these. I'llbe very happy if you can help me with these two small questions

    Read the article

  • Variable 'app' in url-pattern for servlet mapping

    - by Brian
    I'm learning Spring MVC (and servlets in general) and following springsource's mvc-ajax example, which uses annotated controller methods. It appears that there is only one url-pattern (in web.xml) mapped to a servlet in that example: /app/* I've deployed the app as a WAR file, and the actual, ugly URL I'm requesting is http://127.0.0.1:8080/org.springframework.samples.mvc.ajax-1.0.0-20100407.233245-1/account. So, it appears that 'app' in '/app/*' is a variable corresponding to 'org.springframework.samples.mvc.ajax-1.0.0-20100407.233245-1', however, it isn't universal because it isn't usable in my own app, and it contradicts my understanding that url-pattern contains the portion of the URL after the app name. So, what is 'app'? Where is it configured?

    Read the article

  • Servlet mapping url patterns

    - by Scobal
    I have the following urls that need mapping to two different servlets. Can anyone suggest a working url-pattern please? vehlocsearch-ws: /ws/vehlocsearch/vehlocsearch /ws/vehavailrate/vehavailratevehlocsearch /ws/vehavailrate/vehavailratevehlocsearch.wsdl vehavailrate-ws: /ws/vehavailrate/vehavailrate /ws/vehavailrate/vehavailratevehavailrate /ws/vehavailrate/vehavailratevehavailrate.wsdl So far I have this, which feels right, but isn't: <servlet-mapping> <servlet-name>vehlocsearch-ws</servlet-name> <url-pattern>*.vehlocsearch*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>vehavailrate-ws</servlet-name> <url-pattern>*.vehavailrate*</url-pattern> </servlet-mapping> Note: I have no control over the incoming urls

    Read the article

  • Website using JEE

    - by Rob
    Hi guys, I have a simple question, but I can't find out the answer. I'm wondering if we can see that a website is built using the JEE technology, or servlets/JSP. I think it could be possible to look for specials pages from the server (404, wrong parameters, ...) in some cases, but what about the everyday use ? In fact, I look for a collection of great (or wide used) website using the java technology, and I can't really find a list of these. I'llbe very happy if you can help me with these two small questions

    Read the article

  • chat website in jsp/servlet

    - by akshay
    I want to devlelop a chat website using JSP/Servlets and Tomcat. I have following questions: Can the website handle load (1000 people at one time) without slowing down? Will it cause the website to slow down? What is the ideal server configuration for this kind of website? Note that I don't have a huge budget to host. How can I implement server push? Will PHP or JSP be ideal for such website?

    Read the article

  • Mimic an HTTPRequest and HTTPResponse object in Java

    - by Ankur
    How do I mimic an HTTPServletRequest and HTTPServletResponse object. The reason is I want to test the behaviour of some servlets. I know JUnit probably provides this functionality but I don't know how to use it (I will learn soon) and need to do this reasonably quickly. HTTPServletRequest and HTTPServletResponse are both interfaces so they can't be instantiated. There is a HttpServletRequestWrapper which implements HttpServletRequest but it doesn't seem to have any setParameter() type methods and HttpServletResponse doesn't seem to have any implementing classes at all. How can I test my code by passing a suitable HttpServletRequest object and then checking that the received HttpServletResponse object matches what I expect?

    Read the article

  • How to manage db connections on server?

    - by simpatico
    I have a severe problem with my database connection in my web application. Since I use a single database connection for the whole application from singleton Database class, if i try concurrent db operations (two users) the database rollsback the transactions. This is my static method used: All threads/servlets call static Database.doSomething(...) methods, which in turn call the the below method. private static /* synchronized*/ Connection getConnection(final boolean autoCommit) throws SQLException { if (con == null) { con = new MyRegistrationBean().getConnection(); } con.setAutoCommit(true); //TODO return con; } What's the recommended way to manage this db connection/s I have, so that I don't incurr in the same problem.

    Read the article

  • inter servlet communication

    - by mithun1538
    Hello everyone, I have two servlets: LoginServlet and MailServlet. LoginServlet queries a mysql table using jdbc to get a string(eMail). What I want is to forward this string to MailServlet which in turn will send an email to that e-mail ID sent by LoginServlet. My question is how do I call and send the variable eMail to MailServlet, from LoginServlet? I thought of creating an instance of the MailServlet as : MailServlet servlet = new MailServlet(); And then use the servlet object to call the function doGet() in MailServlet. But I am feeling that there is some error in this as this is not the right way to call a servlet. So how do I call and pass a variable to MailServlet?

    Read the article

  • How to read in the XML file on a remote website using JSP?

    - by Alex
    Hi, I'm using java servlets and jsp in my application and I need to read the remote XML file and properly render it into HTML and display on a web page...What is the technology used for reading process?Should I use HTTPURLConnection class to read the contents of the xml file or there is some other way? And also,if I use servlet as a controller and JSP as a view,what would be the responsibility of servlet and jsp in this process?Should servlet just read the whole XML file and then just pass the read output to JSP which will just print it and render properly using XSL for example? I really hope to hear from any people who may help, With kind regards

    Read the article

  • How to know any request type with comet in tomcat 6

    - by Alvin
    Hi, I want to create a chat application in Tomcat 6.0, but before allowing any user for chatting I want to authenticate a user or registering its account to the database by passing request to the servlets at the comet Event type Begin. But I don't know how to know about the request type. How can I know a user has already been logged in, or he is making a request for registering his account. How can I know this by implementing CometProcessor interface? Is there any better way to do that task?

    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

  • Java Servlet framework that does things like rencoding images to preferred format etc.

    - by mP
    Are there any frameworks/libraries that provide servlets/filters etc that handle reencoding on the fly of images. interpret the accept headers and output the file, reencoding into the new format if necessary by checking the actual format of the original image file. provide a low and high quality version of an image. re encode an image into new dimensions. width and height parameters might query string parameters. I could create versions of the file in all the formats, at upload time but the seems overkill. I would rather lazily create the rencoded file and stick it in a cache if it gets served again etc.

    Read the article

  • Does every browser open a new HTTPSession

    - by user496934
    I am working on a webbased application which has JSP and servlets. In my application, I am binding some objects to sessions like the following code -- HttpSession session = p_req.getSession(); session.setAttribute(DOWNLOAD_With_WARNINGS, downloadMap); Later I am retrieving them using session.getAttribute. I would like to know if every time I open a new browser does it open a new HTTP session. Because , if I do a setAttribute with some value in one browser instance, that change is visible when I do a getAttribute using the other browser instance.

    Read the article

  • providing a java servlet with information

    - by tom
    Hi, i am new to servlets. I made a simple hello world programme that prints those famous 2 words to the screen when i access the page via a browser using http://localhost:8080/mypath/path... My question is now, how do i provide a servlet with information? Specifically considering the fact that my c# programme calculates a lookup value for a global system, then the "java" servlet processes that and returns a set of results. I have done the reverse thanks to help on here, regarding calling a returned string from the java servlet in c#. However i am not sure how i go about providing the servlet information. Do i pass it via the url? Thank you

    Read the article

  • servlet authentication and further reference to the credentials

    - by user553592
    What I got so far: It all begins with an HTML form which prompts the user for a username and password. From there it post the acquired user/pass to a servlet, GateKeeper. GateKeeper determines if the user/pass combination match any records in the MySQL database. Here is the sql I use: SELECT id FROM Users WHERE username='?' AND password=MD5('?') where the ? indicate information provided the previous HTML form. What I need now: I need some way to store the username and id of the record in the database. GateKeeper redirects the user to a control panel upon success. Therefore, I need a method to reference the username to display simple greetings, etc and also the id so it eliminates unnecessary calls to the database. The control panel may make AJAX calls to Servlets that preform some sort of task to the MySQL database.

    Read the article

  • Where does Tomcat append / to directory paths?

    - by Anonymouse
    Suppose my Tomcat webapps directory looks like this: webapps/ webapps/fooapp/ webapps/fooapp/WEB-INF/ webapps/fooapp/WEB-INF/web.xml webapps/fooapp/bardir/ When I make a GET request for /fooapp/bardir, Tomcat sees that webapps/fooapp/bardir is a directory and sends back a 302 to /fooapp/bardir/ (with a slash at the end). Here is my question: Where in the Tomcat source code does this take place? (I'm looking at 6.0.x but a correct answer for any version would be a great starting point.) The only reference material I can find on this subject is in the Catalina Functional Specifications which states, regarding the Default Servlet: On each HTTP GET request processed by this servlet, the following processing shall be performed: [...] If the requested resource is a directory: If the request path does not end with "/", redirect to a corresponding path with "/" appended so that relative references in welcome files are resolved correctly. However, this functionality does not appear to be in org.apache.catalina.servlets.DefaultServlet; or at least, it's not there exclusively: if I replace the default servlet in web.xml with a servlet whose servlet-class does not exist, directory paths still come back 302 to add the slash, while every other request comes back with an error as expected.

    Read the article

  • unable to implement HTTP Tunneling correctly in order to enable Java rmi calls over internet(and und

    - by Lokesh Kumar
    in my previous question :-How to Setup RMI Server under(NAT/ISP) Now,i m able to start my RMI server by Installing apache Tomcat 6.0 server. i have also installed servlet programs into apache Tomcat server in order to enable HTTP tunneling. my servlet codes:- (1) [SimplifiedServletHandler.java][2] (2) [ServletForwardCommand.java][3] these servlets resides inside :- C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\examples\WEB-INF\classes\ one more thing that i hv added to my CalcultorClient.java program:- try { RMISocketFactory. setSocketFactory(new sun.rmi.transport.proxy .RMIHttpToCGISocketFactory( )); }catch (IOException ignored) { System.out.println("Error :- ignored.getMessage()"); } But,when i try to make client connect with server(under ISP/NAT) i get the following Exception :- RemoteException java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: java.io.IOException: HTTP request failed i don't know the correct reason behind this Exception.. but,i think that i haven't installed or invoke my servlet programs properly on server side. so,can anybody tell me the correct reason behind this error/Exception????? and if u think that it is servlet problem then tell me the correct procedure to run my serlvet program inside tomcat server.

    Read the article

  • Uncaught TypeError: Object [object Object] has no method 'onAdded'

    - by user3604227
    I am using ExtJS4 with Java servlets. I am following the MVC architecture for ExtJS. I am trying a simple example of displaying a border layout but it doesnt work and I get the following error in ext-all.js in the javascript console: Uncaught TypeError: Object [object Object] has no method 'onAdded' Here is my code: app.js Ext.Loader.setConfig({ enabled : true }); Ext.application({ name : 'IN', appFolder : 'app', controllers : [ 'Items' ], launch : function() { console.log('in LAUNCH-appjs'); Ext.create('Ext.container.Viewport', { items : [ { xtype : 'borderlyt' } ] }); } }); Items.js (controller) Ext.define('IN.controller.Items', { extend : 'Ext.app.Controller', views : [ 'item.Border' ], init : function() { this.control({ 'viewport > panel' : { render : this.onPanelRendered } }); }, onPanelRendered : function() { console.log('The panel was rendered'); } }); Border.js (view) Ext.define('IN.view.item.Border',{extend : 'Ext.layout.container.Border', alias : 'widget.borderlyt', title : 'Border layout' , autoShow : true, renderTo : Ext.getBody(), defaults : { split : true, layout : 'border', autoScroll : true, height : 800, width : 500 }, items : [ { region : 'north', html : "Header here..", id : 'mainHeader' }, { region : 'west', width : 140, html : "Its West..", }, { region : 'south', html : "This is my temp footer content", height : 30, margins : '0 5 5 5', bodyPadding : 2, id : 'mainFooter' }, { id : 'mainContent', collapsible : false, region : 'center', margins : '5', border : true, } ] }); The folder structure for the Webcontent is as follows: WebContent app controller Items.js model store view item Border.js ext_js resources src ext_all.js index.html app.js Can someone help me resolve this error? Thanks in advance

    Read the article

  • Post method in Servlet is not being called again after being executed once

    - by SaurabhCsIITKgp
    I am implementing a database based web application using servlets. Now, when I input a parameter using a form in the jsp page, it redirects it to a servlet which subsequently adds the value to the database (the servlet creates a new table if the table doesn't already exist). The creation of the table and the addition of value works fine if the table doesn't already exists. Once it is created however and the parameter is inputted again in the form, the submit button no longer redirects it to the servlet. Nor is the value added to the database. Kindly advise me as to where I am going wrong. Following are the snippets of my code: From the JSP page (/showmanager is the urlpattern of the servlet): <form action="showmanager" method="post"> <h3>Enter name of the show: </h3> <input type="text" name="showname" value=""> <input type="hidden" name="task" value="addshow" /> <input type="button" value="Add Show"> </form> From the servlet (POST method): p rotected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if(request.getParameter("task").equals("addshow")){ this.addShow(request.getParameter("showname")); response.sendRedirect("showmanager.jsp"); } } Method to add in database: protected boolean addShow(String showname){ try{ statement =con.prepareStatement("INSERT INTO showdb10(name) VALUES ('"+showname+"')"); if(statement.executeUpdate()>0){ return true; } } catch(Exception e) { try{ statement =con.prepareStatement("create table showdb10 (id int NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, date varchar(20),time varchar(20), b_total int, o_total int, b_avbl int, o_avbl int, b_price double(10,2), o_price double(10,2), seat_no varchar(20), transaction_id varchar(255), total_sales double(10,2), paymnt_artists double(10,2), paymnt_othr double(10,2), flag varchar(20), PRIMARY KEY(id))"); statement.executeUpdate(); statement =con.prepareStatement("INSERT INTO showdb10(name) VALUES ('"+showname+"')"); if(statement.executeUpdate()>0){ return true; } }catch(Exception e2){} } return false; }

    Read the article

  • problem with running Servlet on Tomcat: InvocationTargetException

    - by Fahim
    Hi, I am new to Tomcat, and trying to run a simple HelloWorld servlet. I have installed Tomcat 6, and Jdk1.6 on Mandriva Linux, set CLASSPATH and JAVA_HOME. I have the following files and directories: $CATALINA_HOME/webapps/MyApp/WEB_INF/classes/TestServlet.class $CATALINA_HOME/webapps/MyApp/WEB_INF/web.xml My web.xml file contains the following: http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5" <description>ZibJana Localization</description> <display-name>ZibJana Localization</display-name> <!-- Define the servlets for this application--> <servlet> <servlet-name>ZibJana</servlet-name> <servlet-class>TestServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ZibJana</servlet-name> <url-pattern>*</url-pattern> </servlet-mapping> But when I try to invoke my servlet with url http://localhost:8080/MyApp, tomcat fails to launch launch the servlet. I checked in the $CATALINA_HOME/logs/catalina.out log-file and found the following error, which occurs every time I start tomcat service. INFO: Deploying web application directory MyApp 16-Mar-2010 12:05:38 AM org.apache.tomcat.util.digester.Digester endElement SEVERE: End event threw exception java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Please let me know where my mistake is. Thanks in advance.

    Read the article

  • passing data from a servlet to javascript code in an Ajax application ?

    - by A.S al-shammari
    I have a simple jsp/servlet application and I want to add AJAX feature to this app. I use JQuery , but it doesn't matter what javascript framework I use. This is my code: <script type="text/javascript"> function callbackFunction(data){ $('#content').html(data); } $('document').ready(function(){ $('#x').click(function() { $.post('/ajax_2/servlet',callbackFunction) }); }); </script> <body> <a href="#" id="x">Increase it</a> <div id="content"></div> </body> </html> Servlet HttpSession session = request.getSession(); Integer myInteger = (Integer)session.getAttribute("myInteger"); if(myInteger == null) myInteger = new Integer(0); else myInteger = new Integer(myInteger+1); session.setAttribute("myInteger", myInteger); response.getWriter().println(myInteger); The Question: I use out.print to transfer data from a servlet to javascript code (ajax code) , but If I have a complex structure such as Vector of Object or something like this , what is the best way to transfer the data? what about an XML file , JSON ? Is there any special jsp/servlets library to transfer data from a servlet to ajax application ? How can I parse this data in callbackFunction ?

    Read the article

  • Flash - Http service bound to a button can be used only once ?

    - by SAKIROGLU Koray
    I have a flex project, in one of the screen of my UI, I create a HTTP service that call a "doGet" J2EE servlet through the GET method; and I bind the service call to a button. The service print log to system.out so I know when it is run. The problem I have is, when I click said button the first time, the servlets do what it is supposed to do, and print the stack to system.out, but if I click another time, nothing happens. Any idea what might be the cause ? Here's the flex code (code and service has been generated by Eclipse flex plugin) <mx:Script> <![CDATA[ protected function button_clickHandler(event:MouseEvent):void { LaunchSimulResult.token = simulation.LaunchSimul(); } ]]> </mx:Script> <mx:Canvas> ... <mx:Button label="Simulation" id="button" click="button_clickHandler(event)"/> .. </mx:Canvas> <mx:CallResponder id="LaunchSimulResult"/> <simulation:Simulation id="simulation" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>

    Read the article

  • How to link different Servlet together?

    - by Harry Pham
    First of all, I did not use Spring MVC. :) :) Just want to get it out first. Now what I have is different JSP pages that making calls to different Servlets. All the pieces work great individually but I kind of need to link them together. If all of jsp pages make GET request then it would be easy, since I would just pass a type via the web address, and on my servlet side, I would just enumerated through all the parameter, determine which type is it, and delegate to the right servlet. But not all jsp pages make GET request, some make POST request via form. Let see example A.jsp $.getJSON('GenericServlet?type=A', ... GenericServlet.java String type = request.getParameter("type"); if(type.equals("A")){ //Somehow delegate to Servlet A (Not sure how to do that yet :)) } but in B.jsp I would have something like this B.jsp <form action="GenericServlet" method="post"> <table border=0 cellspacing=10 cellpadding=0> <tr> <td>User Name:</td> <td><input type="text" name="username" size=22/></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" size=22/></td> </tr> </table> <input type="submit" value="Create User" /> </form> It kind of hard for me to determine in GenericServlet.java that this need to go to servletB

    Read the article

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