I have a JSP page. I have 3 text fields here. I enter some values and submit the form. It talks to the server, does some DB ops and refreshes itself. Here, after the refresh, I want the values that were entered before to be retained with the text fields. so that I can reuse them. I know I can use session for this and I have data stored in session also. But I dont understand how to use it in a jsp page. The session value would be null for the first time the page is loaded and later on it will have values. so, how to have this validation for a text field? I am using some thing like <input type="text" name="endDate" size="8" value="<%=request.getSession().getAttribute("date").getEndDate()%>"> but this is throwing compilation error. Is this wrong? can this be done in any other way other than what I am doing here? Thanks, Padma.
request.getSession().getAttribute("date") returns an object, you have to typecast it to the object you want (theObjectYouWant)request.getSession().getAttribute("date")
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Joined: Sep 16, 2002
Jyothsna, This didn't work. when I made these changes and opened up, I got an error. The initial login page itself didn't open. when i remove this statement, it works well. can't track what's up with this :roll: Padma.
Welcome to the Ranch Raghavan and jyothsna j! You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it. Thanks! bear JSP Forum Bartender [ October 27, 2003: Message edited by: Bear Bibeault ]