Below is the scenario..
First Page Second Page
Radio button 1
Radio button 2
Submit.
I select the first Radio Button and submit and then i go to second page where i have some content. Now when i go back to first page the same radio button which i had selected must be viewed. Need help to view the selected radio button when i navigate to the first page.
Following is the code..
getName.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<<HTML>
<BODY>
<FORM METHOD=POST ACTION="SaveName.jsp">
<a href="getName.html" ><font color="red">First Page</font></a>
<a href="Second.jsp"><font color="red">Second Page</font></a><BR><BR>
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
<input type="radio" name="notify" value="Yes" >Yes
<br>
<input type="radio" name="notify" value="No">No
<br>
<P><INPUT TYPE=SUBMIT VALUE="Submit">
</FORM>
</BODY>
</HTML>
SaveName.jsp
<jsp:useBean id="user" class="User.UserData" scope="session"/>
<jsp:setProperty name="user" property="*"/>
<%
String name = request.getParameter( "username" );
session.setAttribute( "theName", name );
%>
<HTML>
<BODY>
You entered<BR>
Name: <%=user.getUsername()%><br>
Choice: <%=user.getNotify()%>
</BODY>
</HTML>
UserData.java
package User;
public class UserData {
String username;
private String notify;
public void setUsername( String value )
{
username = value;
}
public String getUsername() { return username; }
public String getNotify() {
return notify;
}
public void setNotify(String notify) {
this.notify = notify;
}
}
Please help..