Re: Servlets and JSP Error Pages

2001-10-01 Thread Zsolt Horvath

I think it's easier:
Put this line every JSP:

1. %@ page errorPage=errorHandler.jsp%
2. Create an errorhandler JSP. (Example is attached.)

Every throwable error will redirect to errorhandler.jsp.

bye: horZsolt

- Original Message -
From: Arnaud Héritier [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 01, 2001 3:45 PM
Subject: RE: Servlets and JSP Error Pages


It's not a really clean solution but you can do it like this :

try{
.
}catch(Exception e){
RequestDispatcher rd =
getServletContext().getRequestDispatcher(MyErrorPage.jsp);
request.setAttribute(javax.servlet.jsp.jspException, e);
rd.forward(request, response);
}

I tested it and it works.

arno

 -Message d'origine-
 De: Brendan McKenna [SMTP:[EMAIL PROTECTED]]
 Date: lundi 1 octobre 2001 15:35
 À: [EMAIL PROTECTED]
 Objet: Servlets and JSP Error Pages

 Hi,

 Is there a way to route exceptions thrown in servlets to a JSP
 error page?


 Brendan
 --
 Brendan McKennaEmail: [EMAIL PROTECTED]
 Development StrategistPhone: +353-61-338177
 Taringold Ltd.Fax:   +353-61-338065




 errorHandler.jsp


Re: NullPointerException in getSession

2001-10-01 Thread Zsolt Horvath

You get this error message in 2 cases:

1. You want to acces the session, but it doesn't exist (use
getSession(true))
2. You want to acces a session value, but it doesn't exist:
e.g: request.getSession().getValue(ANYTHING), and ANYTHING variable
not in the session.



