Logic for Code - HELP

Posted on 2006-04-27
Last Modified: 2010-04-01
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:
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++)

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

Question by:princehyderabad
    LVL 11

    Expert Comment

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


    Author Comment

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


    Accepted Solution

    Closed, 125 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Suggested Solutions

    ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now