Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in accessing c:set tag.

 
jinesh parikh
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I found my answer on the following link

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

Regards
Jinesh Parikh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic