• 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

logic:notPresent question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, here's a question from a struts beginner ...

I have the following code



What happens is that the page will never redirect to the Login.jsp but will always stay in the same page.

I have two questions:
1- Doe the code not 'redirect' because the '<jsp:useBean ...' line creates an object ?
2 - What struts tag can I use to check if "myBean" is 'null' ?

Thanx,

Enno.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Yo do not need Jsp:usebean when you are using logic:notpresent. Logic tag itself goes to that scope and search for your bean. If null - not present, it will go to your page. I think you do not need jsp.usebean.

I am also new to struts..I may be wrong. But try using only the logic tag and see..

Thanks
Thilothama
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thilo is right. The code basically says:

create a bean called 'myBean' in the session scope
if there is no bean called 'myBean' in the session scope then
redirect to Login

Since you create the bean, the logic test will always fail.
 
Enno Buis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for the quick replies. I will try it after Christmas.

Greetz,

Enno.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic