Bug in servlet mapping
Hi, it appears that the servlet mapping specified in section 10 of the
Servlet 2.2 spec is broken in Weblogic server 6.0 GA. Here is the servlet
2.2. spec for mapping:
10.1 Use of URL Paths
Servlet containers must use URL paths to map requests to servlets. The
container uses the
RequestURI from the request, minus the Context Path, as the path to map to a
servlet. The URL
path mapping rules are as follows (where the first match wins and no further
rules are attempted):
1. The servlet container will try to match the exact path of the request to
a servlet.
2. The container will then try to recursively match the longest path prefix
mapping. This process
occurs by stepping down the path tree a directory at a time, using the '/'
character as a path
separator, and determining if there is a match with a servlet.
3. If the last node of the url-path contains an extension (.jsp for
example), the servlet container
will try to match a servlet that handles requests for the extension. An
extension is defined as the
part of the path after the last '.' character.
4. If neither of the previous two rules result in a servlet match, the
container will attempt to serve
content appropriate for the resource requested. If a "default" servlet is
defined for the application,
it will be used in this case.
It appears that Weblogic does step #3 before step #2. This means that if
you have a servlet called 'foo' mapped to '/foo/*' and Weblogic 6.0 receives
a request for '/foo/bar.jsp', the container returns an error because it
cannot find a JSP file called "bar.jsp" to compile, when according to the
spec, servlet 'foo' should receive the request with the pathInfo value set
to "/bar.jsp".
The workaround is to assign all *.jsp files to the servlet 'foo' as well,
but this breaks all other JSP files in the same web application.
I consider this a bad bug, as it breaks a proxy server that I have been
working on. Tomcat and other servlet containers seem to have gotten this
right, why not Weblogic?
Thanks
Colin Evans
Colin Evans
Senior Engineer
BITMO, Inc. (http://www.bitmo.com)
(415)920.7225 / [email protected]
Hi, it appears that the servlet mapping specified in section 10 of the
Servlet 2.2 spec is broken in Weblogic server 6.0 GA. Here is the servlet
2.2. spec for mapping:
10.1 Use of URL Paths
Servlet containers must use URL paths to map requests to servlets. The
container uses the
RequestURI from the request, minus the Context Path, as the path to map to a
servlet. The URL
path mapping rules are as follows (where the first match wins and no further
rules are attempted):
1. The servlet container will try to match the exact path of the request to
a servlet.
2. The container will then try to recursively match the longest path prefix
mapping. This process
occurs by stepping down the path tree a directory at a time, using the '/'
character as a path
separator, and determining if there is a match with a servlet.
3. If the last node of the url-path contains an extension (.jsp for
example), the servlet container
will try to match a servlet that handles requests for the extension. An
extension is defined as the
part of the path after the last '.' character.
4. If neither of the previous two rules result in a servlet match, the
container will attempt to serve
content appropriate for the resource requested. If a "default" servlet is
defined for the application,
it will be used in this case.
It appears that Weblogic does step #3 before step #2. This means that if
you have a servlet called 'foo' mapped to '/foo/*' and Weblogic 6.0 receives
a request for '/foo/bar.jsp', the container returns an error because it
cannot find a JSP file called "bar.jsp" to compile, when according to the
spec, servlet 'foo' should receive the request with the pathInfo value set
to "/bar.jsp".
The workaround is to assign all *.jsp files to the servlet 'foo' as well,
but this breaks all other JSP files in the same web application.
I consider this a bad bug, as it breaks a proxy server that I have been
working on. Tomcat and other servlet containers seem to have gotten this
right, why not Weblogic?
Thanks
Colin Evans
Colin Evans
Senior Engineer
BITMO, Inc. (http://www.bitmo.com)
(415)920.7225 / [email protected]
Similar Messages
-
RequestDispatcher / servlet mapping broken for extension mapping?
Hello folks,
I'm using RequestDispatcher from a 'Control' servlet to forward
ServletRequests to a 'Presentation' servlet. The Control servlet does
some processing and determines which 'URL' to forward the request to.
Sometimes, I expect the Control servlet to forward requests to a file
URL; which the servlet container will intercept and send to another
Servlet because there is a mapping for that file's extension.
For example (in a servlet)...
RequestDispatcher presentationServlet =
context.getRequestDispatcher("/xsl/somestylesheet.xsl");
presentationServlet.forward(req, resp);
and in WEB.xml
<servlet-mapping>
<servlet-name>XSLTStylesheetServlet</servlet-name>
<url-mapping>*.xsl</url-mapping>
</servlet-mapping>
I find however that Weblogic simply displays the content of
'/xsl/somestylesheet.xsl', rather than invoking the
XSLTStylesheetServlet with the appropriate value for 'getServletPath()'
(which I expect to return '/xsl/somestylesheet.xsl').
I've seen some stuff in these newsgroups to indicate that this might be
a known issue; if so, when is it likely to be fixed because this is a
show-stopper for me - I'll note that Tomcat (http://jakarta.apache.org)
supports this functionality ;-) [although admittedly, this is a possibly
murky area of the spec.]
Thanks,
James W.
The WebLogic newsgroups are not the appropriate place to file product defect
reports.
I suggest that you file a bug report with our support organization. Be sure
to include a complete test case. They will also need information from
you -- please review our external support procedures:
http://www.beasys.com/support/index.html
Thanks,
Michael
Michael Girdley
Product Manager, WebLogic Server & Express
BEA Systems Inc
James Webster <[email protected]> wrote in message
news:[email protected]...
> Hello folks,
>
> I'm using RequestDispatcher from a 'Control' servlet to forward
> ServletRequests to a 'Presentation' servlet. The Control servlet does
> some processing and determines which 'URL' to forward the request to.
> Sometimes, I expect the Control servlet to forward requests to a file
> URL; which the servlet container will intercept and send to another
> Servlet because there is a mapping for that file's extension.
>
> For example (in a servlet)...
>
> RequestDispatcher presentationServlet =
> context.getRequestDispatcher("/xsl/somestylesheet.xsl");
> presentationServlet.forward(req, resp);
>
> and in WEB.xml
>
> <servlet-mapping>
> <servlet-name>XSLTStylesheetServlet</servlet-name>
> <url-mapping>*.xsl</url-mapping>
> </servlet-mapping>
>
> I find however that Weblogic simply displays the content of
> '/xsl/somestylesheet.xsl', rather than invoking the
> XSLTStylesheetServlet with the appropriate value for 'getServletPath()'
> (which I expect to return '/xsl/somestylesheet.xsl').
>
> I've seen some stuff in these newsgroups to indicate that this might be
> a known issue; if so, when is it likely to be fixed because this is a
> show-stopper for me - I'll note that Tomcat (http://jakarta.apache.org)
> supports this functionality ;-) [although admittedly, this is a possibly
> murky area of the spec.]
>
> Thanks,
> James W.
-
Setting servlet mapping?
a newbie question:
My servlet are running fine when requested by:
http://myMachine.com:7777/j2ee/servlet/com.whatever.MyServlet
However I want it to be reached by:
http://myMachine.com:7777/servlet/com.whatever.MyServlet
note the missing "/j2ee". What is the proper way to set this mapping of the servlet directory?
I assume it might be done in the according web.xml?
Is it clever to edit web.xml manually? Do I have to use dcmctl udateconfig
afterwards?
Any hints are appreciated!I see what you mean. WebContent is just a general name. I use maven for building, which uses webapp as a standard.
As far as having pages in a faces directory, that should be the case. I'm using /faces/* for the servlet mapping in my web.xml. Any requested url with that pattern should map the request to the faces servlet. Whatever page replaces the * would then be located in the root of the webapp directory by the faces servlet.
My app doesn't seem to be getting that far. The /faces request doesn't seem to be getting to the faces servlet, as there are no initialization lines being dumped to my log file, but when I use *.jsf, it does. -
Can i run a servlet without a web.xml file for servlet mapping?
Hello everyone.
The code i want to run compiles and everythink looks ok.
It produces the .class file.
I run Tomcat 4.1 and i build my Web site with Dreamweaver.
I have a form in a page and i want to send the data upon form completion to a database i already have build with MySql.
The database is up and running and the server is set-up ok.
I have changed the port in Tomcat to run on port 80.
The directory i have my site is
Tomcat41\webapps\ROOT\se
and the directory where i keep the servlet class is
Tomcat41\webapps\ROOT\se\WEB-INF\servlet
I have a web.xml file to map the servlet and placed it in
Tomcat41\webapps\ROOT\se\WEB-INF
In the Form action i write action:"/servlets/Classes/GroupRegistration"
and I RECEIVE AN 404 ERROR FROM APACHE.
Somethink is wrong .
The following is the code from the GroupRegistration.java file
and follws the web.xml file.
Please Help.
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class GroupRegistration extends HttpServlet
Connection con;
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, java.io.IOException
handleForm(req, res);
public void init() throws ServletException {
try{
/* Loading the driver for the database */
Class.forName("com.mysql.jdbc.Driver");
Connection Con = DriverManager.getConnection("jdbc:mysql://localhost/se?user=luser&password=");
catch (ClassNotFoundException e) {
throw new UnavailableException("Couldn't load JdbcOdbcDriver");
catch (SQLException e) {
throw new UnavailableException("Couldn't get db connection");
private void handleForm(HttpServletRequest req, HttpServletResponse res)
throws ServletException {
//ServletOutputStream out = res.OutputStream();
//res.setContentType("text/html");
//Extract the form Data Here
String group = req.getParameter("GroupNo");
String Name1 = req.getParameter("Name1");
String LoginID1 = req.getParameter("LoginID1");
String Name2 = req.getParameter("Name2");
String LoginID2 = req.getParameter("LoginID2");
String Name3 = req.getParameter("Name3");
String LoginID3 = req.getParameter("LoginID3");
String Name4 = req.getParameter("Name4");
String LoginID4 = req.getParameter("LoginID4");
String URL = req.getParameter("URL");
String Title2 = req.getParameter("Title2");
String date = req.getParameter("date");
String INSERT = "INSERT INTO registration (groupno, name1, loginid1, name2, loginid2, name3, loginid3, name4, loginid4, url, topic, date) VALUES (" + group + "," + Name1 + "," + LoginID2 + "," + Name2 + "," + LoginID2 + "," + Name3 + "," + LoginID3 + "," + Name4 + "," + LoginID4 + "," + URL + "," + Title2 + "," + date + ")";
PreparedStatement pstmt = null;
try{
pstmt = con.prepareStatement(INSERT);
pstmt.executeUpdate();
catch (SQLException e) {
throw new ServletException(e);
finally {
try {
if (pstmt != null)pstmt.close();
catch (SQLException ignored){
The web.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com.xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>GroupRegistration</servlet-name>
<servlet-class>GroupRegistration</servlet-class>
</servlet>
<servlet-maping>
<servlet-name>GroupRegistration</servlet-name>
<url-pattern>/myGroupRegistration</url-patern>
</servlet-mapping>
</web-app>
I apreciate your time.
Thanks for any help.and the directory where i keep the servlet class is
Tomcat41\webapps\ROOT\se\WEB-INF\servletOthers have pointed out that "servlet" should be "classes", but there is another mistake that hasn't been spotted. If you want your servlet to appear in the root context, you should use:
Tomcat41\webapps\ROOT\WEB-INF\classes
If you want your servlet to appear under the /se context, then you should use:
Tomcat41\webapps\se\WEB-INF\classes
and also, in the latter case, your form action should be /se/myGroupRegistration. -
A problem with servlet mapping , using a servlet to produce some chart in
Hi
Thank you for reading my post.
My problem is about using a Chart library which works well in jsf application but it does not works in JSF portlets.
I think i find the problem but i do not know the solution.
to use this charting library we should add a servlet to web.xml
something like :
<servlet>
<servlet-name>Jenia internal servlet</servlet-name>
<servlet-class>org.jenia.faces.util.Servlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jenia internal servlet</servlet-name>
<url-pattern>/jenia4faces/*</url-pattern>
</servlet-mapping>
so , when we try to load a chart , it will make the chart image source
something like
http://localhost:28080/Adv/jenia4faces/chart/OAReport.jspBarChart3d_id0.png
in the above sample , adv is the name of web application which is
deployed in a servlet container.
and filter applied to make the chart render-able.
to use the chart library in jsf portlet , i add the servlet
description as i did for web application , so i add
<servlet>
<servlet-name>Jenia internal servlet</servlet-name>
<servlet-class>org.jenia.faces.util.Servlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jenia internal servlet</servlet-name>
<url-pattern>/jenia4faces/*</url-pattern>
</servlet-mapping>
to my portlet web.xml file.
when we have portlet , the url to access that portlet (which indeed is a
web application) changes
for example
url for a sample portlet with same web application name
will be like
http:// localhost:28080/pluto/portal/Adv/
as you can see there are some prefix to web application name in the url
, but when i use chart component to show
same chart , it still look for the chart in url like :
http://localhost:28080/Adv/jenia4faces/chart/OAReport.jspBarChart3d_id0.png
As you may already sugest , the image will not render because browser is
looking in wrong place.
now i
think if i find some way to map that servlet to correct url
pattern it will works.
my question is :
1-what will be new servlet url pattern ?
2-is my assumption correct ?
Thank you very much for reading such a long posti wrote an app i.e servlet which would select the data from the database and retrive the data.but i want to send this data to normal java file(which is not a servlet) and i want to display results in the normal java file.
can any body help this concept........
send me mail:[email protected] -
How to specify a servlet mapping as the url pattern with in the security constraints
Hi ,
Weblogic 6.0 documentation says the following:-
Define which resources in the Web Application the security constraint applies to using the <url-pattern> element that is nested inside the <web-resource-collection> element. The <url-pattern> can refer to either a directory, filename or a <servlet-mapping>.
To apply the security constraint to the entire Web Application, use the following <url-pattern>:
<url-pattern>/*</url-pattern>
Could any one let me know how to specify servlet mapping as the url pattern.
I tried various combination and it doesn't seem to work and any help in this regard will be greatly appreciated.
Thanks
kannanThe answer is posted here:
Unapproved User Flag in UME -
Problems with servlet mapping in 10g AS
Hi There,
i have a web application consisting of 2 controller servlets and use url mapping to send requests to the appropriate servlet, but i have a strange issue with 10g where it seems to be alternating between serlvets when handling requests!!!!
the web.xml is like as follows (with the app having the root context '/app'):
<servlet>
<servlet-name>control1</servlet-name>
<servlet-class>com.package1.class.name</servlet-class>
</servlet>
<servlet>
<servlet-name>control2</servlet-name>
<servlet-class>com.package2.class.name</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>control2</servlet-name>
<url-pattern>/special/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>control1</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
therefore i'd expect a request like http://domain.name/app/special/content to be handled by the control2 servlet and http://domain.name/app/normal/content or http://domain.name/app/normal/special/content to be handled by the control1 servlet...
but what seems to happen when requesting http://domain.name/app/special/content oc4j seems to alternate which servlet it passes it to...
is there any reason why this might be happening (like some app server configuration), as i have other applications that are configured in the same way, and there's no problems with requests going to the wrong servlet.
many thanks for your help,
AndyIn your integration process, define the import parameter under Configurable Parameters category.
http://help.sap.com/saphelp_nwpi71/helpdata/en/44/1f1a5c932d0d19e10000000a114a6b/frameset.htm
Regards,
Prateek -
Re: issue with servlet-mapping
Hello,
i got following url pattern on web xml and it works fine on resin, however,
its gives me, java.lang.IllegalArgumentException: Invalid pattern,
is there is a anyway to fix it without altering the file structure.
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/jsf/*.jsf</url-pattern>
</servlet-mapping>Wildcards(*) can be used either at the beginning or end of the pattern.You cannot specify wildcards in the middle of the pattern.
So, only either of these will work
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>Or
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/jsf/*</url-pattern>
</servlet-mapping> -
Different behaviour on servlet w/o servlet-mapping and init parameters
I was playing around and found, that the init-parameter of a servlet is always null if there is no servlet mapping. I did not define a servlet mapping because I used the servlet only for for (named) dispatching (client usage should not be allowed).
web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<servlet>
<servlet-name>InitParamServlet</servlet-name>
<servlet-class>test.InitParamServlet</servlet-class>
<init-param>
<param-name>param1</param-name>
<param-value>value1</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>InitParamServlet</servlet-name>
<url-pattern>*.initparam</url-pattern>
</servlet-mapping>
</web-app>
InitParamServlet.java:
package test;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class InitParamServlet extends HttpServlet{
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
pw.write(getServletName());
pw.write(": param1=" + getInitParameter("param1"));
}The URL http://localhost:8080/xxx/servlet/test.InitParamServletreturns org.apache.catalina.INVOKER.test.InitParamServlet: param1=null
(on Tomcat), and the call to the same servlet with URL http://localhost:8080/xxx/test.initparamreturns InitParamServlet: param1=value1 instead (the correct init parameter value)!
The same happens with jetty. This looks strange for me; I would expect the same behaviour for the servlet (independent from servlet-mapping-tag in the web.xml).When you call the url
http://localhost:8080/xxx/servlet/test.InitParamServlet
you are actually calling the invoker servlet that is defined in the default conf/web.xml. If you look at this web.xml file you will see that the invoker is mapped with the pattern "/servlet/*" which maps to the above url. The request goes to this servlet which parses the url and then calls the InitParamServlet class.
When you call the url
http://localhost:8080/xxx/test.initparam
you are matching the url pattern you defined in the WEB-INF/web.xml file ("*.initparam"). This time the request goes to servlet instance that you defines in the servlet naming tags as "InitParamServlet" and since you defined init params they are populated.
Note that these urls will also match the "*.initparam" pattern
http://localhost:8080/xxx/XXXXX.initparam
http://localhost:8080/xxx/badpackage.initparam
http://localhost:8080/xxx/A.initparam
Most people would have simplely defined the second servlet mapping as "initparam" and accessed the servlet with the url
http://localhost:8080/xxx/initparam -
Invalid element 'servlet-mapping' in content of 'web-app'
Hello, JDev gurus!
When compling, JDev 9.0.2.822 produce following error
"oracle.xml.parser.v2.XMLParseException: Invalid element 'servlet-mapping' in content of 'web-app', expected elements '[taglib, resource-ref, security-constraint, login-config, security-role, env-entry, ejb-ref]'."
on line <%@ taglib uri="http://xmlns.oracle.com/bibeans" prefix="orabi" %>
This line was added automatically from component palette.
How can I resolve this error?Hi,
Did you change something into your web.xml file?
Look at your web.xml. You must preserve the order given by the error message:
Servlet-mapping
session-config
mime-mapping
ejb-ref
Jamil -
Servlet mapping with Apache + Tomcat
I'm trying to set up my servlet with apache + Tomcat(3.2.3), and i'm using mod_jk as the Tomcat-Apache plug-in.
The HelloWorld servlet that comes with the examples app worked fine at: http://localhost/examples/servlet/HelloWorldExample,
but how do I change the configurations, so that it can be invoked at:
http://localhost/examples/HelloWorldExample ?
It appears to me that '/servlet/' is the default prefix for Tomcat's RequestInterceptor, there is no way to get around that.
Any insights will be greatly appreciated, thanks!
Elainehi
Try this:
add below code in web.xml file in examples/WEB-INF
F directory
<servlet-mapping>
<servlet-name>
HelloWorldExample
</servlet-name>
<url-pattern>
/HelloWorldExample
</url-pattern>
</servlet-mapping>
Thanks for the reply, the web.xml is already set up this way, in fact, I'm able to invoke the servlet through tomcat(running on port 8080): http://localhost:8080/examples/HelloWorldExample,
tomcat reads the web.xml without any problems.
The problem comes from Apache(port 80), http://localhost:80/examples/HelloWorldExample wouldn't work, only http://localhost:80/examples/servlet/HelloWorldExample works.
It appears to me that when requests are relayed from Apache to tomcat, you need to tell tomcat that you intend to invoke a servlet by prefixing '/servlet/', if you look in the server.xml, it has
<RequestInterceptor
className="org.apache.tomcat.request.InvokerInterceptor"
debug="0" prefix="/servlet/" />
I've tried to change this to something else, it didn't seem to make any difference. -
Order of servlet mapping in web.xml
Hello,
is the order of multiple <servlet-mapping> in web.xml important? Or it doesn't matter in which order they are declared?
For example, if i have two controllers, one is
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
and the second:
<servlet>
<servlet-name>FrontController</servlet-name>
<servlet-class>servlets.FrontController</servlet-class>
</servlet>
and the mapping are:
<servlet-mapping>
<servlet-name>FrontController</servlet-name>
<url-pattern>/jsf/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>where /jsf/ contains jsp pages containing jsf components.
is the order important?
And may second question is:
if i call the jsp page test.jsf in /jsf/test.jsp , which controller is responseble? Faces servlet or Frontcontroller?Here is what the 2.4 specification says on the matter (section SRV.11.1):
>
The path used for mapping to a servlet is the request URL from the request
object minus the context path and the path parameters. The URL path mapping rules below are used in order. The first successful match is used with no further matches attempted:
1. The container will try to find an exact match of the path of the request to the
path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix. This is done by stepping down the path tree a directory at a time, using the �/� character as a path separator. The longest match determines the servlet selected.
3. If the last segment in the URL path contains an extension (e.g. .jsp), the servlet container will try to match a servlet that handles requests for the extension. An extension is defined as the part of the last segment after the last �.� character.
4. If neither of the previous three rules result in a servlet match, the container will attempt to serve content appropriate for the resource requested. If a "default" servlet is defined for the application, it will be used.
The container must use case-sensitive string comparisons for matching.
It also notes that in prior versions of the specification these were only a suggestion so if you are on servlet 2.3 or prior, you need to consult the documentation for your container.
So, to answer your questions, no, order in the descriptor is not important.
Also, based on the rules above, using your mappings, any URL starting with /jsf will be handled by FrontController including /jsf/test.jsp and /jsf/test.jsf. -
About wls6.0 servlet mapping
I do the wls6.0 servlet,I copy wls example helloservletExample in
the mydomain\application\DefaultWebApp_myserver\web-inf\clsses\
and modify the xml file
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
HelloWorldExample
</servlet-name>
<servlet-class>
HelloWorldExample
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>
HelloWorldExample
</servlet-name>
<url-pattern>
quickstart
</url-pattern>
</web-app>
but when I run it http://localhost:7001/HelloWorldExample
it said not found ,how can I resolve it,can anybody help me?
1) Make sure you specified the correct class file name. If you copied from
our examples directory it should be
examples.servlets.HelloWorldServlet.
2) Also your url-pattern was set to quickstart. So you should point y our
browser to http://localhost/HelloWorldExamples/quickstart
Read our docs
Kumar
blackwhites wrote:
> I do the wls6.0 servlet,I copy wls example helloservletExample in
> the mydomain\application\DefaultWebApp_myserver\web-inf\clsses\
> and modify the xml file
> <?xml version="1.0" ?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 1.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> <web-app>
> <servlet>
> <servlet-name>
> HelloWorldExample
> </servlet-name>
> <servlet-class>
> HelloWorldExample
> </servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>
> HelloWorldExample
> </servlet-name>
> <url-pattern>
> quickstart
> </url-pattern>
> </web-app>
> but when I run it http://localhost:7001/HelloWorldExample
> it said not found ,how can I resolve it,can anybody help me?
-
How to handle manipulated servlet mapping entries?
I am building a struts based web application with action url-pattern set to "*.do". During the test, I could break the application by enter wrong action name or wrong extentions such as "*.doo" .
The global application exception handler won't handle this since it treat it as an correct action and try to look up it .
For example, if the correct action mapping url is "member.do". I can break it by change to "mem.do" or "member.doo".
The error message i got is:
type Status report
message /member.doo
description The requested resource (/member.doo) is not available.
Thanks all for the help!
---------------------------Your web.xml file is where you configure which requests get handled by the struts framework.
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>This is where it says "anything ending with ".do" is handled by the struts action servlet.
Is that what you mean maybe?
BTW I don't think you should have to handle users typing in *.doo into the address bar. There have to be SOME limits. -
Sun ONE application server 8 servlet mapping
Hi
How can I servlet map on application server 8. I have used application server 7 and it is quite simple. My problem is not "how to servlet map", but it is can you it be done on application server 8. There must be a way to servlet map just with the deploytool. I just can find it. Can you some tell me where?
Thanks.Once you pull the war/ear into deploytool.
Click on the servlet. You will see a tab for aliases.
Maybe you are looking for
-
MRP - How to set PR to be firmed after released?
Dear SAP Experts, I have a question related to MRP. In my client, the MRP run will create PR directly without Planned Order. The problem is, the MRP will delete the PR if the reservation is cancelled; even if the PR is already released. Is there any
-
Hy, I am sampling 3 analog channel with an external sample clock from quadrature encoder (via a pulse per each falling and rising edge of the channel A and B). When I go over 50 Khz I have the Error 200019. How is it possible? I have a PCI6221 250KS
-
Not able to go to servlet page..
Hello everyone. I am a new bee. I was trying to write a very simple sevlet code which takes form data from 1 html page and displays the form field on another page. My code is something like this in MyEclipse.The Project name is ThreeServlets. The dir
-
Windows installer won't format partition correctly.
I'm not very tech minded so Ill try to explain best I can. I am trying to partition mac to install windows. First step: I use Bootcamp to create the partition, the mac restarts and boots to windows installer. However the product key can't be verified
-
i want backup oracle using tandberg type with rman i donnot know how to do it details: oracle runs 24/7 Does anyone have the idea?