oi pessoas,

primeiro compilei o arquivo HelloWorld.java do endere�o http://www.mycgiserver.com/~jossobri/HelloWorld.java utilizando o utilities
java compiler do mycgiserver.com, e zazzzzz!!!
apareceu 
http://www.mycgiserver.com/~jossobri/HelloWorld.class

depois digitei http://www.mycgiserver.com/servlet/~jossobri.HelloWorld conforme instru��o do java servlets FAQ� abaixo:

1. I have the source files ready, what now?
The next step is compiling your servlet. You can compile it online by using 'javac online' in this area.
Another possibility is compiling them on your local machine. For being able to do so you'll need the Java Development Kit and Java Servlet Development Kit (JSDK).

2. How do I start my servlet?
For starting your servlet you need to use the account path to your servlet in conjunction with the servlet URL. For example, if you want to execute helloworld.class the URL would be:

http://www.mycgiserver.com/servlet/USERNAME.helloworld

We used to have a wrapper for being able to call servlets directly via the classfile, however this is disabled again as it created a conflict with java applets.

3. My servet is giving me a wrong classname error. Why?
What you've to take care about is the package name which has to reflect your username and the path where the servlet is stored.
Supposing that the username is 'testuser' and the path where the servlet class is stored is 'apps/work/test.class' (relative to your account root directory). Your package name would then look like the following:

testuser.apps.work

Set this package name, compile your servlet again and it will work.

4. I have my servlets ready in a jar file, how can I execute them?
You can't! If you want to use jar files with java you normally have to add the particular archive to the classpath. However this is not possible in this case, you can't modify the systems classpath.
If you simply want to be able to use a java class library stored in a jar which is freely available through the internet simply let us know and we'll install it in the main class repository.

5. Do I have my own servlet ZONE?
No, our members are sharing a single zone, the servlet engine wouldn't be able to cope with such a huge number of zones otherwise.

6. I want to write into the log with my servlet, how can I do that?
For writing log entries, use the log function as in the following example, which will writes the message 'MY PERSONAL LOG ENTRY' into the log:

public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
...
this.getServletContext().log("MY PERSONAL LOG ENTRY" + ": " + request.getServletPath());
...

If you want to log the content of a variable for example, the line would look like the following:

String strHelloTo = "World";

this.getServletContext().log(strHelloTo + ": " + request.getServletPath());

o resultado:

500 Servlet Exception

javax.servlet.ServletException: Class `~jossobri.HelloWord' was not found
in classpath.
Classes normally belong in /WEB-INF/classes.
	at com.caucho.server.http.Application.instantiateServlet(Application.java:2186)
	at com.caucho.server.http.Application.createServlet(Application.java:2118)
	at com.caucho.server.http.Application.loadServlet(Application.java:2091)
	at com.caucho.server.http.QServletConfig.loadServlet(QServletConfig.java:424)
	at com.caucho.server.http.Application.getFilterChainServlet(Application.java:1932)
	at com.caucho.server.http.Application.buildFilterChain(Application.java:1914)
	at com.caucho.server.http.Invocation.service(Invocation.java:289)
	at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:341)
	at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:268)
	at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
	at java.lang.Thread.run(Thread.java:543)
 
abra�os,


jose s sobrinho

icq 341548726
tel 55 11 9866 4609
www.mycgiserver.com/~jossobri



Busca Yahoo!
O servi�o de busca mais completo da Internet. O que voc� pensar o Yahoo! encontra.

Responder a