aspose file tools*
The moose likes Servlets and the fly likes JSP+Checkbox - Urgent !! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP+Checkbox - Urgent !!" Watch "JSP+Checkbox - Urgent !!" New topic
Author

JSP+Checkbox - Urgent !!

Rama moorthy
Greenhorn

Joined: May 18, 2001
Posts: 8
Dear Friends,
I give below my coding.My requirement is as below.
I am generating a table with three columns and one column is having a hyperlink and another 2 columns have checkboxes.
Basically it is for the candidate profile.
So after clicking the hyperlink ,i will get the second page wherein i will get the candidate details.After going thro'the same i will come back to first screen,where against the candidate name i will select the options provided in the two check boxes.I will repeat the procedure for the next candidate.
But the problem is that when i go for the second candidate and view his profile and after coming to the first page ,the status of the first candidates becomes blank and it is not setting back to the original position.
In a nutshell my settings at the checkboxes for the first candidate should not get changed even after going to and from the
first page.
My problem is that i should not use javascript.
My coding:
<%@ page language="java" session="true"%>
<%@ page import="javax.servlet.*,javax.servlet.http.*,java.util.*, java.sql.*, java.io.*" %>
<html>
<head>
<title>New Candidates</title></head>
<body>
<%!
String req =" ";
String jid =" ";
String cid =" ";
String ca_title =" ";
String status =" ";
String action =" ";
int count = 0;

Connection con;
ResultSet rs;
Statement st;
String sql;

%>
<%
req = request.getParameter("ca_title");

jid = request.getParameter("jid");
status = request.getParameter("status");
action = request.getParameter("action");

cid = request.getParameter("cid");

%>
<input type="hidden" name="ca_title" value="<%=req%>">
<input type="hidden" name="cid" value="<%=cid%>">
<input type="hidden" name="jid" value="<%=jid%>">
<p>New Candidates</p>
<p>Project Managers</p>
<p>(Click name for Profile Summary</p>
<p>
<table>
<tr><td>Candidate Name </td>
<td>Status </td>
<td>Action</td>
</tr>
<%

try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc dbc:info","shop","shop");
st = con.createStatement();
sql = "select candidateID,CAFirstName from candidate where catitle like '%"+req+"%'";
rs = st.executeQuery(sql);
while(rs.next())
{
String aa = rs.getString("candidateID");
String bb = rs.getString("CAFirstName");

%>
<tr><td><a href="http://localhost:8080/infodream/detail.jsp?cand_name=<%=bb.trim()%>&cand_id=<%=aa%>&jid=<%=jid%>&cid=<%=cid%>&ca_title=<%=req%>"><%=bb.tri m()%></td>
<td><SELECT name=status>
<OPTION value="<%=status%>" selected></OPTION>
<OPTION value=S>Selected</OPTION>
<OPTION value=R>Rejected</OPTION>
</SELECT><BR>
</td>
<td><SELECT name=action>
<OPTION value="<%=action%>" selected></OPTION>
<OPTION value=IWI>I Will Interview</OPTION>
<OPTION value=YS>You Screen</OPTION>
<OPTION value=C>Confirmed</OPTION>
</SELECT><BR>
</td>
</tr>

<%
}//while
}//try
catch(Exception e)
{
out.println("Exception "+e);
}
%>
</table><br><br><br><br><br>
<a href="http://localhost:8080/infodream/scrcandidates.html">Send</a>
<a href="http://localhost:8080/infodream/scrcandidates.html">Back</a>
<a href="http://localhost:8080/infodream/scrcandidates.html">Menu</a>
</p>

</body>
</html>
Please give your feedback.
Regards,
Ramamoorthy
NR Gopinath
Greenhorn

Joined: Jul 25, 2001
Posts: 9
Hello,
After seeing or entering candidate details thro' hyper link, are u reloading the page or simply coming back? if u reload the first page(page contains hyperlink and check box), then already checked boxes will come as empty.if u use javascript(history.back), then pervious information won't lost..
Rama moorthy
Greenhorn

Joined: May 18, 2001
Posts: 8
Dear Gopi,
Thanks for your reply.
As mentioned I CAN NOT USE JAVASCRIPT .Also i hv to reload the page.Can u explain any possibility of coming back to first page keeping the same status?
Regards,
Ramamoorthy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP+Checkbox - Urgent !!
 
Similar Threads
Unable to pass string in hidden field
<jsp:setProperty> sets null values in the bean
Pull down Problems
reading data from jsp page to another jsp page using request.getParameter
Returning a result set in an html form