Search Results

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

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

  • Problem in getting response from server in jquery

    - by Alvin
    Hello, I'm using $.ajax(options) method to pass the request to server based on username and password, but whenever I try to print the response by XMLHttpRequest object when response gets successful, I'm getting an empty value. $(document).ready(function(){ $("#form").submit(function(){ $.ajax({url:"Chat.jsp",type:"POST",data:$("#form").serialize(),success:function(request) { alert(request.responseText); //This is displaying nothing },error:function(){document.write("YOU can't");}}); }); }); This is what I'm doing in my servlets code after executing query: try { String user = request.getParameter("j_username"); String password = request.getParameter("j_password"); if(user != null && password != null) { String query = "Select * from users where user_name="+"\'"+user+"\'"+"&& user_pass="+"\""+password+"\""; DBCheck db= new DBCheck(); boolean b = db.doExecuteQuery(con.createStatement(),query); response.setHeader("Cache-Control", "no-cache"); if(b) { response.getWriter().println("Username already exits"); } else { response.getWriter().println("Username doesn't exit"); } } } catch(SQLException ex) { ex.printStackTrace(); } } May I know the problem, and how can I fix it?

    Read the article

  • Checking servlet session attribute value in jsp file

    - by Marta
    I have a no framework java application. It consists of jsp files for view and servlets for the business logic. I must set the user session is the servlet with a firstName parameter. In the jsp file, I need to check if my firstName parameter has a value or not. If the firstName parameter is set, I need to display some html in the jsp file. If it is not set, I need to display different html in the jsp file. Servlet.java: HttpSession session = request.getSession(); session.setAttribute("firstName", customer.getFristName()); String url = "/index.jsp"; RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url); dispatcher.forward(request, response); header.jsp: // Between the <p> tags bellow I need to put some HTML with the following rules // If firstName exist: Hello ${firstName} <a href="logout.jsp">Log out</a> // Else: <a href="login.jsp">Login</a> or <a href="register.jsp">Register</a> <p class="credentials" id="cr"></p> What would be the best way to do this? Any help is much appreciated! Thank you in advance. -Marta

    Read the article

  • Why is no encoding set in reponse by tomcat? How can I deal with it?

    - by Dishayloo
    I had recently a problem with encoding of websites generated by servlet, that occured if the servlets were deployed under tomcat, but not under jetty. I did a little bit of research about it and simplified the problem to the following servlet: public class TestServlet extends HttpServlet implements Servlet { @Override public void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/plain"); Writer output = response.getWriter(); output.write("öäüÖÄÜß"); output.flush(); output.close(); } } If I deploy this under Jetty and direct the browser to it, it returns the expected result. The data is returned as ISO-8859-1 and if I take a look into the headers, then Jetty returns: Content-Type: text/plain; charset=iso-8859-1 The browser detects the encoding from this header. If I deploy the same servlet in a tomcat, the browser shows up strange characters. But Tomcat also returns the data as ISO-8859-1, the difference is, that no header tells about it. So the browser has to guess the encoding, and that goes wrong. My question is, is that behaviour of tomcat correct or a bug? And if it is correct, how can I avoid this problem? Sure, I can always add response.setCharacterEncoding("UTF-8"); to the servlet, but that means I set a fixed encoding, that the browser might or might not understand. The problem is more relevant, if no browser but another service accesses the servlet. So how I should deal with the problem in the most flexible way?

    Read the article

  • Compiling servlets for tomcat

    - by L4N0
    Hello I am trying to modify one of the default files that comes with tomcat SessionExample.java, and trying to compile it but I get an error. javac -classpath "E:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\lib\servlet-api.jar" SessionExample.java Gives me this error SessionExample.java:26: package util does not exist import util.HTMLFilter; ^ SessionExample.java:90: cannot find symbol symbol : variable HTMLFilter location: class SessionExample out.println(HTMLFilter.filter(name) + " = " ^ SessionExample.java:91: cannot find symbol symbol : variable HTMLFilter location: class SessionExample + HTMLFilter.filter(value) + ""); ^ 3 errors Thank you

    Read the article

  • communication between remote servlets

    - by Venkatesh
    I have two web applications say App1 and App2. I want to call a servlet which is in App2 from a servlet in App1. I'm using URLConnection for this. I'm able to pass parameters to the servlet in App2 also and I'm also able to receive response from the servlet as string. But I want to send java objects from the servlet in App2 and receive them in servlet of App1. How to achieve this?

    Read the article

  • Does tomcat compile servlets automatically?

    - by user331633
    When we modify a JSP , we can just overwrite the jsp and tomcat autmatically recompile the servelt asociated to it , but if we want to modify a servlet is enough to modify the .java or we need to deploy the .class too? ( I mean is tomcat capable of compiling the .java into a .class if a .clss is not found or is outdated) The question is if just deploying the .java from svn to the server and restarting tomcat imply that tomcat compile the .java in a .class or we need to deploy the .class too ( and having it in svn too)

    Read the article

  • How to design this ?

    - by Akku
    how can i make this entire process as 1 single event??? http://code.google.com/apis/visualization/documentation/dev/dsl_get_started.html and draw the chart on single click? I am new to servlets please guide me When a user clicks the "go " button with some input. The data goes to the servlet say "Test3". The servlet processes the data by the user and generates/feeds the data table dynamically Then I call the html page to draw the chart as shown in the tutorial link above. The problem is when I call the servlet it gives me a long json string in the browser as given in the tutorials "google.visualization.Query.setResponse({version:'0.6',status:'ok',sig:'1333639331',table:{cols:[{............................" Then when i manually call the html page to draw the chart i am see the chart. But when I call html page directly using the request dispatcher via the servlet I dont get the result. This is my code and o/p...... I need sugession as to how should be my approach to call the chart public class Test3 extends HttpServlet implements DataTableGenerator { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { DataSourceHelper.executeDataSourceServletFlow(request, response, this , isRestrictedAccessMode() ); RequestDispatcher rd; rd = request.getRequestDispatcher("new.html");// it call's the html page which draws the chart as per the data added by the servlet..... rd.include(request, response);//forward(request, response); @Override public Capabilities getCapabilities() { return Capabilities.NONE; } protected boolean isRestrictedAccessMode() { return false; } @Override public DataTable generateDataTable(Query query, HttpServletRequest request) { // Create a data table. DataTable data = new DataTable(); ArrayList<ColumnDescription> cd = new ArrayList<ColumnDescription>(); cd.add(new ColumnDescription("name", ValueType.TEXT, "Animal name")); cd.add......... I get the following result along with unprocessed html page google.visualization.Query.setResponse({version:'0.6',statu..... <html> <head> <title>Getting Started Example</title> .... Entire html page as it is on the Browser. What I need is when a user clicks the go button the servlet should process the data and call the html page to draw the chart....Without the json string appearing on the browser.(all in one user click) What should be my approach or how should i design this.... there are no error in the code. since when i run the servlet i get the json string on the browser and then when i run the html page manually i get the chart drawn. So how can I do (servlet processing + html page drawing chart as final result) at one go without the long json string appearing on the browser. There is no problem with the html code....

    Read the article

  • JQuery uploadify plugin not working

    - by Nitesh Panchal
    Hello, I first used primefaces FileUpload component and it didn't work. Always gave "HTTP Error". So i thought there is some bug with this component and went to plain old JQuery and tried using uploadify. But still i get the same error. I am using Container Managed Security. Is this the reason for not working properly? This is my script :- $(document).ready(function(){ $('#photoInput').uploadify({ 'script' : '/Blogger/fileUploadServlet', 'uploader' : './uploadify/uploadify.swf', 'cancelImg' : './uploadify/cancel.png', 'auto' : true }); And this is my servlet which is never executed :- package Servlets; import java.io.IOException; import java.io.PrintWriter; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; @WebServlet(name = "fileUploadServlet", urlPatterns = {"/fileUploadServlet"}) public class fileUploadServlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, FileUploadException { PrintWriter out = response.getWriter(); try { System.out.println("Executed!!"); boolean isMultipart = ServletFileUpload.isMultipartContent(request); // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // Parse the request List /* FileItem */ items = upload.parseRequest(request); Iterator e = items.iterator(); while(e.hasNext()){ System.out.println(e.next().toString()); } } finally { out.close(); } } } }); Please help me. I am stuck on this since 3 hours.

    Read the article

  • Is this a legitimate implementation of a 'remember me' function for my web app?

    - by user246114
    Hi, I'm trying to add a "remember me" feature to my web app to let a user stay logged in between browser restarts. I think I got the bulk of it. I'm using google app engine for the backend which lets me use java servlets. Here is some pseudo-code to demo: public class MyServlet { public void handleRequest() { if (getThreadLocalRequest().getSession().getAttribute("user") != null) { // User already has session running for them. } else { // No session, but check if they chose 'remember me' during // their initial login, if so we can have them 'auto log in' // now. Cookie[] cookies = getThreadLocalRequest().getCookies(); if (cookies.find("rememberMePlz").exists()) { // The value of this cookie is the cookie id, which is a // unique string that is in no way based upon the user's // name/email/id, and is hard to randomly generate. String cookieid = cookies.find("rememberMePlz").value(); // Get the user object associated with this cookie id from // the data store, would probably be a two-step process like: // // select * from cookies where cookieid = 'cookieid'; // select * from users where userid = 'userid fetched from above select'; User user = DataStore.getUserByCookieId(cookieid); if (user != null) { // Start session for them. getThreadLocalRequest().getSession() .setAttribute("user", user); } else { // Either couldn't find a matching cookie with the // supplied id, or maybe we expired the cookie on // our side or blocked it. } } } } } // On first login, if user wanted us to remember them, we'd generate // an instance of this object for them in the data store. We send the // cookieid value down to the client and they persist it on their side // in the "rememberMePlz" cookie. public class CookieLong { private String mCookieId; private String mUserId; private long mExpirationDate; } Alright, this all makes sense. The only frightening thing is what happens if someone finds out the value of the cookie? A malicious individual could set that cookie in their browser and access my site, and essentially be logged in as the user associated with it! On the same note, I guess this is why the cookie ids must be difficult to randomly generate, because a malicious user doesn't have to steal someone's cookie - they could just randomly assign cookie values and start logging in as whichever user happens to be associated with that cookie, if any, right? Scary stuff, I feel like I should at least include the username in the client cookie such that when it presents itself to the server, I won't auto-login unless the username+cookieid match in the DataStore. Any comments would be great, I'm new to this and trying to figure out a best practice. I'm not writing a site which contains any sensitive personal information, but I'd like to minimize any potential for abuse all the same, Thanks

    Read the article

  • Tomcat/Hibernate Problem "SEVERE: Error listenerStart"

    - by JSteve
    I downloaded working example of hibernate (with maven) and installed it on my tomcat, it worked. Then I created a new web project in MyEclipse, added hibernate support and moved all source files (no jar) to this new project and fixed package/paths wherever was necessary. My servlets are responding correctly but when I add "Listener" in web.xml, tomcat returns error "Error ListenerStart" on startup and my application doesn't start. I've carefully checked all packages, paths and classes, they look good. Error message is also not telling anything more except these two words Here is complete tomcat startup log: 17-Jun-2010 12:13:37 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8810 17-Jun-2010 12:13:37 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 293 ms 17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina 17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/6.0.20 17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardContext start SEVERE: Error listenerStart 17-Jun-2010 12:13:37 PM org.apache.catalina.core.StandardContext start SEVERE: Context [/addressbook] startup failed due to previous errors 17-Jun-2010 12:13:37 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8810 17-Jun-2010 12:13:37 PM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 17-Jun-2010 12:13:37 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/22 config=null 17-Jun-2010 12:13:37 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 446 ms My web.xml is: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <listener> <listener-class>addressbook.util.SessionFactoryInitializer</listener-class> </listener> <filter> <filter-name>Session Interceptor</filter-name> <filter-class>addressbook.util.SessionInterceptor</filter-class> </filter> <filter-mapping> <filter-name>Session Interceptor</filter-name> <servlet-name>Country Manager</servlet-name> </filter-mapping> <servlet> <servlet-name>Country Manager</servlet-name> <servlet-class>addressbook.managers.CountryManagerServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Country Manager</servlet-name> <url-pattern>/countrymanager</url-pattern> </servlet-mapping> </web-app> Can somebody either help me figure out what I am doing wrong? or point to some resource where I may get some precise solution of my problem?

    Read the article

  • Servlet response wrapper has encoding problem

    - by John O
    A servlet response wrapper is being used in a Servlet Filter. The idea is that the response is manipulated, with a 'nonce' value being injected into forms, as part of defence against CSRF attacks. The web app is using UTF-8 everywhere. When the Servlet Filter is absent, no problems. When the filter is added, encoding issues occur. (It seems as if the response is reverting to 8859-1.) The guts of the code : final class CsrfResponseWrapper extends AbstractResponseWrapper { ... byte[] modifyResponse(byte[] aInputResponse){ ... String originalInput = new String(aInputResponse, encoding); String modifiedResult = addHiddenParamToPostedForms(originalInput); result = modifiedResult.getBytes(encoding); ... } ... } As I understand it, the transition between byte-land and String-land should specify an encoding. That is done here, as you can see, in two places. The value of the 'encoding' variable is 'UTF-8'; the alteration of the String itself is standard string manipulation (with a regex), and never specifies an encoding (addHiddenParamToPostedForms). Where am I in error about the encoding? EDIT: Here is the base class (sorry it's rather long): package hirondelle.web4j.security; import javax.servlet.ServletOutputStream; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.PrintWriter; /** Abstract Base Class for altering response content. (May be useful in future contexts as well. For now, keep package-private.) */ abstract class AbstractResponseWrapper extends HttpServletResponseWrapper { AbstractResponseWrapper(ServletResponse aServletResponse) throws IOException { super((HttpServletResponse)aServletResponse); fOutputStream = new ModifiedOutputStream(aServletResponse.getOutputStream()); fWriter = new PrintWriter(fOutputStream); } /** Return the modified response. */ abstract byte[] modifyResponse(byte[] aInputResponse); /** Standard servlet method. */ public final ServletOutputStream getOutputStream() { //fLogger.fine("Modified Response : Getting output stream."); if ( fWriterReturned ) { throw new IllegalStateException(); } fOutputStreamReturned = true; return fOutputStream; } /** Standard servlet method. */ public final PrintWriter getWriter() { //fLogger.fine("Modified Response : Getting writer."); if ( fOutputStreamReturned ) { throw new IllegalStateException(); } fWriterReturned = true; return fWriter; } // PRIVATE /* Well-behaved servlets return either an OutputStream or a PrintWriter, but not both. */ private PrintWriter fWriter; private ModifiedOutputStream fOutputStream; /* These items are used to implement conformance to the javadoc for ServletResponse, regarding exceptions being thrown. */ private boolean fWriterReturned; private boolean fOutputStreamReturned; /** Modified low level output stream. */ private class ModifiedOutputStream extends ServletOutputStream { public ModifiedOutputStream(ServletOutputStream aOutputStream) { fServletOutputStream = aOutputStream; fBuffer = new ByteArrayOutputStream(); } /** Must be implemented to make this class concrete. */ public void write(int aByte) { fBuffer.write(aByte); } public void close() throws IOException { if ( !fIsClosed ){ processStream(); fServletOutputStream.close(); fIsClosed = true; } } public void flush() throws IOException { if ( fBuffer.size() != 0 ){ if ( !fIsClosed ) { processStream(); fBuffer = new ByteArrayOutputStream(); } } } /** Perform the core processing, by calling the abstract method. */ public void processStream() throws IOException { fServletOutputStream.write(modifyResponse(fBuffer.toByteArray())); fServletOutputStream.flush(); } // PRIVATE // private ServletOutputStream fServletOutputStream; private ByteArrayOutputStream fBuffer; /** Tracks if this stream has been closed. */ private boolean fIsClosed = false; } }

    Read the article

  • jqGrid using a servlet to store the data, how to access the data from a different java class

    - by Sam
    I'm using jqGrid for a table input and setting up the url as a servlet which will deal with the GET and POST requests and save the rows to a Java object. I'm using webwork web framework and I was wondering how I can get access to the object that the servlet is saving the data to. One way I have thought of is to just call the GET method from the Java action class which the servlet will return a JSON string with the object data. Is there a better design for doing this? This is probably not too clear so ask questions so I can help get across my point. Thanks

    Read the article

  • Uploading a zip file to a jsp and extract the content in another jsp

    - by sunnyj
    I want to upload a zip file in a jsp page and the user is sent to another jsp page after he selects and uploads the file. In this second page I want to 1.)extract the uploaded zip file. 2.)read some content from the extracted file(s) and allow the user to change/edit them 3.)save the user changes in the files. 4.)zip the files again and save it in another destination. Please suggest me a rough outline of a solution as I am stuck in the phase in which I get the uploaded file and re-direct the user to the second jsp.

    Read the article

  • WebLogic job scheduling

    - by XpiritO
    Hello, overflowers :) I'm trying to implement a WebLogic job scheduling example, to test my cluster capabilities of fail-over on scheduled tasks (to ensure that these tasks are executed on fail over scenario). With this in mind, I've been following this example and trying to configure everything accordingly. Here are the steps I've done so far: Configured a cluster with 1 admin server (AdminServer) and 2 managed instances (Noddy and Snoopy); Set up database tables (using Oracle XE): ACTIVE and WEBLOGIC_TIMERS; Set up data source to access DB and associated it to the scheduling tasks under "Settings for cluster" "Scheduling"; Implemented a job (TimerListener) and a servlet to initialize the job scheduling, as follows: . package timedexecution; import java.io.IOException; import java.io.PrintWriter; import java.io.Serializable; import java.text.SimpleDateFormat; import java.util.Date; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import commonj.timers.Timer; import commonj.timers.TimerListener; import commonj.timers.TimerManager; public class TimerServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected static void logMessage(String message, PrintWriter out){ out.write("<p>"+ message +"</p>"); System.out.println(message); } @Override public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); // out.println("<html>"); out.println("<head><title>TimerServlet</title></head>"); // try { // logMessage("service() entering try block to intialize the timer from JNDI", out); // InitialContext ic = new InitialContext(); TimerManager jobScheduler = (TimerManager)ic.lookup("weblogic.JobScheduler"); // logMessage("jobScheduler reference " + jobScheduler, out); // jobScheduler.schedule(new ExampleTimerListener(), 0, 30*1000); // logMessage("Timer scheduled!", out); // //execute this job every 30 seconds logMessage("service() started the timer", out); // logMessage("Started the timer - status:", out); // } catch (NamingException ne) { String msg = ne.getMessage(); logMessage("Timer schedule failed!", out); logMessage(msg, out); } catch (Throwable t) { logMessage("service() error initializing timer manager with JNDI name weblogic.JobScheduler " + t,out); } // out.println("</body></html>"); out.close(); } private static class ExampleTimerListener implements Serializable, TimerListener { private static final long serialVersionUID = 8313912206357147939L; public void timerExpired(Timer timer) { SimpleDateFormat sdf = new SimpleDateFormat(); System.out.println( "timerExpired() called at " + sdf.format( new Date() ) ); } } } Then I executed the servlet to start the scheduling on the first managed instance (Noddy server), which returned as expected: (Servlet execution output) service() entering try block to intialize the timer from JNDI jobScheduler reference weblogic.scheduler.TimerServiceImpl@43b4c7 Timer scheduled! service() started the timer Started the timer - status: Which resulted in the creation of 2 rows in my DB tables: WEBLOGIC_TIMERS table state after servlet execution: "EDIT"; "TIMER_ID"; "LISTENER"; "START_TIME"; "INTERVAL"; "TIMER_MANAGER_NAME"; "DOMAIN_NAME"; "CLUSTER_NAME"; ""; "Noddy_1268653040156"; "[datatype]"; "1268653040156"; "30000"; "weblogic.JobScheduler"; "myCluster"; "Cluster" ACTIVE table state after servlet execution: "EDIT"; "SERVER"; "INSTANCE"; "DOMAINNAME"; "CLUSTERNAME"; "TIMEOUT"; ""; "service.SINGLETON_MASTER"; "6382071947583985002/Noddy"; "QRENcluster"; "Cluster"; "10.03.15" Although, the job is not executed as scheduled. It should print a message on the server's log output (Noddy.out file) with a timestamp, saying that the timer had expired. It doesn't. My log files state as follows: Admin server log (myCluster.log file): ####<15/Mar/2010 10H45m GMT> <Warning> <Cluster> <test-ad> <Noddy> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1268649925727> <BEA-000192> <No currently living server was found that could host TimerMaster. The server will retry in a few seconds.> Noddy server log (Noddy.out file): service() entering try block to intialize the timer from JNDI jobScheduler reference weblogic.scheduler.TimerServiceImpl@43b4c7 Timer scheduled! service() started the timer Started the timer - status: <15/Mar/2010 10H45m GMT> <Warning> <Cluster> <BEA-000192> <No currently living server was found that could host TimerMaster. The server will retry in a few seconds.> (Noddy.log file): ####<15/Mar/2010 11H24m GMT> <Info> <Common> <test-ad> <Noddy> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1268652270128> <BEA-000628> <Created "1" resources for pool "TxDataSourceOracle", out of which "1" are available and "0" are unavailable.> ####<15/Mar/2010 11H37m GMT> <Info> <Cluster> <test-ad> <Noddy> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1268653040226> <BEA-000182> <Job Scheduler created a job with ID Noddy_1268653040156 for TimerListener with description timedexecution.TimerServlet$ExampleTimerListener@2ce79a> ####<15/Mar/2010 11H39m GMT> <Info> <JDBC> <test-ad> <Noddy> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1268653166307> <BEA-001128> <Connection for pool "TxDataSourceOracle" closed.> Can anyone help me out discovering what's wrong with my configuration? Thanks in advance for your help!

    Read the article

  • PWC1406: Servlet.service() threw exception java.io.IOException: Invalid chunk header When client se

    - by Nivek
    I am developing an application using J2ME to send the GPS coordinates received to the server and i am new to developing client server application. Everything works fine with the use of Nokia N97mini or E71. But when i tried it on HTC HD2, i get the exception from the server. I am using Netbeans 6.5.1 GlassFish V2 as Server. I have no idea why this error occurs only on the HTC HD2. Any help will be greatly appreciated. Thanks... Below is the error message: StandardWrapperValve[FindHospitalServlet]: PWC1406: Servlet.service() for servlet FindHospitalServlet threw exception java.io.IOException: Invalid chunk header at org.apache.coyote.http11.filters.ChunkedInputFilter.doRead(ChunkedInputFilter.java:171) at org.apache.coyote.http11.InternalInputBuffer.doRead(InternalInputBuffer.java:719) at org.apache.coyote.Request.doRead(Request.java:482) at org.apache.coyote.tomcat5.InputBuffer.realReadBytes(InputBuffer.java:342) at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:378) at org.apache.coyote.tomcat5.InputBuffer.readByte(InputBuffer.java:351) at org.apache.coyote.tomcat5.CoyoteInputStream.read(CoyoteInputStream.java:159) at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:320) at java.io.DataInputStream.readUTF(DataInputStream.java:572) at java.io.DataInputStream.readUTF(DataInputStream.java:547) at myPackage.FindHospitalServlet.doPost(FindHospitalServlet.java:28) at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) Below is the code that i wrote to connect to the server: private void connectFindHospServlet() { String url = "http://172.22.190.13:8080/UpdateServlet/FindHospitalServlet"; StringBuffer sb = new StringBuffer(); String info = lat+"!"+lng+"!"; try { HttpConnection c = (HttpConnection) Connector.open(url); c.setRequestProperty("User-Agent","Profile/MIDP-2.0, Configuration/CLDC-1.0"); c.setRequestProperty("Content-Language","en-US"); c.setRequestMethod(HttpConnection.POST); DataOutputStream os = (DataOutputStream)c.openDataOutputStream(); os.writeUTF(info); os.flush(); os.close(); // Get the response from the servlet page. DataInputStream is =(DataInputStream)c.openDataInputStream(); int ch; sb = new StringBuffer(); while ((ch = is.read()) != -1) sb.append((char)ch); is.close(); c.close(); if(sb.toString().charAt(0) == 'n') { formDisplayResultFindHosp(); display.setCurrent(formDisplayResultFindHosp); } else { PlannerMain pm = new PlannerMain(); hospInfo = pm.getFindHospInfo(sb.toString().substring(0, sb.length()-2)); formDisplayResultFindHosp(hospInfo); display.setCurrent(formDisplayResultFindHosp); } } catch (Exception e) { System.out.println("Error recieve find user"); } } Any information needed to better help in understanding the problem, do let me know. I will try to provide as much as possible.

    Read the article

  • Injecting jms resource in servlet & best practice for MDB

    - by kislo_metal
    using ejb 3.1, servlet 3.0 (glassfish server v3) Scenario: I have MDB that listen to jms messages and give processing to some other session bean (Stateless). Servelet injecting jms resource. Question 1: Why servlet can`t inject jms resources when they use static declaration ? @Resource(mappedName = "jms/Tarturus") private static ConnectionFactory connectionFactory; @Resource(mappedName = "jms/StyxMDB") private static Queue queue; private Connection connection; and @PostConstruct public void postConstruct() { try { connection = connectionFactory.createConnection(); } catch (JMSException e) { e.printStackTrace(); } } @PreDestroy public void preDestroy() { try { connection.close(); } catch (JMSException e) { e.printStackTrace(); } } The error that I get is : [#|2010-05-03T15:18:17.118+0300|WARNING|glassfish3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=35;_ThreadName=Thread-1;|StandardWrapperValve[WorkerServlet]: PWC1382: Allocate exception for servlet WorkerServlet com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class ua.co.rufous.server.services.WorkerServiceImpl at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:312) at com.sun.enterprise.web.WebContainer.createServletInstance(WebContainer.java:709) at com.sun.enterprise.web.WebModule.createServletInstance(WebModule.java:1937) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1252) Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Unresolved Message-Destination-Ref ua.co.rufous.server.services.WorkerServiceImpl/[email protected]@null into class ua.co.rufous.server.services.WorkerServiceImpl at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:614) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:384) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:141) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:127) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:306) ... 27 more Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Illegal use of static field private static javax.jms.Queue ua.co.rufous.server.services.WorkerServiceImpl.queue on class that only supports instance-based injection at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:532) ... 31 more |#] my MDB : /** * asadmin commands * asadmin create-jms-resource --restype javax.jms.ConnectionFactory jms/Tarturus * asadmin create-jms-resource --restype javax.jms.Queue jms/StyxMDB * asadmin list-jms-resources */ @MessageDriven(mappedName = "jms/StyxMDB", activationConfig = { @ActivationConfigProperty(propertyName = "connectionFactoryJndiName", propertyValue = "jms/Tarturus"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"), @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") }) public class StyxMDB implements MessageListener { @EJB private ActivationProcessingLocal aProcessing; public StyxMDB() { } public void onMessage(Message message) { try { TextMessage msg = (TextMessage) message; String hash = msg.getText(); GluttonyLogger.getInstance().writeInfoLog("geted jms message hash = " + hash); } catch (JMSException e) { } } } everything work good without static declaration: @Resource(mappedName = "jms/Tarturus") private ConnectionFactory connectionFactory; @Resource(mappedName = "jms/StyxMDB") private Queue queue; private Connection connection; Question 2: what is the best practice for working with MDB : processing full request in onMessage() or calling another bean(Stateless bean in my case) in onMessage() method that would process it. Processing including few calls to soap services, so the full processing time could be for a 3 seconds. Thank you.

    Read the article

  • smartGWT: ListGrid setDataSource on a servlet

    - by itit
    I want to setDataSource of my ListGrid on response received from my java servlet. For example: request = builder.sendRequest(null, new RequestCallback() { public void onResponseReceived(Request request, Response response) { if(200 == response.getStatusCode()) { final ListGrid countryGrid = new ListGrid(); countryGrid.setWidth(300); countryGrid.setHeight(450); countryGrid.setAlternateRecordStyles(true); countryGrid.setShowFilterEditor(true); countryGrid.setFilterOnKeypress(true); countryGrid.setDataSource(Frequenze.getInstance()); countryGrid.setAutoFetchData(true); ListGridField wordField = new ListGridField("word", "Word"); ListGridField frequenceField = new ListGridField("frequence", "Frequece"); countryGrid.setFields(wordField, frequenceField); countryGrid.setDataSource(dataSource); // ?? ... How can I fill the servlet response in the ListGrid?

    Read the article

  • Uploadify plugin doesn't call Java Servlet

    - by sergionni
    Hello,i just started using Uploadify flash plugin instead of standard HTML UI. And met the next problem: when I click "Upload Files" link,that progress is shown and "completed" status is appeared, but in reality - it didn't happened anything,Java Servlet isn't called from backend. There is upload servlet and uploading performed next way earlier: < form enctype="multipart/form-data" method="post" target="uploadFrame" action="<%= request.getContextPath() %>/uploadFile?portletId=${portletId}&remoteFolder=${remoteFolder}">... After providing Uploadify plugin, UI now looks like: plugin part(configuration): <script> ... oScript.text+= "$j('#uploadify').uploadify({"; oScript.text+= "'uploader' : 'kne-portlets/js/lib/uploadify/scripts/uploadify.swf',"; oScript.text+= "'script' : '<%= request.getContextPath() %>/uploadFile?portletId=${portletId}&remoteFolder=<%= decodedString %>',"; oScript.text+= "'cancelImg': 'kne-portlets/js/lib/uploadify/cancel.png',"; oScript.text+= "'folder' : '<%= decodedString %>',"; oScript.text+= "'queueID' : 'fileQueue',"; oScript.text+= "'auto' : false,"; oScript.text+= "'multi' : false,"; //oScript.text+= "'sizeLimit' : 1000"; oScript.text+= "});"; oScript.text+= "});"; ... </script> 'scripts' parameter here points to Java Servlet on backend <%= decodedString %> is folder path, which value is \\file-srv\demo part for uploading: <input type="file" name="uploadify" id="uploadify" /> <a href="javascript:$j('#uploadify').uploadifyUpload();">Upload Files</a> Where is my fault? 'Script' param in plugin config points to Java Servlet on backend and it's done,but Servlet isn't triggered. error, when 'script' param isn't correct:http://img190.imageshack.us/i/errormm.png/ Thank you for assistance.

    Read the article

  • Apache Commons FileUpload Does not behave like expected

    - by Harry Pham
    I just want to assure you guys that before I post this, I have read couple of similar post but none solved my problem. So here it is. I use Ajax taglib for my form since it wont refresh my screen <%@ taglib uri="WEB-INF/taglib.tld" prefix="a" %> <a:AjaxUpload action="UploadServlet"> <input type="file"> <input type="submit" value="Upload"> </a:AjaxUpload> If this is in any confused you guys, then you can think of the above code will create these form, but send request asynchronously. <form action="UploadServlet" enctype="multipart/form-data" method="post"> <input type="file"> <input type="submit"> </form> My first question is, if I add name="file" inside the <input> to make it become like this, <input type="file" name="file">, my servlet will throw an exception. It wont if I take it out. Here is the exception: SEVERE: Servlet.service() for servlet UploadServlet threw exception javax.servlet.ServletException: Servlet execution threw an exception at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:637) My second question is: On the server side, I check the request to see if it is isMultipartContent, and it is. But then when I parseRequest() and store into List<FileItem> items, the items.size() is 0. Here is my Servlet code FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List<FileItem> items = null; if(request.getContentType() != null && request.getContentType().toLowerCase().indexOf("multipart/form-data") > -1){ if(upload.isMultipartContent(request)){ items = upload.parseRequest(request); //It got to here, but items.size is 0. why????????????? } }

    Read the article

  • pass ResultSet from servlet to JSP

    - by Dave
    Hi I am doing the following in my SampleServlet.java //Fill resultset from db ..... try { ArrayList Rows = new ArrayList(); while (resultSet.next()){ ArrayList row = new ArrayList(); for (int i = 1; i <= 7 ; i++){ row.add(resultSet.getString(i)); } Rows.add(row); } request.setAttribute("propertyList", Rows); RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/DisplayProperties.jsp"); requestDispatcher.forward(request,response); # and then in my jsp DisplayPropeties.jsp i have <% ArrayList rows = new ArrayList(); if (request.getSession().getAttribute("propertyList") != null) { rows = (ArrayList ) request.getSession().getAttribute("propertyList"); } %> but rows is allways null. Can anyone help with what I am doing wrong please.

    Read the article

  • javax.servlet.ServletException: Servlet.init() for servlet Relay threw exception

    - by Talha Bin Shakir
    I built application by using Netbeans and its working fine. But When i deployed on TOMCAT I am getting this error javax.servlet.ServletException: Servlet.init() for servlet Relay threw exception org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) java.lang.Thread.run(Thread.java:636) *root cause* java.security.AccessControlException: access denied (java.util.PropertyPermission jasper.reports.compile.class.path write) java.security.AccessControlContext.checkPermission(AccessControlContext.java:342) java.security.AccessController.checkPermission(AccessController.java:553) java.lang.SecurityManager.checkPermission(SecurityManager.java:549) java.lang.System.setProperty(System.java:744) com.servlet.Relay.init(Relay.java:38) javax.servlet.GenericServlet.init(GenericServlet.java:212) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:616) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:269) java.security.AccessController.doPrivileged(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:537) org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:301) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) Any Idea.

    Read the article

  • java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

    - by pAkY88
    I'm developing a servlet that receives a multipart request with content of multiple files, and I'm using apache commons file upload libraries. When I call parseRequest(request); method servlet throws following exception: GRAVE: Servlet.service() for servlet DiffOntology threw exception java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest at org.apache.commons.fileupload.servlet.ServletRequestContext.getContentType(ServletRequestContext.java:73) at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.(FileUploadBase.java:882) at org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:331) at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:349) at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126) at DiffOntology.doPost(DiffOntology.java:38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) I put all libraries in WEB-INF/lib.

    Read the article

  • Setting httponly in JSESSIONID cookie (Java EE 5)

    - by mythandros
    I'm trying to set the httponly flag on the JSESSIONID cookie. I'm working in Java EE 5, however, and can't use setHttpOnly(). First I tried to create my own JSESSIONID cookie from within the servlet's doPost() by using response.setHeader(). When that didn't work, I tried response.addHeader(). That didn't work either. Then, I learned that the servlet handled converting the session into a JSESSIONID cookie and inserting it into the http header so if I want to play with that cookie, I'll have to write a filter. I wrote a filter and played with setHeader()/addHeader() there, again to no avail. Then, I learned that there's some flush/close action going on in the response object before it gets to the filter so if I want to manipulate the data, I need to extend HttpServletResponseWrapper and pass that to filterChain.doFilter(). This is done but I'm still not getting results. Clearly I'm doing something wrong but I don't know what. I'm not sure if this is at all relevant to the question at hand but no html document is being returned by the servlet to the browser. All that's really happening is that some objects are being populated and returned to a JSP document. I've sort of assumed that The Session object is turned into a JSESSIONID cookie and wrapped -- along with the objects added to the request -- in an http header before being sent to the browser. I'd be happy to post some code but I want to rule out the possibility that my difficulties stem from a misunderstanding of the theory first.

    Read the article

  • How to use GWT when downloading Files with a Servlet?

    - by molleman
    Hello Guys I am creating a simple project that will allow me to upload and download files using gwt. i am having trouble with the downloading of files that are on my server. For the file upload i used http://code.google.com/p/gwtupload/ and followed the instructions there. My file is stored on the server outside of the website container(on the hard drive), Now when it comes to the downloading of a file, i want a user to press a download button and whatever item is currently selected will download. i dont really know how this will be done i know i need a download servlet public class DownloadAttachmentServlet extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub super.doGet(req, resp); } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String fileName = (String) req.getSession().getAttribute("fileName"); YFUser user = (YFUser) req.getSession().getAttribute(TestServiceImpl.SESSION_USER); if (user == null) throw new ServletException("Invalid Session"); InputStream in = null; OutputStream out = resp.getOutputStream(); FileInputStream fIn = new FileInputStream(fileName); byte[] buffer = new byte[4096]; int length; while ((length = in.read(buffer)) > 0){ out.write(buffer, 0, length); } in.close(); out.flush(); } } for the moment i will just pass a fileName string to retrieve the file for testing now i am lost at what to do on the client side, i have a simple public class DownloadFilePanel extends Composite { public DownloadFilePanel(final YFUser user , final String fileName){ final Element downloadIframe = RootPanel.get("__download").getElement(); VerticalPanel content = new VerticalPanel(); content.add(new Label("Download For this File : " + fileName)); Button button = new Button("Download"); button.addClickHandler(new ClickHandler(){ @Override public void onClick(ClickEvent event) { // i do not know what to do here }); content.add(button); initWidget(content); } } above is a simple widget that will supply a panel that will allow for the download of a file based on a fileName as you can see above, i do not know what to do to be able to download the file is there any one that can point me in the right direction?

    Read the article

  • passing json from servlet to dojo

    - by Moev4
    I am currently trying to pass a generated JSON string to dojo for parsing and am having some issues. The servlet simply writes it as a string as so: response.getWriter().append("{ \"data\": {"); response.getWriter().append("\"type\": \"facing\","); response.getWriter().append("\"score\": " + "\"" + score + "\","); response.getWriter().append("\"count\":" + "\"" + count + "\"" ); response.getWriter().append("}}"); which prints as: {"data":{"type":"facing","score":"10","count":"24"}} And the parsing on the dojo end looks as so: dojo.xhrPost({ url: url, handleAs: "json", load: function(data) { alert(data); /* Parse Not working */ alert(data.data[0].type); }, error: function(error) { alert("No dice") } }); The main issue is the data.data[0].type is returning nothing but when i print this out as text the json seems to be correctly formatted. Any help with this would be appreciated.

    Read the article

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