Search Results

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

Page 19/28 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • How to persist a cookie?

    - by user246114
    Hi, I am creating a cookie in a jsp script, which is located at: www.myproject.com/login/index.jsp if I restart the browser and navigate there, all works well, I can see the cookie persist. If I navigate to: www.myproject.com I am not seeing the cookie. Do I need to set something in the cookie path or domain to make the cookie visible to the entire [myproject.com] domain (I just want to access the cookie from whatever sub path the user may be on). I am creating the cookie like: Cookie c = new Cookie("thisisatest", "foo"); c.setMaxAge(60 * 24 * 3600); response.addCookie(c); Thanks

    Read the article

  • Servlet as Proxy via https

    - by khiem77
    Hi i tried to implement a servlet with servlet (in tomcat 6) which act as as a proxy (for browser), it takes the parsed url, use apache httpclient to get the result & push it back to the client (browser), with http it works well, doesnt work with https , seems the problem concerns unsupported CONNECT method in servlet-api & servlet even doesn't see the request is there any solution/workaround for this? thanx in advanced

    Read the article

  • Beginner servlet question: accessing files in a .war, which path?

    - by Navigateur
    When a third-party library I'm using tries to access a file, I'm getting "Error opening ... file ... (No such file or directory)" even though I KNOW the file is in the WAR. I've tried both packaged (.war) and "exploded" (directory) deployment, and the file is definitely there. I've tried setting full permissions on it too. It's on Unix (Ubuntu). File is war/dict/index.sense and the error is "dict/index.sense (No such file or directory)". It works fine on my Windows computer when running in hosted mode as a GWT app from Eclipse, just not when I transfer it to the Unix machine for deployment. My question is: has anybody experienced this before and/or are there differences in relative path that I should consider i.e. what's the root path for relative file access in a war?

    Read the article

  • Can a plain servlet be configured to as a seam component?

    - by stacker
    I created a plain servlet within a seam-gen (2.1.2) application, now I would like to use injection. Thus I annotated it with @Name and it's recognized as component: INFO [Component] Component: ConfigReport, scope: EVENT, type: JAVA_BEAN, class: com.mycompany.servlet.ConfigReport Unfortunatly the injection of the logger doesn't work NullPointerException in init() import org.jboss.seam.annotations.Logger; import org.jboss.seam.annotations.Name; import org.jboss.seam.log.Log; @Name("ConfigReport") public class ConfigReport extends HttpServlet { @Logger private Log log; public void init(ServletConfig config) throws ServletException { log.info( "BOOM" ); } } Is my approach abusive? What would be the alternatives (the client sending requests to the servlet is curl, not a browser)?

    Read the article

  • How do I use jquery to both download & delete files dynamically from servlet

    - by Adam
    Is it possible to a jquery $.get() to call a servlet and use it to both download a file or update the page without reloading the page? (Or more basically, can I download a file without reloading the page?) For example, I am using a servlet that either returns a file to download of mimetype "application/octet-stream", or returns text to be update in the page of type "text/html". I can write a form with a submit, but then it reloads the page, so I've been trying to use $.get()... but the download doesn't work. <script type="text/javascript"> jQuery(document).ready(function(){ $("#handleFileOptions button").button(); }); function handleFilesSubmit(requestType) { $.get('FileServlet', {filename: $('#radioFileList input:radio:checked').button("widget").text(), requestType: requestType}, function(data){ ...?... }); } </script> In the html: <div id = "handleFiles"> <div id ="radioFileList"> <div id="radioFileList"> <input value="file0.txt" type="radio" id="fileitem0><label for="fileitem0">file0.txt</label> <input value="file1.txt" type="radio" id="fileitem1><label for="fileitem0">file1.txt</label> </div> </div> <div id="handleFileOptions"> <button id="handleFileOption0" onclick="handleFilesSubmit('Download')">Download</button> <button id="handleFileOption1" onclick="handleFilesSubmit('Delete')">Delete</button> </div> </div>

    Read the article

  • Simple Java web application on Tomcat

    - by EugeneP
    If we only need to graphically authorize a user, view a few tables representation (from database), ability to change data in the database visually what tools to use to write such a web application that will run on Tomcat? What framework allows to do that in the most straightforward, easy-to-manage and elegant way?

    Read the article

  • Filter---after setting attribute--->Servlet---after getting and setting the attribute---->Jsp How do I do this?

    - by Y.E.P
    This is what I want to do : A servlet is called.Before a servlet is called , the request is intercepted by a filter. Filter gets some details out from the request,sets them as an attribute and the forwards it to a servlet via chain.doFilter(request,response). Request finally reaches the servlet. Servlet gets the attribute set by the filter before and sets a new attribute by another name. Then it forwards it to some jsp page where the page gets the attribute and processes it. How do I do this ? I know how to write a filter and a servlet but how do I forward it to a jsp page from the servlet or is there any other way to achieve this ?

    Read the article

  • displaying a physical webpage with frames in iframe

    - by ksa
    i have iframe in my webpage, i have done the coding part for browsing the folders and viewing files in iframe.each folder has a index.html.now i need to display the index.html in iframe.index.html page contains frames divided into 2,each from different sources.i tried to display a sample webpage without frames and it was a success,page with frames spoils the party. my code for getting the html file <% String path=request.getParameter("name"); File directory = new File(path); FileFilter fileFilter=new FileFilter() { @Override public boolean accept(File file) { return file.getName().endsWith("html"); } }; File[] files = directory.listFiles(fileFilter); for (int index = 0; index < files.length; index++) { String s= files[index].getName(); String s1=files[index].getAbsolutePath(); %> <a href="fileview?name=<%=s1%>" target="sss"><%=s%></a> <% } %> mycode for displaying the page in iframe. public void doGet(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException { res.setContentType("text/html"); PrintWriter out=res.getWriter(); String name=req.getParameter("name"); res.setHeader("Content-Disposition", "inline; filename=\""+name+"\""); java.io.FileInputStream fis=new java.io.FileInputStream(name); int i; while((i=fis.read())!=-1) { out.write(i); } fis.close(); out.close(); }

    Read the article

  • ByteArrayOutputStream to PrintWriter (Java Servlet)

    - by Thomas
    Writing generated PDF (ByteArrayOutputStream) in a Servlet to PrintWriter. I am desperately looking for a way to write a generated PDF file to the response PrintWriter. Since a Filter up the hierarchy chain has already called response.getWriter() I can't get response.getOutputStream(). I do have a ByteArrayOutputStream where I generated the PDF into. Now all I need is a way to output the content of this ByteArrayOutputStream to the PrintWriter. If anyone could give me a helping hand would be very much appreciated!

    Read the article

  • the PrintWriter servlet Buffer and displayind data from a jsp

    - by nabilaloui
    Hello all, I need really your help please. What I do is to build a table in html tags in my servlet then when trying to send this table to a servlet for the display using: Response.sendRedirect this did not work. I have an error but I don't know the cause. I search to how do it since I use: response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<...");.... thinks a lot for your help

    Read the article

  • How do you send an array as part of an (jquery) ajax request

    - by Ankur
    I tried to send an array as part of an ajax request like this: var query = []; // in between I add some values to 'query' $.ajax({ url: "MyServlet", data: query, dataType: "json", success: function(noOfResults) { alert(noOfResults); } }); } I wanted to see what I get back in the servlet, so I used this line: System.out.println(request.getParameterMap().toString()); Which returned {} suggesting an empty map. Firebug tells me I am getting a 400 bad request error If I send a queryString like attribute=value as the 'data' then everything works fine, so it has to do with not being able to send an array as is. What do I have to do to get that data into the servlet for further processing. I don't want to pull it out and turn it into a queryString in the JS if I can avoid it. EDIT: I used the .serializeArray() (jQuery) function before sending the data. I don't get the 400 but nothing useful is being sent through.

    Read the article

  • Sending two servlet responses per request

    - by sangi
    Hi, I write, because I can not solve the following problem. I have a servlet that processes some information. In response I put both text and binary content. How do I get two response, then two html page, starting from the same request? is a thing possible? The first response should continue to do what he does now, while the second would appear to make a popup window to save an image. There are easier ways to achieve the same result? Many thanks in advance

    Read the article

  • How to invoke a Servlet (doGet) in a web application on startup?

    - by Dan
    I need to invoke a Servlet on application startup since it contains some application initialization logic. I know I can set load-on-startup configuration, but this will only invoke Servlet’s init method. I need to invoke a doGet method and pass some Url parameters to it. Servlet doGet method expects ServletRequest and ServletResponse objects. Also, since this is clustered application, I need to know exactly what node I am accessing (since one option is just to open a socket and invoke a Servlet). What is the best option to perform this?

    Read the article

  • Spring MVC referencing params variable from RequestMapping

    - by NomNomNom
    Hi guys, I have the method below: @RequestMapping(value = "/path/to/{iconId}", params="size={iconSize}", method = RequestMethod.GET) public void webletIconData(@PathVariable String iconId, @PathVariable String iconSize, HttpServletResponse response) throws IOException { // Implementation here } I know how to pass the variable "webletId" from the RequestMapping using the @PathVariable, but how do I reference the variable "iconSize" from params? The same way? Thanks a lot.

    Read the article

  • what is the difference between MVC1 and MVC2

    - by Alaa
    I am using MVC design pattern in jsp-servlet web application, and want to what is the exact difference between MVC1 and MVC2 , can someone help? EDIT newly I hear that there is 2 versions of using MVC in servlet programming, I hear that in MVC1 there is kind of coupling between controller and view , but in MVC2 they overtake it, if someone know whether this is right or wrong I'll be very thankful.

    Read the article

  • Java Web Application

    - by Mark R
    I am interested in creating a simple web application that will take in user input, convert it to an XML file and send the file to a database. Coding wise I feel I am okay, it is just the general setup and what implementation to use I am a bit unsure of. At the moment I have a JSP page containing a form, the user fills out the form and on submit a get method is sent to a servlet, in the servlet doGet() method the servlet is instantiating a java object and passing it the user inputted data. The java object then writes that data to an XML file and sends it to the database via REST. All I would be interested to know is if this the standard/optimal way of creating such a web application. Any and all feedback is appreciated. Thanks

    Read the article

  • How to connect ejb to hibernate in eclipse and glassfish server?

    - by agiles
    I am newer to ejb and hibernate and don't have any idea to how to link or connect those technologies mentioned above. I have just created individual module for ejb, hibernate and servlet. but I need to pass the data from servlet to ejb and then ejb to hibernate and store into MySql database. Problem for me, how to connect ejb to hibernate. I tried some ways and it couldn't work for me. Please someone help me. Thank you

    Read the article

  • Dynamic Image Caching with Java

    - by zteater
    I have a servlet with an API that delivers images from GET requests. The servlet creates a data file of CAD commands based on the parameters of the GET request. This data file is then delivered to an image parser, which creates an image on the file system. The servlet reads the image and returns the bytes on the response. All of the IO and the calling of the image parser program can be very taxing and images of around 80kb are rendering in 3-4000ms on a local system. There are roughly 20 parameters that make up the GET request. Each correlates to a different portion of the image. So, the combinations of possible images is extremely large. To alleviate the loading time, I plan to store BLOBs of rendered images in a database. If a GET request matches one previously executed, I will pull from cache. Else, I will render a new one. This does not fix "first-time" run, but will help "n+1 runs". Any other ideas on how I can improve performance?

    Read the article

  • gmail app 504 server timeout

    - by Hui
    this is the part of code I use for getting info from gmail, it's working alright on my localhost, but somehow when i deploy it online, I got 504 gateway timeout error. Did I missed something in my code? can someone give some advices , thanks a lot public class GetGmail { static String last = null; public static ArrayList run(String username, String password, String lastloggin)throws Exception { ArrayList result = null; System.out.println("Getting Gmail......"); last = lastloggin; Properties props = System.getProperties(); props.setProperty("mail.store.protocol", "imaps"); try { Session session = Session.getDefaultInstance(props, null); Store store = session.getStore("imaps"); store.connect("imap.googlemail.com", username, password); result = readMessage(store); store.close(); } catch (NoSuchProviderException e) { e.printStackTrace(); return null; } catch (MessagingException e) { e.printStackTrace(); return null; } return result; } }

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >