hi
this is web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
"http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app>
  <display-name>Chapter</display-name>
  
    <servlet-name>chapter9servlet</servlet-name>
    <servlet-class>call.Chapter9Servlet</servlet-class>
  
  <servlet-mapping>
    <servlet-name>chapter9servlet</servlet-name>
    <url-pattern>/chapter9servlet</url-pattern>
  </servlet-mapping>
</web-app>


AND THIS IS THE WHOLE SERVLET

import java.util.*;
import javax.servlet.*;

import javax.servlet.http.*;
import java.io.*;

public class Chapter9Servlet extends HttpServlet {

        public void init(ServletConfig config)throws ServletException{
                super.init(config);
        }

        //doGet will be called when a GET request is received.
        public void doGet(HttpServletRequest request, HttpServletResponse response){
        //get field value in the query string
        String value = request.getParameter("request");
        //turn auto flush on
        try{
          PrintWriter out = new PrintWriter(response.getOutputStream(), true);

          // call getResult to get the  current timestamp
          String message = getResult(value);
          //send an HTML response back to the client
          response.setContentType("text/html");
          response.setContentLength(message.length());
          out.println(message);
        }
        catch(IOException e){}
        }

        //dopost will be called when post request is received.
        public void doPost (HttpServletRequest request,
        HttpServletResponse response)throws ServletException,IOException{
                String name="";
                String value="";

                try{
                        BufferedReader br = request.getReader();
                        String line;
                        System.out.println("abhee boaly too");
                        String requeststring = "";
                        while((line = br.readLine()) != null){
                                requeststring = requeststring + line;
                        }
                        StringTokenizer sTokenizer = new 
StringTokenizer(requeststring, "=");
                        if(sTokenizer.hasMoreTokens())
                                name = (String) sTokenizer.nextToken();
                        if(sTokenizer.hasMoreTokens())
                                value = (String) sTokenizer.nextToken();
                }
                catch(Exception e){
                        System.err.println(e);
                }
                //turn auto flush on
                PrintWriter out = new PrintWriter(response.getOutputStream(),true);
                String message = getResult(value);
                response.setContentType("text/html");
                response.setContentLength(message.length());
                out.println(message);
        }

        //get current timestamp and put it into HTML format
        public String getResult(String method){
                String message = "";
                //if hte query string value is "gettimstamp"
                //then current local timestamp is returned
                if(method.equals("gettimestamp")){
                        TimeZone timezone = TimeZone.getDefault();
                        Calendar calendar = Calendar.getInstance(timezone);
                        String local_time = calendar.getTime().toString();
                       // message = message+""+local_time+"\n";
                        message = message+
                        "web servers local time is \n";
                        message = message+local_time;
                }
                else{
                        //otherwise an error message is returned
                        message = message+
                        "Error\n";
                        message = message+
                        "Unrecoganized method name\n";
                }
                return message;
        }
}


AND THIS IS EXECUTION OF JBOSS...

C:\jbuilderx\jdk1.4\bin\javaw -classpath 
"C:\jboss-3.2.5\bin\run.jar;C:\jbuilderx\jdk1.4\lib\tools.jar"  
-Djava.io.tmpdir=C:/jboss-3.2.5/server/default/tmp/deploy/server/default/deploy/work  
-Dprogram.name=run.bat -Xms128m -Xmx512m 
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl
 -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl 