- Original Message -
From: Manu KY [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 01, 2001 4:34 PM
Subject: Re: NullPointerException in getSession


 Hi,
 please paste the code for easy debugging!!!.

 did you do getSession(true)?

 Manu
 Hi all. Does anyone know a solution to the exception presented
 below? It happens when I try to get an http session.
 The interesting thing is that this problem is not deterministic:
 sometimes it happens and sometimes it does not (obviously, using
 the same code and the same environment).
 
 Any help is welcome!
 
 Thanks,
 
 Daniel Novy.
 
 java.lang.NullPointerException
  at
 org.apache.tomcat.core.RequestImpl.getSession(RequestImpl.java:497)
  at

org.apache.tomcat.facade.HttpServletRequestFacade.getSession(HttpServletReq
u
 estFacade.java:382)
  at cetip.web.CtpRequest.getHttpSession(CtpRequest.java:350)
  at cetip.web.CtpWebUser.getSessionAttribute(CtpWebUser.java:467)


 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com






Re: precompiling JSP

2001-08-24 Thread Zsolt Horvath

  public void precompileFile(File file) {

  try {
URL precompileURL = new URL(rootURL,
file.getName()+?jsp_precompile=true);
HttpURLConnection conn = (HttpURLConnection)
precompileURL.openConnection();
int responseCode = conn.getResponseCode();

  }catch (Exception exc) {
System.out.println(Exception: +exc.toString()+ for
+startDir+file.getName());
  }
  }

- Original Message -
From: Atanas Michev [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 24, 2001 11:17 AM
Subject: precompiling JSP


 Hi,
 I would appreciate if someone can tell me how to:
 - precompile a JSP file step by step
 - precompile more than one JSP file in one Servlet in order to make faster
 their approaching when calling them for the first time.

 Many thanks in advance
 Atanas

 _
 Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp






web.xml

2001-08-17 Thread Zsolt Horvath

Hi !
How can I set more than 1 context-parameter in the WEB.XML file. I do this:
context-param
  param-nameserverIp/param-name
  param-value192.168.2.3/param-value
  descriptionMT web application/description
  param-namejobType_1/param-name
  param-value01./param-value
  descriptionMT web application/description
/context-param
, but when I ask this parameter's value's in JSP I get NULL ! If I use only
one context-parameter no problem

Anybody can help me?




Re: Direct servlet Access ?

2001-07-27 Thread Zsolt Horvath

/servlet/com.fivia.adfront.sales.Test


- Original Message -
From: Loïc Lefèvre [EMAIL PROTECTED]
To: Mailing List Tomcat [EMAIL PROTECTED]
Sent: Friday, July 27, 2001 4:20 PM
Subject: Direct servlet Access ?


 The story continue...

 I've reinstalled Tomcat 3.2.3 on my server and
 http://lol.fivia.com:8080/examples/servlet/HelloWorldExample works well.
 I have installed a war file that work well on NT in [linux]
 %TOMCAT_HOME%/webapps
 What is the url to access the class Test (com.fivia.adfront.sales.Test) ?

 server.xml:
 ...
 Context path=
  docBase=webapps/adfront
  crossContext=false
  debug=0
  reloadable=true 
 /Context
 ...

 [adfront.war].web.xml:
 ...
 web-app

 servlet
 servlet-nameAdFront/servlet-name
 servlet-classcom.fivia.adfront.sales.Test/servlet-class
 /servlet

 servlet-mapping
 servlet-nameAdFront/servlet-name
 url-pattern/adfront/url-pattern
 /servlet-mapping

 session-config
 session-timeout30/session-timeout
 /session-config

 /web-app







getinitParameter

2001-07-17 Thread Zsolt Horvath




Hi 
!I have a web.xml file with this 
lines: 
context-param 
param-namevalami/param-name 
param-valuesun.jdbc.odbc.JdbcOdbcDriver/param-value 
description The database 
driver's type.  
/description 
/context-param 
servlet-namegetInit/servlet-name 
descriptionNo desc. 
/description 
servlet-classgetinit.mainServlet/servlet-class 
init-param 
param-namevalami/paramName 
param-valuecom.mycompany.myactions.ListOrdersAction/param-value 
/init-param /servletHow can I acces 
the valami variable inside a servlet (in JSP works). I use 
getServletConfig.getInitParameter("valami") and I always get null !!! I don't 
understand !!!
Or I have to 
use getServletContext.getInitParameter instead 
?Thanx.


Re: How to pass init parameter to a JSP

2001-07-17 Thread Zsolt Horvath

...
%! String variable = ;%

% variable = getServletContext().getInitParameter(variable);%
The value is: %=variable%

...
- Original Message - 
From: Simon Chan [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 17, 2001 12:24 PM
Subject: How to pass init parameter to a JSP


 Hi,
 
 How to pass initial parameters to a JSP?  I know how to pass initial
 parameters to a servlet via web.xml file (init-param). However, I
 don't know where to put for JSP.  This is my JSP file
 
 ...
 %
 String c = config.getInitParameter(cfg);
 ...
 
 
 Thanks in advance
 
 
 skc
 
 
 




Re: How to make a war file

2001-07-03 Thread Zsolt Horvath

Hi !

See the attached files. Edit the build.xml and change this line:
  property name=app.name   value=SB_URM/
Set the value to your application's directory name, and run the batch. Thats
it.



- Original Message -
From: Anshul [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 10:51 AM
Subject: How to make a war file


 I have got all the file structure ready to make this archive. But how do
we
 create one? I didn't find it being demonstrated at any place.
 I studied that it's similar to jar. So what do I do? jar cvf xyz.jar abc?
 And rename xyz.jar to xyz.war?




!-- A project describes a set of targets that may be requested
 when Ant is executed.  The default attribute defines the
 target which is executed if no specific target is requested,
 and the basedir attribute defines the current working directory
 from which Ant executes the requested task.  This is normally
 set to the current working directory.
--


project name=Schichtbuch default=dist basedir=.


!-- Property Definitions

 Each of the following properties are used by convention in this
 build file.  The values specified can be overridden at run time by
 adding a -Dname=value argument to the command line that invokes Ant.
 This technique is normally used to copy the values of the ANT_HOME
 and TOMCAT_HOME environment variables into the ant.home and
 tomcat.home properties, which are normally not defined explicitly.

 app.name  Base name of this application, used to
   construct filenames and directories.

 deploy.home   The name of the directory into which the
   deployment hierarchy will be created.
   Normally, this will be the name of a
   subdirectory under $TOMCAT_HOME/webapps.

 dist.home	   The name of the base directory in which
   distribution files are created.

 dist.src  The name of the distribution JAR file
   containing the application source code,
   to be stored in the dist.home directory.
   This filename should end with .jar.

 dist.war  The name of the Web ARchive (WAR) file
   containing our deployable application.
   This filename should end with .war.

 javadoc.home  The name of the base directory in which
   the JavaDoc documentation for this application
   is generated.

 tomcat.home   The name of the base directory in which
   Tomcat has been installed.  This value is
   normally set automatically from the value
   of the TOMCAT_HOME environment variable.

 In the example below, the application being developed will be deployed
 to a subdirectory named myapp, and will therefore be accessible at:

   http://localhost:8080/myapp
--

  property name=app.name   value=SB_URM/
  property name=deploy.homevalue=${tomcat.home}/webapps/${app.name}/
  property name=dist.home  value=${deploy.home}/
  property name=dist.src   value=${app.name}.jar/
  property name=dist.war   value=${app.name}.war/
  property name=javadoc.home   value=${deploy.home}/javadoc/


!-- The prepare target is used to construct the deployment home
 directory structure (if necessary), and to copy in static files
 as required.  In the example below, Ant is instructed to create
 the deployment directory, copy the contents of the web/ source
 hierarchy, and set up the WEB-INF subdirectory appropriately.
copydir src=web dest=${deploy.home}/
mkdir dir=${deploy.home}/WEB-INF/
copyfile src=etc/web.xml dest=${deploy.home}/WEB-INF/web.xml/

--

  target name=prepare
mkdir dir=${deploy.home}/
mkdir dir=${deploy.home}/WEB-INF/classes/
mkdir dir=${deploy.home}/WEB-INF/lib/
copydir src=${deploy.home}/WEB-INF/lib dest=${deploy.home}/lib/
copydir src=${deploy.home}/WEB-INF/classes dest=${deploy.home}/classes/
mkdir dir=${javadoc.home}/
  /target


!-- The clean target removes the deployment home directory structure,
 so that the next time the compile target is requested, it will need
 to compile everything from scratch.
--

  target name=clean
deltree dir=${deploy.home}/
  /target


!-- The compile target is used to compile (or recompile) the Java classes
 that make up this web application.  The recommended source code directory
 structure makes this very easy because the javac task automatically
 works its way down a source code hierarchy and compiles any class that
 has not yet been compiled, or where the source file is newer than the
 class file.  After compilation is complete, any non-Java files (such as
 properties files containing resource bundles) found in the source code
 hierarchy are copied to a 

Servlet registration

2001-04-11 Thread Zsolt Horvath



Hi !

How could I register my own servlets into TomCat 
??

I put them into the 
%TOMCAT_HOME%/webapps/myapp/Web-inf/classes directory. AfterI create a 
web.xml file in the %TOMCAT_HOME%/webapps/myapp directory. The web.xml file 
contains this:

!DOCTYPE web-app PUBLIC "-//Sun Microsystems, 
Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"

web-app

 display-name Web 
Application/display-name

 
servlet 
servlet-nameServlet1/servlet-name 
servlet-classServlet1/servlet-class 
/servlet

 
servlet-mapping 
servlet-nameServlet1/servlet-name 
url-pattern/Servlet1/url-pattern 
/servlet-mapping

/web-app

And I restarted the tomcat, but it doesn`t work ! 
What`s wrong? 
Please help for me: [EMAIL PROTECTED]



Servlet registration

2001-04-11 Thread Zsolt Horvath

Hi !

How could I register my own servlets into TomCat ??

I put them into the %TOMCAT_HOME%/webapps/myapp/Web-inf/classes directory.
After I create a web.xml file in the %TOMCAT_HOME%/webapps/myapp directory.
The web.xml file contains this:

!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"

web-app

display-name Web Application/display-name

servlet
  servlet-nameServlet1/servlet-name
  servlet-classServlet1/servlet-class
/servlet

servlet-mapping
  servlet-nameServlet1/servlet-name
  url-pattern/Servlet1/url-pattern
/servlet-mapping

/web-app

And I restarted the tomcat, but it doesn`t work ! What`s wrong?
Please help for me: [EMAIL PROTECTED]