servlets

Access managed bean from separate web application on same server?

I have two applications. The first called app1 is a JSF 1.2 application. The second called app2 is a basic Servlet application. Is it possible to access a specific managed session bean in app1 from app2? Both are deployed on the same server. Thanks Tom ...

How would you transfer session info between Java/Servlet's and .NET

I have a web app built on Java Servlet technology. I am thinking of switching to a new framework, possibly switching over to a .NET stack with C# and ASP MVC. I don't want to take the current app down while I develop the new one. The goal is to have the old system run and just develop new modules in a new architecture. If I stay with a...

Eclipse IDE & Import issues

Hi, Lately I have been trying my hands on Eclipse IDE for java development. I am mostly a novice to java programming. I am trying a servlet project, using Tomcat5.5 as container. I am getting issues when I give import javax.servlet.* statement in my class files, as Eclipse complains that it cannot find that particular package. I am work...

Configuring Tomcat 5.5 to UTF-8 encode all sendRedirect() redirections?

A requirement of the product that we are building is that its URL endpoints are semantically meaningful to users in their native language. This means that we need UTF-8 encoded URLs to support every alphabet under the sun. We would also not like to have to provide installation configuration documentation for every application server and...

Sending 100 Continue using Java Servlet API

Is it possible to send "100 Continue" HTTP status code, and then later some other status code after processing entire request using Java Servlet API (HttpServletResponse)? I can't find any definitive "No" answer, although API doesn't seem to support it. ...

Error in velocity and log4J

Hello, I built a webapp that works perfectly fine in my localhost (tomcat). But when I tried to deploy, velocity crashes in init(), leaving me with this strange stack trace here (sorry for the size): ERROR [main] (VelocityConfigurator.java:62) - Error initializing Velocity! org.apache.velocity.exception.VelocityException: Failed to i...

Servlet parameters and doPut

Trying to get parameters from a PUT request using HttpServlet#doPut: public void doPut(HttpServletRequest request, HttpServletResponse response) { String name = request.getParameter("name"); // name is null } Using curl to send the request: curl -X PUT \ --data "name=batman" \ --header "Content-Type: text/plain" ...

java servlets : duplicate key row in object with unique index 'XAK1timItem'

I've written this java servlet which inserts items into a table however it fails. I think it might be due to my insertion and deleting which got me in trouble some how. The java servlet runs an insert statement into sql server. In my error log, it says: com.microsoft.sqlserver.jdbc.sqlserverexception: cannot insert duplicate key row ...

Where's javax.servlet?

I have jdk1.6.0_13 installed, but when I try to find a javax.servlet package, or press ctrl+space in Eclipse after Servlet I cannot get anything. Where can I download this package, and why isn't it included in standard distribution for developers? ...

Are the Java Servlet APIs backwards compatible?

I want to write a JAR file that makes use of the javax servlet API. If I write against version 2.2, does that mean it will work on versions 2.3, 2.4 and 2.5? Thanks ...

Posting a form without changing pages in a jsp

In a jsp, how do you post a form without changing the page? In essence, I'm trying to: 1) First, kick off a servlet on the backend with a post to process the HttpServletRequest. 2) Second, once the servlet completes, a response message will be posted in a DIV on the page using prototype's Ajax.Updater function. All without leaving...

How to access static resources when using default servlet

Hi i have a problem i want to send all my request to one spring servlet <servlet> <servlet-name>home</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>home</servlet-name> <url-pattern>/*</url-pattern> </serv...

Which Java framework to use to write a blogging engine?

Hi, I'm planning to write a blogging engine over the summer to learn about web apps & servlets, etc. What would be an appropriate framework to use? I've been told Spring would be good, but I don't know anything about it. Any suggestions? ...

Logout code in JSP

I am using basic level authentication and I need best logout code in JSP/Servlet. I am using JSP & servlet and MS-Access as backend. Is it required to create session in JSP? ...

Error with Tomcat 6 and Tomcat 5.5 Incompatibility

I developed a Tomcat application using Tomcat 6 for testing. I have now deployed it to Tomcat 5.5 - when I invoke the servlet I get an error which doesn't make much sense to me. Does anyone know what causes this error. exception javax.servlet.ServletException: Error allocating a servlet instance org.apache.catalina.valves.ErrorRepo...

Calling servlet from another servlet

I have two servlets which are running on different tomcat servers. I and trying to call a servlet1 from servlet2 in the following way and wanted to write an object to output stream. URL url=new URL("http://msyserver/abc/servlet1"); URLConnection con=url.openConnection(); con.setDoOutput(true); con.setDoInput(true); OutputStream os=con...

correctly printstacktrace of servlet exception

so i am using a filter to catch servlet exception (because we are using a mix of jsf/plain servlets) when catching the ServletException and calling printstacktrace most of the information is lost. the "true" root exception seems to be hidden behind the "funny" expression ((ServletException) e.getRootCause().getCause()).getRootCause()...

Is there an equivalent to the J2EE ServletContext in ASP.NET?

I need a way to store application-level data (i.e. cross user sessions) in ASP.NET. In J2EE I'd use the ServletContext. Is there an equivalent in ASP.NET? ...

java servlet : how to speed this up?

I have the following function which is called for every line item produced. Does anyone have any ideas how to speed this up? private String getDetails(String doc){ String table=""; java.sql.ResultSet rs = qw.DBquery("select " + "id,LineType, QtyTotal, ManufacturerPartNumber, Description, UnitCost,UnitPrice " + ...

How do you remove a Cookie in a Java Servlet

How do you remove a cookie in a Java servlet? I tried this: http://www.jguru.com/faq/view.jsp?EID=42225 EDIT: The following now works successfully it appears to be the combination of: response.setContentType("text/html"); and cookie.setMaxAge(0); Before I was doing: //remove single signon cookie if it hasn't been validated yet r...