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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:12:40+00:00 2026-06-04T07:12:40+00:00

I have a database with a user information. When the user is logged on,

  • 0

I have a database with a user information. When the user is logged on, I registered the user on the session as follow:

ActionContext.getContext().getSession().put("loggedUser", user);

And I want to get the user’s information in my jsp page to fill the struts2 textfields with this info. I tried to use the following code, but it does not work:

<%@page import="java.util.Map"%>
<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="UbiMail.*" %>
<%@taglib  prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%

        User user = (User) ActionContext.getContext().getSession().get("LoggedUser");
%>

<html>
<head>

</head>
<body>

    <s:form method="POST" action="UpdateAction">
        <s:actionerror/>
        <s:textfield name="uname" label="Username" value="#session.LoggedUser.getUsername"/>
        <s:property value="#session.LoggedUser.getUsername()"/>
        <s:password name="password" label="Password"/>
        <s:password name="cPassword" label="Confirm password"/>
        <s:textfield name="fname" label="First name" value="#session.loggeduser.getFname()"/>
        <s:textfield name="lname" label="Last name" value="#session.loggeduser.getLname()"/>
        <s:textfield name="popServer" label="POP server" value="#session.loggeduser.getPopServer()"/>
        <s:textfield name="popUsername" label="POP username" value="#session.loggeduser.getPopUsername()"/>
        <s:password name="popPassword" label="POP password"/>
        <s:textfield name="mobilePhone" label="Mobile phone" value="#session.loggeduser.getMobilePhone()"/>
        <s:textfield name="filter" label="Notification filter" value="#session.loggeduser.getSms()"/>
        <s:checkbox name="sms" label="Enable SMS notification"/>
        <s:submit value="Update"/>
    </s:form>
</body>

I want your help, please.

  • 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-04T07:12:41+00:00Added an answer on June 4, 2026 at 7:12 am

    Instead of this

    <s:textfield name="uname" label="Username" value="#session.LoggedUser.getUsername"/>
    

    use this

    <s:textfield name="uname" label="Username" value='<s:property value="%{#session.loggedUser.getUsername}"/>'/>
    

    On a similar note you can do for rest of your fields.

    Another thing you are mismatching LoggedUser and loggedUser, in your Java code key is loggedUser and not LoggedUser, so in jsp use loggedUser.

    Off topic:
    I don’t think you need to use scriptlet in your jsp code.

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

Sidebar

Related Questions

I have database application, I want to allow the user to restore the deleted
I have an attribute in my user database of type Date. I want to
I have two tables in my database: user and media_contact . The media_contact table
i have a large user Database (13k+), and for some reason i need to
I have a database table where the user marks files to be downloaded. Subsequently,
I have a database with three tables: user_table country_table city_table I want to write
I have a database that is being filled by user defined EditTexts. None of
I have a database schema that is similar to the following: | User |
I have data stored as below in an MS Access database: Date User 20090101
I have a database called ADB. When I create a new user/role, that user

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.