servlets

How to refresh static resources in Java Web Application?

笑着哭i 提交于 2020-01-05 23:07:02
问题 I am developing an application that stores data dynamically and displays it as it is generated or uploaded. But the problem is when I am uploading any image then it should be displayed. It's path is also defined perfectly but until I refresh the whole application in eclipse it remains unchanged. So to update application, I have to refresh it. My application is Java based and is useing JSP and Servlet. Is there any code that can be used to update or refresh the application? Right now I am

JSTL not parsed in a JSP page running on an embedded Jetty instance

亡梦爱人 提交于 2020-01-05 19:18:38
问题 I have a web application which works fine if i just deploy it on to the deploy folder of either Tomcat or Jboss. What i am trying to do now is to embed this application on to a Jetty container. I cant seem to get it to work as it is spitting out errors related to the JSTL tag library. Here is the error that is shown: Problem accessing /Web/app/localTimestamp. Reason: /WEB-INF/views/localTimestamp.jsp(1,62) PWC6188: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in

How do I get the current time in a different TimeZone in Java?

半城伤御伤魂 提交于 2020-01-05 15:44:14
问题 OK - I feel pretty dumb asking such a basic question, but hey. I'm trying to get the current time in a different timezone in a Java webapp. I've tried the following obvious solution: in my servlet, Calendar localCalendar = Calendar.getInstance(myBean.getTimeZone()); then I pass the calendar object through to a JSP as a request attribute 'localCalendar': It is now: [${requestScope.localCalendar.time}] in TimeZone ${requestScope.localCalendar.timeZone.ID} but my output seems to ignore the

Internet explorer 9 will not recognize doctype sent by servlet from weblogic server and renders in document mode IE7 - extra characters before start?

懵懂的女人 提交于 2020-01-05 13:13:30
问题 PROBLEM Internet Explorer 9 does not take the <!DOCTYPE html> into account in the same way when I have my page locally or on my server. I made a simple test page to highlight the problem: EDIT: updated simple test page with meta tag and css link <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="css/environmentinfo.css" /> <meta http-equiv="x-ua-compatible" content="IE=edge"/> </head> <body> <script> document.write(document.compatMode); document.write('<br/>'); document

Java Servlet parse request body multithread

倖福魔咒の 提交于 2020-01-05 13:01:10
问题 I've implemented a asynchronous Servlet, which needs to parse the body of request and store the parsed result in cache. Should I implement the parseBody() function in Servlet or implement a new class, which will do the parsing? What is the best practice? Here is my current code snippet: public class DocFeedServlet extends FeedServlet { private static final Logger LOGGER = LoggerFactory.getLogger(DocFeedServlet.class); private static final ObjectMapper OBJECTMAPPER = new ObjectMapper(); public

Java Servlets: How to repeat an HTTP request?

烈酒焚心 提交于 2020-01-05 10:25:44
问题 I'd like to repeat an HTTP request automatically if a database deadlock occurs; however, FilterChain.doFilter() is defined as a unidirectional chain (so I cannot reset its state). In cases where it's safe to do so, is it possible to repeat an HTTP request without having the client re-submit the request ? UPDATE : I just discovered a problem with this approach. Even if you repeat the request, you will need to buffer the request InputStream. This means that if a user uploads 100MB of data, you

Java Servlets: How to repeat an HTTP request?

徘徊边缘 提交于 2020-01-05 10:25:10
问题 I'd like to repeat an HTTP request automatically if a database deadlock occurs; however, FilterChain.doFilter() is defined as a unidirectional chain (so I cannot reset its state). In cases where it's safe to do so, is it possible to repeat an HTTP request without having the client re-submit the request ? UPDATE : I just discovered a problem with this approach. Even if you repeat the request, you will need to buffer the request InputStream. This means that if a user uploads 100MB of data, you

NullpointerException with connection object creating SQL statement

断了今生、忘了曾经 提交于 2020-01-05 08:54:11
问题 I am getting a nullpointerexception with this line of code Statement stmt = conn.createStatement(); The servlet that uses this was working ok a few days back and I recovered from a previous version of my class from my repository and it still is not working , so I am guessing it is maybe a server side problem. However to be sure I want to get as much information as possible , what would be the best way to debug. I have tried using e.toString() However this only gives "nullpointerexception"

NullpointerException with connection object creating SQL statement

孤街醉人 提交于 2020-01-05 08:54:11
问题 I am getting a nullpointerexception with this line of code Statement stmt = conn.createStatement(); The servlet that uses this was working ok a few days back and I recovered from a previous version of my class from my repository and it still is not working , so I am guessing it is maybe a server side problem. However to be sure I want to get as much information as possible , what would be the best way to debug. I have tried using e.toString() However this only gives "nullpointerexception"

Grizzly + Static Content + Servlet Filter

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-05 08:45:33
问题 I can get Grizzly to serve static content I can create the servlet filter to filter a named servlet But I can't get the servlet filter to filter the static content. How do I do that? Here is the code I have so far: WebappContext webappContext = new WebappContext("grizzly web context", ""); FilterRegistration authFilterReg = webappContext.addFilter("Authentication Filter", org.package.AuthenticationFilter.class); // If I create a ServletContainer, I can add the filter to it like this: //