Created: (SHALE-192) If spring is included in the projectevery JSP must have a backing bea
0 answers - 3749 bytes -

If spring is included in the project every JSP must have a backing bean and view.
Key: SHALE-192
URL:
Project: Shale
Type: Bug
Components: Core, Tiger
Versions: 1.0.1
Environment: Linxu SUSE 10, Tomcat 5.5.17, Shale, Tiger, Tiles, Spring
Reporter: Martin Phee
I'm just starting an application and new to shale. I'm using shale with tiger and incuded most of the libraries including spring. I created/copied a simple jsp that had a managed bean and view. I then created a "Success" jsp that you can see below in the navigation rule. If the success jsp didn't have a managed bean associated with it then I'd get a 500 with the stack trace (which is at the end). I removed the spring libraries (they weren't being used yet) everything worked fine. Also, if I did associate a managed been with the Success.jsp it worked fine.
This is from my post on the struts user list:
I'm using Shale with tiger.
JSP, subscribe (example from somewhere) that does a save. All this works fine, but I made a change so that the return should send it to a "Success" page. <navigation-rule>
<from-view-id>/subscribe.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/success.jsp</to-view-id>
</navigation-case>
</navigation-rule>
I kept getting a 500 error:
12:11:39,292 ERRR [faces]:253 - Servlet.service() for servlet faces threw exception
No WebApplicationContext found: no ContextLoaderListener registered?
I then created a Success bean
@Bean(name="success", scope= Scope.SESSIN)
@View
public class Success
{
}
And then everything worked. Do I always need a View behind my jsp's or am I doing something wrong?
@Bean(name="subscrHandler", scope = Scope.REQUEST)
public class SubscriberHandler {
@Value("#{subscribe}")
private Subscriber subscriber;
public void setSubscriber(Subscriber subscriber) {
this.subscriber = subscriber;
}
public String saveSubscriber( ) {
subscriber.save( );
return "success";
}
}
Exception and Success.jsp
13:27:47,796 ERRR [faces]:253 - Servlet.service() for servlet faces threw exception
No WebApplicationContext found: no ContextLoaderListener registered?
at (FacesContextUtils.java:78)
at ()
at ()
at ()
at (ViewViewHandler.java:285)
at (ViewViewHandler.java:130)
at (TilesViewHandler.java:184)
at (NavigationHandlerImpl.java:145)
at ()
at (ActionListenerImpl.java:84)
at (UICommand.java:106)
at (UIViewRoot.java:90)
at (UIViewRoot.java:164)
at (LifecycleImpl.java:316)
at (LifecycleImpl.java:86)
at (FacesServlet.java:106)
at ()
at ()
at ()
at ()
at ()
at (StandardWrapperValve.java:213)
at (StandardContextValve.java:178)
at (StandardHostValve.java:126)
at (ErrorReportValve.java:105)
at (StandardEngineValve.java:107)
at (CoyoteAdapter.java:148)
at (Http11Processor.java:869)
at $(Http11BaseProtocol.java:664)
at (PoolTcpEndpoint.java:527)
at ()
at $ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Succes.jsp
<!DCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>Rejected!</TITLE>
</HEAD>
<BDY>
<CENTER>
<TABLE BRDER=5>
<TR><TH CLASS="TITLE">Success!</TH></TR>
</TABLE>
<H2>You have been successfully registered.</H2>
</CENTER>
</BDY></HTML>