aspose file tools*
The moose likes Struts and the fly likes logic:notPresent question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic:notPresent question" Watch "logic:notPresent question" New topic
Author

logic:notPresent question

Enno Buis
Greenhorn

Joined: Dec 23, 2004
Posts: 2
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

Joined: May 13, 2004
Posts: 14
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

Joined: Feb 26, 2001
Posts: 4419
    
    5

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.


Junilu - [How to Ask Questions] [How to Answer Questions]
Enno Buis
Greenhorn

Joined: Dec 23, 2004
Posts: 2
Hi,

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

Greetz,

Enno.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: logic:notPresent question
 
Similar Threads
Charles can you please clarify this question
Calling action without form (Struts)
Problem in Struts
Referring Page in Struts
Setting HttpSession Attribute Not Working (Struts)