I am working on a small webapp for fun, using just Java Servlets at the moment. I have two pages, test1 and test2. At the moment I am creating a new session in test1 like this:
HttpSession session = request.getSession(true);
if (session.isNew() == false) {
session.invalidate();
session = request.getSession (true)...
How should I create & run unit-tests for a Java/Tomcat Servlet-Applet application?
...
how to retriving the date only not date and time from database by using servlets and how to display the result in jsp page
...
Hi,
what are the best practices to unit test java servlets? By the way: this is a topic in which I have some dificulty: how do you unit test your java servlets?
...
I am trying to configure my path to include javax.servlet with WebLogic.
WebLogic has split out the Jar files, so which one contains javax.servlet?
...
Hi,
I have an API that returns XML, it actually returns it using the default encoding (I believe it's UTF-8), but now requirements have changed and we need to return everything in UTF-16LE.
My question is: is there an easy way of doing this? I have access to the response just before the calls complete so I was wondering if I could do s...
Hey guys, This is probably a very beginner level question. But I need to get hold of the request object in java code. I can't pass this object down to my code for certain reasons. Is there any way I can say something like: getCurrentHTTPServletRequest?
It is safe for me to assume that I am in a Servlet Context.
...
I have an application where Servlet has a method called Update(ReqIn, ReqOut). I call it from doGet & doPost and pass the Request and Response variables, and it is then up to Update(...) to fill out the following static variables:
...
public class Server extends HttpServlet {
public static HttpServletRequest In = null;
public s...
I'm new to Wicket and would like to maintain a web application from inside itself using some sort of maintenance admin page for running clean-up, DB updates, recovery and so on. Since I plan to use Hibernate or similar for data binding I would like to trigger a complete reboot of the application from inside itself without giving everybod...
I want to make an Http request and store the result in a JSONObject. I haven't worked much with servlets, so I am unsure as to whether I am 1) Making the request properly, and 2) supposed to create the JSONObject. I have imported the JSONObject and JSONArray classes, but I don't know where I ought to use them. Here's what I have:
...
I want to write
if (POST.equals(req.getMethod()))
instead of
if ("POST".equals(req.getMethod()))
but I cannot find the constant definitions in the Servlet API (only looked in HttpServletRequest, where I expected them to be).
Where are they (I am using lots of libraries, so if someone else defines them, that would also work)?
...
So I have a big long query string that can either be ...
//url=z&surl=y&time=z&codec=a264&acodec=mp3&width=400x100
or
//url=z&surl=y&time=z&optlevel=w
Im using request.getQueryString("url") to check if a) the qs is there and b) make sure its not null. This is all leading to a big messy set of if statements. I was just wondering if ther...
Hi,
I was wondering if there was an easy way to serve GZipped content with Java Servlets. I already have the app up and running so the modifications needed should be too heavy.
I have access to the response object just at the end of the doPost/doGet method, so I'm looking for something like
response.setGzip(true);
It doesn't have to...
I want to define two servlets in my Spring web.xml - one for the application html/jsp pages, and one for a web service that will be called by an external application. Here is the web.xml:
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-star...
Hi All,
We are trying to develop a Topology Map of available devices in a network.
I have the details of the system, like IP, Device Name.
All I need to do is to populate them on the graph and show it graphically, the problem is that we need to do it in JSP.
Is there another way, like show using Flex, where I would pass IP/Device Nam...
Ok, so a user enters some information on a JSP and clicks 'submit' which launches a servlet. This servlet then processes the information and sends back another JSP. That works fine.
However, what about if the servlet needs to ask the user a question before continuing the processing? In a general Java Application you can use the likes of...
I was having a look through the servlet-api.jar source code and found out (to my utter bewilderment) that javax.servlet.GenericServlet implements javax.servlet.ServletConfig.
Now, I don't boast to be an OOP scholar, but I do remember reading that although OOP provides the concept of inheritance, inheritance as a feature should be applie...
I am trying to configure cruisecontrol to use Tomcat rather then Jetty servlet engine. I am following a tutorial on this and I am stuck on where it says:
Pass startup parameter to tomcat.
-Ddashboard.config=/home/cruisecontrol/work/dashboard-config.xml
Where do I put this in which file in tomact is it the startup.sh in tomcat directo...
Hi guys!
I have to write a website with JSP and Servlets which displays a questionnaire and gets the result of the user.
I've already written the question object, a questionnaire (random list of questions) and the questions library.
Now my Servlet generates an instance of the questionnaire and displays the questions. My problem is I d...
Hi,
I have observed that while RequestDispatcher.forward(request, response) can throw an IllegalStateException (if the response is committed) , RequestDispatcher.include(request, response) does not throw an IllegalStateException(even if the response was committed before).
I have verified this on Tomcat 6.0.20.
I am aware that the incl...