Results 1 to 6 of 6
Thread: session
- 11-25-2008, 10:17 AM #1
Member
- Join Date
- Nov 2008
- Posts
- 12
- Rep Power
- 0
session
what will i do to display the inputted information such as FirstName and Lastname of the user to the next page...
for instance:
firstname:
lastname:
submit button
1 am the user and i will input my first and lastname above... then, when i will click the submit button, my inputted information will be displayed on the next page in the web...
how will i do that if i am going to use a servlet??
anyone plz...urgent...
- 11-25-2008, 01:11 PM #2
Member
- Join Date
- Nov 2008
- Posts
- 3
- Rep Power
- 0
On which page you want to display the given inputs, take the values from previous page as -
String name=request.getparametre("name");
String age=request.getparametre("age");
Now you can use variables name and age wherever you want to display them.
- 11-26-2008, 07:55 AM #3
Member
- Join Date
- Nov 2008
- Posts
- 12
- Rep Power
- 0
session
it doesn't function... still the same, it doesn't turn on the next page... i have here the codes but same result...
- 11-27-2008, 05:11 AM #4
Member
- Join Date
- Nov 2008
- Posts
- 3
- Rep Power
- 0
Can you please copy your code here...
- 11-27-2008, 07:57 AM #5
Member
- Join Date
- Nov 2008
- Posts
- 12
- Rep Power
- 0
session
here is the code....
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import bean.Information;
public class Request extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
private HttpSession session;
private RequestDispatcher dispatcher;
private Information bean;
private String go;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
session=request.getSession(true);
if (session!=null){
bean=(Information)session.getAttribute("isBean");
}
if (bean!=null){
if(request.getParameter("submit")!=null){
bean.setFirstName("firstName");
bean.setLastName("lastName");
bean=(Information)session.getAttribute("isBean");
go="Lst.jsp";
}
}
else{
Information bean=new Information();
}
dispatcher = request.getRequestDispatcher(go);
dispatcher.forward(request, response);
}
}
urgent... plz help me... I don't know the problem there....It has no error.. the problem is when i click the submit button, it doesn't move on the next page...:o
- 03-16-2009, 04:44 PM #6
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
how to create session in jsp
By sandip_ingle21 in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 04-21-2011, 03:10 AM -
Session and request in JSF
By felixtfelix in forum Web FrameworksReplies: 0Last Post: 05-08-2008, 05:10 PM -
session
By jm_it04 in forum AWT / SwingReplies: 0Last Post: 03-04-2008, 11:32 AM -
Refresh session
By cachi in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 08-07-2007, 07:52 AM -
Use session
By Eric in forum Java ServletReplies: 1Last Post: 07-05-2007, 08:34 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks