servlets

Override 302 response in WebLogic

When I do a redirect inside J2EE web application deployed on WebLogic it sends back to the client the following response: HTTP/1.1 302 Moved Temporarily Cache-Control: no-cache="set-cookie" Date: Sat, 12 Dec 2009 07:37:43 GMT Transfer-Encoding: chunked Location: http://server:port/front/page Set-Cookie: JSESSIONID=CDdjLjLHSLlGxzzBT7dmLC...

Spring Web Application without any XML

Spring JavaConfig makes possible to create spring applications without xml cotext configuration. And servlet 3.0 specification makes possible to create web applications without web.xml. So, is it possible to create spring web application not using any xml configuration? Is there any already implemented solution? PS At now I do not see ...

ASP.NET => Spring Web Flow: How do I get up to speed fast?

I'm a long-time web developer who's been focusing on ASP.NET/C# for the past 5 years. For my final Masters in Software Engineering project, my team is working with a local company to build them an app using Spring Web Flow (as that's their current tech stack). I don't know the first thing about building web sites with Java. In fact th...

Java servlet - export to an excell

How to make an excel file (and txt file) filled with data from a table on the html page in a servlet and send it to a browser? ...

Design question - servlets, jsps, custom tags, html

Hi, I am new to servlets and jsps. I wanted to know what the best design would be for a sample problem I am trying to write code for. Here goes - I want to create a web site (www.example.com) that just lists the login history of every user (not any functionility any one wants but just an example for the sake of one). So there are two...

handling servlet output in ajax

hi, i am new to java, my problem is i am sending a request to servlet from a jsp page ajax function the servlet process the data and returns a arraylist my question is how to handle the arraylist inside ajax and display it as a table in same jsp page. the code is function ajaxFunction ( ) { // var url= codeid.options[codeid.select...

Is there an easy way to compare two strings in a jsp?

I am creating a drop down list of all languages, with the language used when creating other info in the page as the default selected in the list: <select> <c:forEach items="${languages}" var="lang"> <c:choose> <c:when test="${lang}.equals(${pageLang})"> <option value="${lang}" selected>${lang}</option> </c:whe...

Difference between web-server and servlet container.

What is the difference between "A Web Server" and "A Servlet Container"? In general are all Web Servers Servlet(Web) Containers too or vice versa? I have been using Apache Tomcat for JSP and Apache for PHP but unable to figure out the exact difference between those two, where exactly lies the difference? I tried searching previous thre...

Servlet web.xml authentication for welcome page

I have a web.xml which looks like: <web-app> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <security-constraint> <web-resource-collection> <web-resource-name>Default</web-resource-name> <url-pattern>/</url-pattern> </web-resource-collection> <auth-constraint/> </security-constraint> ...

Call a servlet on click of hyperlink

Hi All, Is there a way to call a Java Servlet on click of hyperlink without using JavaScript? ...

Is it possible to define initial parameter arguments for Java webapp listeners?

In a web application's web.xml file, one can define initial parameters for servlets and filters by using the init-param element. Parameters defined here can then be retrieved by calling getServletConfig(). It does not seem possible to do the same with listeners, as the DTD only defines the listener-class element there. I would really ...

Programmatically Determine Java Session Timeout

Is there any way for a java servlet/jsp to determine the webserver's session timeout (in seconds, minutes, etc...)? I tried looking in the HttpSession and System API, but didn't see any property for determining the webserver's session timeout. I know that this value is set in web.xml, but I am designing a java library which needs to dete...

URL shortening: redirection to a 'file://' target (file protocol target)

Hi, I am trying out a simple implementation of a URL shortener such as tinyurl.com or bit.ly. Currently I do a response.sendRedirect(targetURL) in my servlet - which works fine for http/ftp target URLs. However, I'm having problems redirecting to targets such as file:///c:/temp (where c:\temp is of course on the local/client system). ...

Sometimes HttpURLConnection.getInputStream executes too slowly

We have next code. Sometimes we should wait 10-20-40 seconds on the last line. What can be the problem? Java 1.4 URL url = ...; HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.connect(); OutputStream out = conn.getOutputStream(); ObjectOu...

Is anyone still using JSTL?

I was about to pick up some Java web programming since not having touched Java for a couple of years. I picked up an fairly old O'Reilly book that was sitting on my bookshelf (Java Server Pages 3rd Edition, covers JSP 2.0 & JSTL 1.1) and started skimming the pages. I went over to download the latest JSTL libraries and noticed that they a...

Redirect back to a page after a login

Hi, I'm doing a simple forum with a series of Servlets that each represent a home, topic, postedit, login and userlist page. On some of these pages there is a link that appears when a user isn't logged in. What I'd like to achieve is to trigger a redirection (using forward() on a RequestDispatcher) after a login so the browser goes bac...

AS2: Does xml.sendAndLoad use POST or GET?

All, I'm trying to find out, unambiguously, what method (GET or POST) Flash/AS2 uses with XML.sendAndLoad. Here's what the help/docs (http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs%5FParts&amp;file=00002340.html) say about the function Encodes the specified XML object into an XML d...

ServletRequest.getParameterMap() returns Map<String, String[]> and ServletRequest.getParameter() returns String?

Can someone explain to me why ServletRequest.getParameterMap() returns type Map<String, String[]> ServletRequest.getParameter() just returns type String I'm don't understand why the map would ever map to more then one value. TIA. ...

monitor tomcat executor?

How do I get a reference to the Tomcat Executor instances running within the web app? I need this so I can query basic information, such as thread pool size and utilization. ...

Prevent multiple login using the same user name and password

I am developing an application that needs to prevent multiple login using the same user name and password. If it happens on the same machine then obviously we need to do something with the user session, but it should also prevent if they are login on different machines using the same user name and password. We have to keep following th...