Link to home
Start Free TrialLog in
Avatar of princehyderabad
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------------------value
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.nextElement();  
   
// 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.getParameter(name);
       Approval aqc = (Approval) session.getAttribute(ObjName);              
      String[] records_seq =aqc.getPendingSeqs(",").split(",");
            for (int i=0; i<records_seq.length; i++)
              {                
                 out.print("<BR>SEQS:"+records_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:"+studentId );
             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.
         }
     }
 }  

Avatar of fargo
fargo

//?? 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.

Not clear man.

Ok. if u wish to get the SID, which is in session..u can simply get it like
session.getAttribute("ID_line_1");



Avatar of princehyderabad

ASKER

I got my solution thru other source. I need to delete this question.

thx
PH
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial