•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,553 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,585 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 3088 | Replies: 2
![]() |
•
•
Join Date: Feb 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Hello Friends,
I am trying to learn JSP, Servlets at the moment.
What am trying to do : A simple text field and a button
What should happen : When you click the button a text should appear something which is specified in the code. for example, "Pradeep".
I am really finding it difficult at the moment to actually bring the JSp and Servlet in connection.
Can anyone help me??
It would be great to start of with a problem to be solved an dthen move ahead.
Thanks and Rgds,
Pradeep (KINO)
I am trying to learn JSP, Servlets at the moment.
What am trying to do : A simple text field and a button
What should happen : When you click the button a text should appear something which is specified in the code. for example, "Pradeep".
I am really finding it difficult at the moment to actually bring the JSp and Servlet in connection.
Can anyone help me??
It would be great to start of with a problem to be solved an dthen move ahead.
Thanks and Rgds,
Pradeep (KINO)
•
•
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation:
Rep Power: 18
Solved Threads: 191
the button (when activated) submits a post request to the servlet, the servlet sets some information in the http requests and forwards to the JSP.
What part of that don't you get working? It's rather basic...
What part of that don't you get working? It's rather basic...
42 Private messages asking for help will be ignored
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
In the frozen land of Nador they were forced to eat Steve's iMinstrels, and there was much rejoicing.
•
•
Join Date: Feb 2007
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
the button (when activated) submits a post request to the servlet, the servlet sets some information in the http requests and forwards to the JSP.
What part of that don't you get working? It's rather basic...
Hello Friend,
Index.jsp :
--------------------------------------------------------------
<html>
<head>
<title></title>
</head>
<body>
<h2></h2>
<form method="post" action="displayname">
<% String name="";%>
<% if(request==null){
name="";
}
else{
name=request.getParameter("name");
}
%>
Display Name:
<input type="text" name="name" value=<%=name%> />
<br>
<input type="submit" name="display" value="Display" />
</form>
</body>
</html>
-------------------------------------------------------
HelloServlet.java
-----------------------------------------------------------------------
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class HelloServlet extends HttpServlet{
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException{
request.setAttribute("name", "Pradeep");
getServletContext()
.getRequestDispatcher("/view.jsp").forward(request, response);
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException{
getServletContext()
.getRequestDispatcher("/view.jsp").forward(request, response);
}
}
--------------------------------------------------------------
Any wrong in this code??
please help me try to debug.. Thanks a lot!
- KINO
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
Similar Threads
- Searching a Text Field in a JList (Java)
- Text field does not enable on refresh (JavaScript / DHTML / AJAX)
- Filtering My sql through Php using drop down menu and text field (PHP)
- getting the text field value (HTML and CSS)
- DOB field-how to use text field and pop out calendar same time? (ASP)
- Output MySQL text field formatted (PHP)
Other Threads in the JSP Forum
- Previous Thread: Problem adding registration data to mysql database
- Next Thread: Communication Link Failure Error



Linear Mode