• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how we will check session objects in logic:present tag

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need to test whether we have session attribute in session using <logic> tag.

The code is :

<logic:NotPresent name="Branch" scope="session">
System.out.println("The branch is not there : From lcommands.jsp");
</logic:NotPresent>
But i am getting output always(Branch is not set also).

Can anybody help me to find out the way to check the session objects thru <logic> tag.

Thanks In advance.
Praveen
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's possible you misspelt the session attribute. You can dump the whole session content to see the attributes stored.
 
Praveen Kumar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Thanks for Your Quick reply. !!

I know how to get session attributes in normal way.

But i want to check session objects in <logic> tag.

Here is the code sample.

First i want to see whether Branch attribute is there or not !!
if(there){ display}
else{select your branch }

These is my requirement.
i setted my Branch as session.setAttribute("Branch",value);(in first)
In second.jsp , i am using as
<logic:notPresent name="Branch" scope="session>
No Branch is selectes...
</logic:notPresent>
<logic resent name="Branch" scope="session>
Display
</logic resent>

But for me both are working !!But it should not right !!

Otherwise is there any mechanisam to fulfill my requirement.


Thanks in Advance
praveen
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you remember to put a taglib declaration for the "logic" tag library at the beginning of the JSP?
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yea I would wonder about the missing taglib. If that is not the issue, be sure to use a lower case "n" in your tag (logic:notEqual). Case is important but I think you will get an error if you have the tablib statement in place. You can double check by viewing the source in your browser. If the logic:notPresent tag is not being processed as a JSP tag it will get passed through to the browser.

- Brent
[ November 06, 2006: Message edited by: Brent Sterling ]
 
What's gotten into you? Could it be this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic