sample jsp servlet application required  
Author Message
ramiz





PostPosted: 2006-7-16 22:57:00 Top

java-programmer, sample jsp servlet application required 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...

 
dimebt





PostPosted: 2006-7-17 0:26:00 Top

java-programmer >> sample jsp servlet application required 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. :))

 
Mark Space





PostPosted: 2006-7-17 0:50:00 Top

java-programmer >> sample jsp servlet application required ramiz wrote:
> 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.
 
 
ramiz





PostPosted: 2006-7-17 11:31:00 Top

java-programmer >> sample jsp servlet application required
email***@***.com wrote:
> 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

 
 
ramiz





PostPosted: 2006-7-17 11:34:00 Top

java-programmer >> sample jsp servlet application required
Mark Space wrote:
> ramiz wrote:
> > 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.

thanks for ur reply
regards,
ramiz