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 8094863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:55:56+00:00 2026-06-05T20:55:56+00:00

I want to implement delete functionality using checkboxes in my struts2 application. I’m using

  • 0

I want to implement delete functionality using checkboxes in my struts2 application. I’m using display tag in my jsp page to show the reports. I need to provide checkboxes with reports to delete the selected reports. I have tried this code in my jsp page :

<s:form name="listPage">
<display:table name="egnreports" class="table" id="egnreports" requestURI=""  export="true" pagesize="30">

<display:column>
 <s:checkbox name="checked" fieldValue='%{egnreports.id}' />
</display:column>

<display:column value="<%=egnreports_rowNum%>" title="S.No." />

<display:column property="createDate" sortable="true" titleKey="egnreport.createDate" style="width:13.5%"/>

<-- Other Table data here -->

</display:table>
</s:form>
<c:out value="${buttons}" escapeXml="false" />

In my action class, I have used this :

 private String[] checked; 

public String[] getChecked() {

    return checked;
}

public void setChecked(String[] checked) {

    this.checked=checked;

}

When I try to retrive the selected values to delete the corresponding reports, I get a null pointer exception :

for (String code : checked) { 

    System.out.println(code + " is selected"); 
    System.out.println("id="+egnreport.getId());
        egnreportManager.remove(egnreport.getId());
        saveMessage(getText("ireport.deleted"));
        }

If I use

<display:column>
 <input type="checkbox" name="checked" value="${egnreports.id}"/>
 </display:column>

in place of s:checkbox tag, I’m able to see the values in the reports page (using firebug), but still they do not get populated in the action class.

using

<input type="checkbox" name="checked" value="${egnreports.id}"/> 

i get

<td> <input type="checkbox" value="5" name="checked"> </td> 

as rendered html, while with

<s:checkbox name="checked" fieldValue='%{egnreports.id}' />  

I get

<td> 
<div id="wwgrp_egnDeskReports_checked" class="wwgrp"> 
<div id="wwctrl_egnDeskReports_checked" class="wwctrl"> 
<input id="egnDeskReports_checked" type="checkbox" value="" name="checked"> 
<input type="hidden" value="" name="__checkbox_checked"> 
</div> 
</div> 
</td>  

Also I can’t use "${egnreports.id}" with s:checkbox to get the values of id.
Where did I go wrong? can anybody help me with this?

  • 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-05T20:55:57+00:00Added an answer on June 5, 2026 at 8:55 pm

    i have got the solution : i have to use fieldValue=”%{#attr.egnreports.id}” i.e,

    <s:checkbox name="checked"  fieldValue="%{#attr.egnreports.id}" value="false"/>
    

    to pass the checked values.
    Also remember to include buttons inside form tag, i didn’t pay attention to this before:

    <c:out value="${buttons}" escapeXml="false" />    
    </s:form>
    

    🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement delete confirmation dialog using FancyBox. The scenario is to pass
I want to implement an application which will work as a parser. User will
I want to implement a job scheduler in my windows azure application. My aim
I want to implement delete column in Android's SQLite. I want to make table
I want to implement basic shopping cart functionality in my Rails app....are there any
I want to design a nested gridview with insert, update, delete functionality through custom
I want to implement a history/recent-files functionality for my Perl/ Tk program. Here is
I have customized a UITableViewCell and I want to implement swipe to delete. But
I wang to use jQuery UI to implement a delete confirmation. I want to
I want to implement a one-to-many relation using Hibernate (in Java). I have two

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.