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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:59:12+00:00 2026-06-14T21:59:12+00:00

I have a JSP file that includes another JSP file. The first JSP should

  • 0

I have a JSP file that includes another JSP file. The first JSP should pass an instance of a Java class (widget) to the second JSP file.

This is what I have:

The first JSP:

<jsp:include page="/container/SpecialWidget.jsp">
     <jsp:param name="widget" value="${widget}"/> // widget is a .Java POJO
</jsp:include>

The second JSP:

${param.widget.id}

The problem is that this code gives an error (it says it doesn’t know ID). If I omit the “.id” part, the page prints the Java code for the Java class, which means the class has been transferred correctly. If I change the ${widget} rule of the first page in, for example, ${widget.id} and I try to print ${param.widget}, everything works fine.

My question: Why can’t I pass a Java class and directly call upon its attributes? What am I doing wrong?

Edit: error message: Caused by: javax.el.PropertyNotFoundException: Property ‘id’ not found on type java.lang.String

  • 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-14T21:59:13+00:00Added an answer on June 14, 2026 at 9:59 pm

    When you pass the variable ${widget} it is translated at request time to a string (widget.toString()). This value is then passed to the second JSP as a String, not as the original java object.

    One approach to access the object’s values is setting the parameter’s value with the attribute’s value:

    <jsp:param name="widgetId" value="${widget.id}"/>
    

    Then use the code bellow on the second JSP:

    ${param.widgetId}
    

    You can also set widget as an request attribute and use it on the second page as ${widget.id} or ${request.widget.id}. I suggest you use the second approach.

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

Sidebar

Related Questions

I have a webapp in Tomcat with a main JSP file that includes another
I have a .jsp file that receives a request and checks the request's parameters.
so i have a .js file that 2 different jsp pages call. .js file
I've got a jsp file, which includes another jsp file to check some values
I have a index.jsp file that has two different types of forms <form action=searchpath
I have the following jsp file <%@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1%> <%@ page
I have a jsp file: validate.jsp- var rollNo=document.forms[result_form][studentRollno].value; var name=document.forms[result_form][studentName].value; $(#student_result).load(result.jsp?rollNo=+rollNo+&name=+name); As you can
I have a jsp file in the root of .war file. and then I
I'm getting an exception when i have my jsp file on the webserver, it
I have these in a jsp file. But these values are not updated in

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.