My web app has a servlet called admin which when navigated to checks if the user is logged in and if the are directs to the the admin section, but if they aren't it directs them to a JSP page with a sign-in form. The name of the JSP doesn't appear in the URL, it stays as /admin. But then when the JSP posts to another servlet to validat...
Another day, another class... I have gotten everything working for my class in which I am using Tomcat and Eclipse to write java servlets. What I would like to know is why eclipse seems to give me problems when I try to edit the servlet-name in the web.xml file. Does eclipse not allow you to edit this file? I know that it automaticall...
I want to use java.util.ConcurrentLinkedQueue as a non-durable queue for a Servlet.
Here's the blurb from the javadoc for the class.
An unbounded thread-safe queue based on linked nodes. A ConcurrentLinkedQueue is an appropriate choice when many threads will share access to a common collection. This queue does not permit null element...
I'm building a Rails application that requires some models to interact with some necessary Java libraries. To do this, I want to use Rails on on MRI - not JRuby or RBJ. The Java code only needs read access to the database tables managed by the Rails app.
One way to do this is to set up a Servlet that reads the Rails app's database table...
I have a jsp containing a form which posts to a servlet, when the servlet receives the parameters from the form the pound sign (£) is preceded with the following character Â. So £ becomes £. What is causing this and how can I get round it?
...
I'd like to specify a Servlet URL pattern to match a URL that ends with a slash ("/") and only a slash.
I understand that the pattern
/example/path/*
will match a URL of
http://example.com/example/path/
and that this appears to work. However, that same pattern would also match URLs of
http://example.com/example/path/a/
...
When you get a doGet or doPost call in a servlet you can use getparameterxxx() to get either the query string or the post data in one easy place.
If the call was a GET, you get data from the url/query string.
If the call was a POST, you get the post data all parsed out for you.
Except as it turns out, if you don't put an 'action' attrib...
Is it possible to determine which submit button was used? I have a confirmation form with 2 submit buttons. The first would confirm the order, do some DB tasks, then redirect. The second, which is a Cancel button, will just redirect to the same page, without doing any DB tasks.
Is it possible in the servlet, preferably via the reques...
I want to write a simple servlet in JBoss which will call a method on a Spring bean. The purpose is to allow a user to kick off an internal job by hitting a URL.
What is the easiest way to get hold of a reference to my Spring bean in the servlet?
JBoss web services allow you to inject a WebServiceContext into your service class using a...
Suppose I have:
<a href="http://www.yahoo.com/" target="_yahoo"
title="Yahoo!™" onclick="return gateway(this);">Yahoo!</a>
<script type="text/javascript">
function gateway(lnk) {
window.open(SERVLET +
'?external_link=' + encodeURIComponent(lnk.href) +
'&external_target=' + encodeURIComponent(lnk.target) +
...
I've got a foo.war file from a third-party vendor. I've defined a context in my Tomcat configuration by creating conf/Catalina/localhost/foo.xml that contains:
<Context docBase="/path/to/foo.war" ...> ... </Context>
I want Tomcat to load up the foo context at startup. But the WEB-INF/web.xml (deployment descriptor) in the foo.war fi...
Hi,
I am new to J2EE and related stuff in general. I am trying to move a particular web application from a Sun One server deployment on to JBoss. The application is filled with a lot of servlets where each one re-directs to another.
There are way too many servlets for me to enter a mapping between each of these servlet class to a URL-ma...
can we change the name of the init() method of servlet?
i mean to say the life should be-
xyz()-service()-destroy()
instead of
init()-service()-destroy()
...
Hi,
I have a servlet which processes a request for a long time. It suppose
to keep doing stuff in the loop inside doPost and send data through
response's out writer. Effectively that continuously appends data in
the clients browser .
But the problems accures when client just closes the browser. Inspite
of the broken connection the respo...
Hi All,
I am new to Jboss and deployment of web applications etc. I have two different war files deployed on the same Jboss server. Further they also share some classes which read different properties based on the application settings (Let's call a common class as CommonClass.class which is present in App1.war and App2.war; CommonClass ...
Here's what I'm trying to do:
public void init(ServletConfig config) {
// ...
URL url = new URL("http://myhost:port/path/to/otherservlet");
// ... do stuff with contents of url
}
This works fine, but myhost and port are hardcoded and I want to avoid that. I want
URL url = new URL("/path/to/otherservlet");
but that's not...
This is a follow up to my earlier question.
Tomcat 5.0.28 had a bug where the Servlet's destroy() method was not being invoked by the container on a shutdown. This is fixed in Tomcat 5.0.30, but if the Servlet's destroy() method had a System.exit(), it would result in the Tomcat windows service throwing the Error 1053 and refusing to sh...
I would like to be able to get a list of all Spring application contexts from the web applications running in my servlet container. This so so that I can re-initialise the contexts without restarting or reloading my container or webapps.
Is this possible? If so, how? Is there anyway to get a list of all the servlet contexts running on a...
Today I fixed a bug in an application that might have lead to an endless loop in a servlet request/response cycle.
So just out of curiousity: What happens, if my servlet actually gets trapped in a for(;;) loop?
Is it somehow possible to recover? Will tomcat detect this? Can this instance be killed without restarting the server?
Or is ...
We have been using System.getProperties("user.dir") to get the location of a properties file. Now that it has been deployed on Tomcat(via servlet), the System call is giving the location as tomcat and not at the location at where the properties file exist.
How can we call the the properties file dynamically?
Given:
Tomcat is not t...