Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9076127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:02:33+00:00 2026-06-16T19:02:33+00:00

when i try to get value after update the two or more row columns

  • 0

when i try to get value after update the two or more row columns and try to get in servlet ,i m getting only one value in servlet and i have to send two or more row or we can say a updated list of project to another servlet what i m trying to do i have write her plz help me out i m new at servlet and jsp

     <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ page import="com.nousinfo.tutorial.employee.service.model.bo.EmployeeProjectBO"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
    <%@page import="com.nousinfo.tutorial.employee.service.model.bo.EmployeeBO"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Update Project</title>
    <link rel="stylesheet" href="css/style.css" type="text/css"></link>

</head>

    <body >

        <form action="ProjectUpdateServlet">
        <table border="1" width="500" id="tbl">
                <tr>
                    <td width="234"><b>click</b></td>   
                    <td width="119"><b>Employee Number</b></td>
                    <td width="234"><b>Project Code</b></td>
                    <td width="234"><b>Start Date</b></td>
                    <td width="234"><b>End Date</b></td>
                    <td width="234"><b>Role</b></td>

                </tr>

            <c:forEach var="employeeProjectBO" items="${sessionScope.projectList}">
                <tr>
                    <td><input type="checkbox"  value='${employeeProjectBO.projectCode}' name="projectCode"></td>
                    <td><input type="text" value='${employeeProjectBO.employeeNumber}' name="employeeNumber" readonly="readonly"/></td>
                    <td><input type="text" value='${employeeProjectBO.projectCode}' name="projectCode" readonly="readonly"/></td>
                    <td><input type="text" value='${employeeProjectBO.startDate}'name="startDate"/></td>
                    <td><input type="text" value='${employeeProjectBO.endDate}' name="endDate"/></td>
                    <td><input type="text" value='${employeeProjectBO.role}' name="role"/></td>
                        <td><input type="hidden" name="updateStatusProject" value="M" /></td>
                </tr>
            </c:forEach>
        </table>




                <p>&nbsp;</p>
                <br />
                <table width="200" border="0" align="center">
                    <tr>

                        <td><center>
                                <input type="submit" name="submit" value="update" onclick="self.close()">
                            </center></td>

                        <td><center>
                                <input type="button" name="cancle" value="cancle"
                                    onclick="self.close()"/>
                            </center></td>
                    </tr>
                </table>
                <hr size="1" width="786">
                <p>&nbsp;</p>
        </form>
        </body>
        </html>

and this is my servlet

  package com.nousinfo.tutorial;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.nousinfo.tutorial.employee.service.model.bo.EmployeeProjectBO;

/**
 * Servlet implementation class ProjectUpdateServlet
 */
public class ProjectUpdateServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public ProjectUpdateServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

    protected void service(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
            String[] projectCode=   request.getParameterValues("checkedProject");
             for(int i=0; i<projectCode.length; i++) {
                    System.out.println(projectCode[i]);}
        System.out.println(request.getSession().getAttribute("projectList"));
        if (request.getParameter("submit") != null) {
            request.getSession().setAttribute("employeeProjectBO",
                    setEmployeeProject(request));
        }

    }

    public EmployeeProjectBO setEmployeeProject(HttpServletRequest request) {
        EmployeeProjectBO employeeProjectBO = new EmployeeProjectBO();
        String[] projectCode=   request.getParameterValues("checkedProject");

         for(int i=0; i<projectCode.length; i++) {

        employeeProjectBO.setUpdateStatus(request.getParameter("updateStatusProject").charAt(0));

        employeeProjectBO.setEmployeeNumber(Long.parseLong(request
                .getParameter("employeeNumber")));
        employeeProjectBO.setProjectCode(request.getParameter("projectCode"));
        employeeProjectBO.setStartDate(new java.sql.Date(getDate(
                request.getParameter("startDate")).getTime()));
        employeeProjectBO.setEndDate(new java.sql.Date(getDate(
                request.getParameter("endDate")).getTime()));
        employeeProjectBO.setRole(request.getParameter("role"));
        System.out.println(request.getParameter("role"));}
        return employeeProjectBO;
    }

    private static Date getDate(String source) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            return format.parse(source);
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return new Date();
        }
    }
}

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:02:34+00:00Added an answer on June 16, 2026 at 7:02 pm

    1)
    You should create different names to checkboxes
    name=”projectCode” add for example employeeProjectBO.projectCode to this input name

    2) in servlet

    for(int i=0; i<projectCode.length; i++) {
    request.getParameterValues("checkedProject"+projectCode.getProjectCode);
    …
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF ComboBox named cbFileSize. I try to get is selected value
Im getting a -1 value when i try to get the selected item position
UPDATE : Some have said that they were able to get more than 1
I am try to get the values from the selected row and pass them
I Have problem in update one of my datablock textitem. the problem will raise
I try to get the Heu value from where i click on an image,
Using following code I try to get updated list of checkbuttons' corresponding text values,
I try get a my attribute inside Fancybox, and I get when I use
i try to get my FragmentPagerAdapter working, but the examples are a bit to
I try to get the whole content between an opening xml tag and it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.