org.jboss.Main  -c default
09:00:08,859 INFO  [Server] Starting JBoss (MX MicroKernel)...09:00:08,875 INFO  
[Server] Release ID: JBoss [WonderLand] 3.2.5 (build: CVSTag=JBoss_3_2_5 
date=200406251954)09:00:08,875 INFO  [Server] Home Dir: C:\jboss-3.2.509:00:08,875 
INFO  [Server] Home URL: file:/C:/jboss-3.2.5/09:00:08,875 INFO  [Server] Library URL: 
file:/C:/jboss-3.2.5/lib/09:00:08,875 INFO  [Server] Patch URL: null09:00:08,953 INFO  
[Server] Server Name: default09:00:08,953 INFO  [Server] Server Home Dir: 
C:\jboss-3.2.5\server\default09:00:08,953 INFO  [Server] Server Home URL: 
file:/C:/jboss-3.2.5/server/default/09:00:08,953 INFO  [Server] Server Data Dir: 
C:\jboss-3.2.5\server\default\data09:00:08,953 INFO  [Server] Server Temp Dir: 
C:\jboss-3.2.5\server\default\tmp09:00:08,953 INFO  [Server] Server Config URL: 
file:/C:/jboss-3.2.5/server/default/conf/09:00:08,984 INFO  [Server] Server Library 
URL: file:/C:/jboss-3.2.5/server/default/lib/09:00:08,984 INFO  [Server] Root 
Deployment Filename: jboss-service.xml09:00:08,984 INFO  [Server] Starting General 
Purpose Architecture (GPA)...09:00:10,265 INFO  [ServerInfo] Java version: 
1.4.2_01,Sun Microsystems Inc.09:00:10,265 INFO  [ServerInfo] Java VM: Java 
HotSpot(TM) Client VM 1.4.2_01-b06,Sun Microsystems Inc.09:00:10,265 INFO  
[ServerInfo] OS-System: Windows 2000 5.0,x8609:00:10,703 INFO  [Server] Core system 
initialized09:00:12,781 INFO  [Log4jService$URLWatchTimerTask] Configuring from URL: 
resource:log4j.xml09:00:13,328 INFO  [WebService] Using RMI server codebase: 
http://windows:8083/09:00:13,562 INFO  [NamingService] Started jnpPort=1099, 
rmiPort=1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null, Server 
[EMAIL PROTECTED]:00:16,234 INFO  [RARMetaData] Loading JBoss Resource Adapter for 
JDBC 2 XA drivers09:00:16,234 INFO  [RARMetaData] Required license terms present. See 
deployment descriptor.09:00:20,812 INFO  [MailService] Mail Service bound to 
java:/Mail09:00:21,375 INFO  [Embedded] Catalina naming disabled09:00:22,000 INFO  
[Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-808009:00:22,046 INFO  
[Catalina] Initialization processed in 625 ms09:00:22,046 INFO  [StandardService] 
Starting service jboss.web09:00:22,046 INFO  [StandardEngine] Starting Servlet Engine: 
Apache Tomcat/5.0.2609:00:22,062 INFO  [StandardHost] XML validation 
disabled09:00:22,125 INFO  [Catalina] Server startup in 79 ms09:00:22,265 WARN  
[DeploymentInfo] Only the root deployment can set the loader repository, ingoring 
config=null09:00:22,281 INFO  [TomcatDeployer] deploy, ctxPath=/invoker, 
warUrl=file:/C:/jboss-3.2.5/server/default/deploy/http-invoker.sar/invoker.war/09:00:23,187
 WARN  [DeploymentInfo] Only the root deployment can set the loader repository, 
ingoring config=null09:00:23,187 INFO  [TomcatDeployer] deploy, ctxPath=, 
warUrl=file:/C:/jboss-3.2.5/server/default/deploy/jbossweb-tomcat50.sar/ROOT.war/09:00:23,375
 WARN  [DeploymentInfo] Only the root deployment can set the loader repository, 
ingoring config=null09:00:23,375 INFO  [TomcatDeployer] deploy, 
ctxPath=/jbossmq-httpil, 
warUrl=file:/C:/jboss-3.2.5/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/09:00:23,609
 INFO  [DefaultDS] Bound connection factory for resource adapter for ConnectionManager 
'jboss.jca:service=LocalTxCM,name=DefaultDS to JNDI name 'java:/DefaultDS'09:00:23,625 
INFO  [JmsXA] Bound connection factory for resource adapter for ConnectionManager 
'jboss.jca:service=TxCM,name=JmsXA to JNDI name 'java:/JmsXA'09:00:24,328 INFO  [A] 
Bound to JNDI name: queue/A09:00:24,328 INFO  [B] Bound to JNDI name: 
queue/B09:00:24,328 INFO  [C] Bound to JNDI name: queue/C09:00:24,328 INFO  [D] Bound 
to JNDI name: queue/D09:00:24,328 INFO  [ex] Bound to JNDI name: queue/ex09:00:24,546 
INFO  [testTopic] Bound to JNDI name: topic/testTopic09:00:24,546 INFO  [securedTopic] 
Bound to JNDI name: topic/securedTopic09:00:24,546 INFO  [testDurableTopic] Bound to 
JNDI name: topic/testDurableTopic09:00:24,546 INFO  [testQueue] Bound to JNDI name: 
queue/testQueue09:00:24,906 INFO  [DLQ] Bound to JNDI name: queue/DLQ09:00:25,125 INFO 
 [UILServerILService] JBossMQ UIL service available at : /0.0.0.0:809309:00:25,296 
INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console, 
warUrl=file:/C:/jboss-3.2.5/server/default/deploy/jmx-console.war/09:00:25,875 INFO  
[TomcatDeployer] deploy, ctxPath=/web-console, 
warUrl=file:/C:/jboss-3.2.5/server/default/tmp/deploy/tmp30552web-console.war/09:00:26,609
 INFO  [Server] JBoss (MX MicroKernel) [3.2.5 (build: CVSTag=JBoss_3_2_5 
date=200406251954)] Started in 17s:625ms09:00:26,609 INFO  [Tomcat5] Saw 
org.jboss.system.server.started notification, starting connectors09:00:26,656 INFO  
[Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-808009:00:26,828 INFO  
[ChannelSocket] JK2: ajp13 listening on /0.0.0.0:800909:00:26,906 INFO  [JkMain] Jk 
running ID=0 time=0/110  config=null

AND FOR Min-chang Cha

>Where did you deploy your servlet? 
every thing is done by JBuilder X, i didnt do any thing.

>Tomcat service is now running in JBoss? 
How will i know that??
im using jboss-3.2.5

sory if im being toooo dubm :(

Waiting...


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852517#3852517

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852517


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to