I have installed tomcat 4.1.6
I have created "Prashant" folder under  "webApps"

My Folder structure is

webapps-
        |_Prashant
                |_Web-inf
                                 |_Classes-----
                                 |_ web.xml     |_myservlet

in server.xml. I  added
<context path="/Prashant" docBase="Prashant"
debug="0" reloadable="true" crossContext="true" />

I could run JSP pages with URL "http://localhost:8080/Prashant/myjsp.jsp";
but my servlets are not runnng.
To run this servlet I entered URL"http://localhost:8080/Prashant/MyServlet";
I added following lines to web.xml files

<servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>testServlet</servlet-class>
</servlet>
<servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/MyServlet</url-pattern>
</servlet-mapping>

What should I do to run this servlet.

I my trying to use JDBC in JSP file, I added following lines to my servler.xml

<context path="/Prashant" docBase="Prashant"
        debug="0" reloadable="true" crossContext="true" >
        <NamingResources>
                <Resource name="jdbc/conversion" auth="Container"
                                type="javax.sql.DataSource"/>

                <ResourceParams name="jdbc/conversion">
                        <parameter>
                                <name>usernane</name>
                                <value>sa</value>
                        </parameter>
                        <parameter>
                                <name>password</name>
                                <value></value>
                        </parameter>
                        <parameter>
                                <name>driverClassName</name>
                                <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
                        </parameter>
                        <parameter>
                                <name>url</name>
                                <value>jdbc:odbc:test</value>
                        </parameter>
                </ResourceParams>
        </NamingResources>
</context>

&
in web.xml
<Resource name="jdbc/conversion" auth="Container"
                 type="javax.sql.DataSource"/>

But it throws Exception and gives message "Name jdbc is not bound in this Context"
following codes are written in JSP files


Context init = new InitialContext();
Context ctx = (Context) init.lookup("java:comp/env");
DataSource ds = (DataSource) ctx.lookup("jdbc/conversion");
Connection conn = ds.getConnection();

What else should I do to run these applications successfuly

can anybody help me. My mail id is [EMAIL PROTECTED]

_________________________________________________________________
Travel plans? Click here. http://www.msn.co.in/Travel Sit back & relax!


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to