princehyderabad
asked on
Logic for Code - HELP
hi experts,
Recently one update was asked to add to my JSP: Need help to arrang and get the correct logic for the code:
String SID= ID_line_1
session.setAttribute(SID, 303);
Parameter passed from other jsp look likes this:
Name------------------valu e
seqs_line_1 ID_line_1
comment_line_1 Student passed
-----------my Code--------
java.util.Enumeration allnames = request.getParameterNames( );
while (allnames.hasMoreElements( ))
{
String name = (String)allnames.nextEleme nt();
// this 1st if statment does some operation I dont want to change this one but only the 2nd if statment. But I need the seq# from here
if (name.startsWith("seqs"))
{
String ObjName = (String)request.getParamet er(name);
Approval aqc = (Approval) session.getAttribute(ObjNa me);
String[] records_seq =aqc.getPendingSeqs(",").s plit(",");
for (int i=0; i<records_seq.length; i++)
{
out.print("<BR>SEQS:"+reco rds_seq[i] );
}
}
// Bascially I'm trying below if statments to check if "comment_line_1" has values if so (ie not empty), then it should update DB with correcsponding sequence_id. So this sequence_id is linked with seqs_line_1 value ie "ID_line_1" which is session object. So using session get of ID_line_1 we actualy gets the seq#.
if (name.startsWith("comment_ line"))
{
String value = request.getParameter(name) ;
if (value != null && value.trim().length() > 0)
{
String[] parts = name.split("_");
String studentId = parts[2];
out.print("ID_NO:"+student Id );
out.print("Value:"+value);
//?? How to get "ID_line_1" value here (ie 303) so that I can do DB changes here
// ie for Record# 303, comment is "Student passed" is to be updated on comment table.
}
}
}
Recently one update was asked to add to my JSP: Need help to arrang and get the correct logic for the code:
String SID= ID_line_1
session.setAttribute(SID, 303);
Parameter passed from other jsp look likes this:
Name------------------valu
seqs_line_1 ID_line_1
comment_line_1 Student passed
-----------my Code--------
java.util.Enumeration allnames = request.getParameterNames(
while (allnames.hasMoreElements(
{
String name = (String)allnames.nextEleme
// this 1st if statment does some operation I dont want to change this one but only the 2nd if statment. But I need the seq# from here
if (name.startsWith("seqs"))
{
String ObjName = (String)request.getParamet
Approval aqc = (Approval) session.getAttribute(ObjNa
String[] records_seq =aqc.getPendingSeqs(",").s
for (int i=0; i<records_seq.length; i++)
{
out.print("<BR>SEQS:"+reco
}
}
// Bascially I'm trying below if statments to check if "comment_line_1" has values if so (ie not empty), then it should update DB with correcsponding sequence_id. So this sequence_id is linked with seqs_line_1 value ie "ID_line_1" which is session object. So using session get of ID_line_1 we actualy gets the seq#.
if (name.startsWith("comment_
{
String value = request.getParameter(name)
if (value != null && value.trim().length() > 0)
{
String[] parts = name.split("_");
String studentId = parts[2];
out.print("ID_NO:"+student
out.print("Value:"+value);
//?? How to get "ID_line_1" value here (ie 303) so that I can do DB changes here
// ie for Record# 303, comment is "Student passed" is to be updated on comment table.
}
}
}
ASKER
I got my solution thru other source. I need to delete this question.
thx
PH
thx
PH
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
// ie for Record# 303, comment is "Student passed" is to be updated on comment table.
Not clear man.
Ok. if u wish to get the SID, which is in session..u can simply get it like
session.getAttribute("ID_l