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

  • Home
  • SEARCH
  • 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 9162551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:14:16+00:00 2026-06-17T14:14:16+00:00

I am using Struts 2.0. I have a Java Bean Person having fields perName,

  • 0

I am using Struts 2.0. I have a Java Bean Person having fields perName, perAge, perMail & many more. I want to display a Map of Java Bean {[1, person1], [2, person2]) on JSP and allow the user to update it from the same JSP using text fields. There are lot of variables in the bean and some of them are editable while some of them are not.

For example, perName is not editable while perAge is editable. I don’t want to display non editable fields. If I use ediatable fileds only, after updating, I get non editable fields as null (perName is null after update). So I can’t specify name attribute as it is changing at run time. So I am putting them in HTTP Session and displaying them. I am specifying name attribute of text field using #session.person[iterator index].perAge. Till this point everything works fine. But if I change the value in any text field & try to update, I get the old session attribute instead of changed one. I want the old session attribute with the new changed values and values of non editable fields should persist within user request. I don’t want to use JavaScript. OGNL or expressions are most welcome.

public class PersonDTO implements Serializable {
    private String perName;
    private int perAge;

    public String getPerName() {
        return perName;
    }

    public void setPerName(String perName) {
        this.perName = perName;
    }

    public int getPerAge() {
        return perAge;
    }

    public void setPerAge(int perAge) {
        this.perAge = perAge;
    }
}
  <s:form action="updatePerson" id="updatePerson">
        <table>
            <tr>
                <td>AGE:<s:textfield name="#session.person.perAge" />
                </td>
            </tr>
            <tr>
                <td><s:submit id="update" value="Update" />
                </td>
            </tr>
        </table>
    </s:form>
  • 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-17T14:14:17+00:00Added an answer on June 17, 2026 at 2:14 pm

    Thanks for your support. After a day long GOOGLE, I found that it is not possible to update session directly using Struts tags. You can use session information for display and update session in scriplets but you can’t update session directly. You may refer Struts2 form to update object in Session map? for more info. Once again thanks for help!!!

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

Sidebar

Related Questions

I am using Struts and Java. The problem is that I have a page
I am using struts, I have a java web application which needs to run
How can I expose a Java bean to a JSP page by using struts?
I have been trying to make a java project. Its using Struts 2 tags.
I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a
I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a
I have started using struts .I have hanged in a place ,Code is bellow
I'm using Spring and struts and have the following entry in '/META-INF/context.xml' <Context cachingAllowed=false
I am using Struts Tiles with JSF to have one header, menu and footer
I am using Struts 1.2.7 and have the standard servlet mapping that uses *.do

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.