• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Problem in accessing c:set tag.

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,
I am using JSP2.0. i have created one simple application in which form gets submitted and servlet gets called which creates the map and place it inside the session scope and redirect the page to the new jsp page.I am deploying the application on the server jboss 4.0.2 -GA.

Here is the Directory Structure of my Web Application.

----------------------------------
Structure of my Web Application
----------------------------------

SCWCD
|
|
WEBCONTENT
| | |
| | |
| | JSP
| | |
| | |
| | index.jsp
| WEB-INF
| | |
| | |
| | classes
| | |
| | <compiled classes>
| lib
| |
| <All the libraries are here>
finalresults.jsp












-----------------------------------------
Output After Executing OptionalServlet
-----------------------------------------

Class of the person attribute :class java.lang.String
15:30:52,839 INFO [STDOUT]
Value of the person attribute :Beans.Employee@b1404f
15:30:52,839 INFO [STDOUT]
Class of the person1 attribute :class Beans.Employee
15:30:52,839 INFO [STDOUT]
Value of the person1 attribute :jineshparikh


Now i have read in HFSJ that when we are using the <c:set> tag then in that case either i can use the value attribute of the tag or i can specify the value in the body of the tag.What ever the evaluated value's type would be the type of the attribute.

But here in the above example look at the code of the finalresults.jsp




in the above code where i have used the body for the person1 attribute and value for the person attribute. In both of the case i have assigned them value of the attribute named person which was set in the personal attribute.Here the ${sessionScope.personal} attribute evaluates to person class object. But when i access the both of the attribute in my optionalServlet.java i got the following result


[output]
Class of the person attribute :class java.lang.String

Value of the person attribute :Beans.Employee@b1404f

Class of the person1 attribute :class Beans.Employee

Value of the person1 attribute :jineshparikh
[/output]


you can clearly see the difference in the output. For the person attribute data type is string and for the person1 attribute data type is Employee object.

My question is why there is a difference in the data type of the person and person1 attribute. when both of them are set to same value.

Please help me on this issue.

Any help would be appreciated.

Regards
Jinesh Parikh.

Please
 
jinesh parikh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found my answer on the following link

https://coderanch.com/t/291668/JSP/java/difference-between-set-body-no

Regards
Jinesh Parikh
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic