sample jsp servlet application required

R

ramiz

Hi geeks,
I'm a beginner in jsp and servlets, i want a sample JSP-SERVLET
applicaton with source code. Can you please tell me where can i get the
sample applications.
Thanks in advance...
 
D

dimebt

Here is the simplest :))


=======================================================
index.jsp :


<html>
<body>
<jsp:useBean id="myBean" class="MyServlet" scope="session"/>
Here is the value of the String from the Servlet:
<%= myBean.getMyString() %>

</body>
</html>


=======================================================
MyServlet.java



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

public class MyServlet {

public String getMyString(){

return "This is my return String";

}

}

=======================================================

And that should be it. :))
 
M

Mark Space

ramiz said:
Hi geeks,
I'm a beginner in jsp and servlets, i want a sample JSP-SERVLET
applicaton with source code. Can you please tell me where can i get the
sample applications.
Thanks in advance...

Doesn't Tomcat install a default application? I'm sure it does,
although I'm not certain that it installs any JSP servlets. I think it
does because you can self test Tomcat with some of the default servlets.

Anyhoo, check your default app, probably some good examples there.
 
R

ramiz

Here is the simplest :))


=======================================================
index.jsp :


<html>
<body>
<jsp:useBean id="myBean" class="MyServlet" scope="session"/>
Here is the value of the String from the Servlet:
<%= myBean.getMyString() %>

</body>
</html>


=======================================================
MyServlet.java



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

public class MyServlet {

public String getMyString(){

return "This is my return String";

}

}

=======================================================

And that should be it. :))

thanks for ur reply

regards,
ramiz
 
R

ramiz

Mark said:
Doesn't Tomcat install a default application? I'm sure it does,
although I'm not certain that it installs any JSP servlets. I think it
does because you can self test Tomcat with some of the default servlets.

Anyhoo, check your default app, probably some good examples there.

thanks for ur reply
regards,
ramiz
 
Joined
Apr 24, 2008
Messages
2
Reaction score
0
hi i m new to j2ee application wants to creat e a new web application. plz help me . i have apache tomcat, and eclipse 3.0.1 installed with me.
plz tell how 2 create servelet class,
 
Joined
Apr 24, 2008
Messages
2
Reaction score
0
J2EEApplication

Hi
I would like 2 know how 2 create the web application...in j2ee with Jsp and servlet. and got 2 know that v have 2 create .. own directory structure. and or it 'll automatically created.. with eclipse/...
tell me ASAP...
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top