Link to home
Start Free TrialLog in
Avatar of DilrajSingh123
DilrajSingh123

asked on

concepts of web while using java servlets and websphere

hey there to all,i am doing web programming in using java servlets and websphere for three months now,and still could not grasp the whole concept of HTTP,HTTPGATEWAY,and how this architechure works exactly,as a whole collectivity..please suggest some sites or information or some tutorial that yo think will help me best..please help me!! i am giving maximum points for this as i think it is the base of rest of my programming career..!! i am waiting
Avatar of suprapto45
suprapto45
Flag of Singapore image

Hi,

I am going to give you the concept of Java Servlet and your application server (WebSphere). This is the flow.

First, your visitor will interact with your JSP page. Then in your form tag, you need to set the Action to your Servlet. It means that all the information in that page (if any) will be sent to your Servlet for further process i.e. <form action="/Servlet">

Then after that, your Servlet must extends HttpServlet and must have the methods of doPost or doGet. Here, you will get all the information from your JSP page to either save it to your DB or return it back to other JSP.

Real life example. Just imagine a simple login system where there is username and password. you will have your jsp page to have something like this.

<html>
<body>
</body>
<form action="/Servlet">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="submit">
</form>
</html>

Now, you will have your Servlet something like.

public class Servlet extends HttpServlet(...)
{
    public void doPost(...)
    {
         String username = request.getParameter("username");
         String password = request.getParameter("password");
    }
}

Now, you need to modify your web.xml to allow the form tag to call /Servlet.

So conclusively, the flow is JSP - Servlet - DB.

The role of WebSphere here is to take care everything such as connectivity to DB, understanding JSP page, scriptlet scripting and etc.

I will give you some URL. I hope that helps.
1. http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
2. http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-JSP.html
3. http://java.sun.com/docs/books/tutorial/servlets/

My suggestion is not to understand all the architecture. Please try to get your first servlet working first. Then after you start to familiarize yourself, you will start to know better and try to understand the architecture.

I hope that helps.

Regards
Dave
Avatar of DilrajSingh123
DilrajSingh123

ASKER

Hey Dave,
It helps man,I have many basic questions and i want some one to be my online teacher,i can give as many points as yu want for this as it i have unlimited membership,you can help me by saying yes to be my online teacher.

If yes let us start by another question.

when we use doGet() and when doPost()... what is similarity between two and what are differences?
Yes,

I will help you. I will start to reply you as soon as possible. Now I need to sleep.

Regards
Dave
ASKER CERTIFIED SOLUTION
Avatar of suprapto45
suprapto45
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks dave !!
regards,Dilraj.
Hi,

Glad I could help. just let me know if you have any other Question.

Regards
Dave