Hi there,
well I have found a solution! Although it is very simple, it took me hours to find
it.
Anyway..!
Let's assume that the web.xml it is placed in the folder:" /webapps/wap/WEB-INF",
and is the following:
<servlet>
<servlet-name> waptest </servlet-name>
<servlet-class> PageViewer </servlet-class>
<init-param>
<param-name>dataFile</param-name>
<param-value>servlet.dat</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name> waptest </servlet-name>
<url-pattern> /wap/* </url-pattern>
</servlet-mapping>
To get the init parameter and later the file (servlet.dat) you have to do the
following:
<code snippet>
public class PageViewer extends HttpServlet {
private String paramN = null;
private String path = null;
public void init( ServletConfig config) throws ServletException {
super.init( config);
paramN = getInitParameter( "dataFile");
if (paramN!=null ){
path = config.getServletContext().getRealPath( paramN );
//..Maybe some intresting log
log("File found at: "+ path);
} else{
log("file not found");
}
}
</code snippet>
Then to test the application, you have to reference to the alias of the Servlet,
which in this case is waptest.
i.g : http://127.0.0.1:8080/wap/servlet/waptest
Hope that this help, it worked in my case. ;-)
See you!
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html