Okay, I finally made it work. I will explain how I did it here if other
people find the same problem I was facing.

First of all thanks to Matt and Cens for your replies.

I cannot use @PostConstruct since I need the web app to be compatible with
servlet engines like Tomcat and Jetty.

Cens, your solution below looks very interesting, I did not try it yet but
by using it you can bridge non-JSF forms with JSF actions and also force it
to use JSF navigation rules! Thanks a lot for sharing it!

However, since I had little time (as usual) to fix the issue yesterday I
tried something completely different (and simpler, in theory). I moved the
form from default.jsp to a file called shoppingCart.xhtml. I then added code
to include this new file in the pages where I wanted it to show up.

I had to tweak some few CSS files for it to be placed in the right position
but finally I got it to call JSF action beans and navigate correctly!

This is the code I had to add to the pages where I wanted it to be
presented, just after the head tag:

<div id="sub">
        <ui:include src="/common/shoppingCart.xhtml">
            <ui:param name="tableName" value="shoppingCartUI"/>
        </ui:include>
</div>

For it to look right I also had to change default.jsp and the JSF pages:
1. removed <div id="main"> from default.jsp
2. added <div id="main"> into every screen, just after the head tag (and
also after the <div id="sub"> block above, if present). Sure we have to
close this new div in the proper location, just before the </f:view>.

I know it was some manual work but it finally works :D

Thanks all,
Pedro Burglin


Hi Pedro,
I will show you my solution, but first I must make a consideration.
The use of @PostConstruct annotation will work only in a full J2EE
Application server (e.g. JBoss or WebSphere), not in a Servlet
container (like Tomcat or Jetty).
Indeed I did not test this, but this annotation is part of EJB-Session
specification and therefore available only with a full EJB container
(Please note that EJB-Persistence annotations, instead, can be used
without any container, even in a bare Java application).

My solution is this:
- create a servlet that you can invoke by any non-JSF page
- fill it with the following code

...
-- 
View this message in context: 
http://www.nabble.com/call-to-JSF-action-from-default.jsp-tp18325804s2369p18343817.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to