Improve company productivity with a Business Account.Sign Up

x
?
Solved

Redirect to another page from a session bean

Posted on 2009-07-02
6
Medium Priority
?
818 Views
Last Modified: 2013-11-24
This solution doesn't work because It's called from the session bean I think.

I got this error:

non-static method getExternalContext() cannot be referenced from a static context
0
Comment
Question by:Nargzul
  • 3
  • 2
6 Comments
 
LVL 92

Expert Comment

by:objects
ID: 24769046
that suggests that you are calling it from a static method in your bean, needs to be called from a non-static method
0
 
LVL 1

Author Comment

by:Nargzul
ID: 24769111
But the method isn't static, it's why I don't really understand.
0
 
LVL 92

Expert Comment

by:objects
ID: 24769128
can you post the relevant code
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 6

Accepted Solution

by:
jwenting earned 1500 total points
ID: 24769760
you can't do that from an EJB, EJBs know nothing of HTTP traffic.
What you can do is return an indication of what needs to be redirected to to the controller servlet and have that do the redirect.

But yes, you're calling an instance method from a static method (and you almost never want to use static methods, especially in EJB and other implicitly or explicitly multi-threaded context). It's the only way you can ever get the error you're posting. That the method you're calling isn't going to help you do what you want to do is secondary to that.
0
 
LVL 1

Author Comment

by:Nargzul
ID: 24784446
I don't really understand one thing:
For me an EJB is a bean, stateless or statefull, we can map, remote or local.

But, this one isn't mapped or anything like this, just a session beans.

I'm sorry, I don't have more the code because I've found a solution that doesn't need to do a redirection from a sessionbean.

So this "question" isn't really more usefull, but I'm absolutly sure that the method wasn't static, it's the first thing I've check when I've seen this error.
0
 
LVL 1

Author Comment

by:Nargzul
ID: 24845105
I've created a jsp:forward code that goes look into the session bean to be rendered
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
A discussion about automated testing of Web Applications utilizing Selenium, along with illustrated configuration steps for the Jenkins open source tool.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

595 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question