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

logic:notPresent question

 
Enno Buis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.
 
Thilothama Green
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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
 
Junilu Lacar
Bartender
Pie
Posts: 7316
45
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi,

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

Greetz,

Enno.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic