invoke a BackingBean method from external application web

Hi all,

I need execute the folloging.

1-Situation:

Invoke from app1 (standar JSP) to app2 *.JSF page. Here there isnt problem I put on form action of my jsf page the url an the param but a I need more.

When my jsf page is going to render, first I need that a Method of a backkinBean binding with my jsf page will be execute to get data from back-end. Now the JSF page can reder with the data got it from the binding. So the question is:

2-I dont know say to FacesServet (on param) that a execute a specific method of backing bean that will get the data from back-end.

how to generate a event invoke the

that make sense?.Thank

[675 byte] By [juanjo.garciaa] at [2007-11-27 11:15:03]
# 1

I think you could satisfy your requirement by doing the data retrieval in the getter for your bean property. I.e.

public class MyBacker

{

private List beans;

public List getBeans()

{

if (beans == null) beans = loadBeans();

return beans;

}

}

RaymondDeCampoa at 2007-7-29 14:10:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

No because:

the problem is we are creating a application (jsf) with several functionality but we need to integrated with a old jsp application so we need to invoke the new one through the old one., So the situation is:

1-The app1 is a JSP external web application. From this page I can only modify a code writting a form to invoke my jsf app passing param of a client(like client id, name....)

2-We are creating a new app2 (the jsf application) this should be accesible from the app1.

3-So when I push a Imagine button on my app1, should request to the app2 (JSF passin some param) and this application, app2 must invoke a FaceServelt to invoke a method from one of backingbean that belong to my new JSP app, with this method we get information from a client from back-ends

that make sense?

juanjo.garciaa at 2007-7-29 14:10:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

No, it doesn't make sense. It doesn't matter how you get to the page, if you put the data retrieval in the getter for the backing bean.

RaymondDeCampoa at 2007-7-29 14:10:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Its easy I have 2 application web diferent. The first one was development years ago and the app2 is the new implementation jsf app.

From the first one, I going to put inside the jsp page a button to invoke the jsf app.

So When I press the button from the app1 that take me to index.jsf , so far so well?

In this first call that finish on my jsf app I need to display the data of one client that I pass the param from the app1, so far so well?.

So I have to get the data from back-end so Ive though to create a backbean method that recover the data. But my problem is how to invoke to this mehod the first one, when I display the JSF app coing from jsp app1, because the displaying data should be done in one step:

I press the buttom from jsp app1 ->that invoke JSF->Render the client data (without the user have tu press any buttom in jsf app)

Now make sense?

Thanks

juanjo.garciaa at 2007-7-29 14:10:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Yes, your problem statement makes sense. Your refusal to implement my suggestions does not. I've told you how to accomplish this.

RaymondDeCampoa at 2007-7-29 14:10:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

You are right, but in your example was mising some points,jeje.

That what I do, and work if anybody want to know:

1-From extenal JSP invoke jsf start servelt:

<% String url="http://localhost:8080/PPINV/index.jsf";%>

</script>

</head>

<body>

<form action="<%=url %>" method="post">

<input name="param1" id ="param1" type="text" value="">

<input name="param2" id ="param2" type="text" value="">

<input type="submit" value="Enviar formulario">

2-In my first *.jsf page I invoke to the backingbean Method who load the binding controls will be render:

<%

HttpServletRequest r = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();

Integer p1=Integer.valueOf(r.getParameter("param1"));

Integer p2=Integer.valueOf(r.getParameter("param2"));

Integer re=0;

EventManager myBean = (EventManager) session.getAttribute("Bus");

if (myBean == null) { // First-time initialization of bean not done yet.

myBean = new EventManager();

re= myBean.calculaResultado(p1,p2);

}

session.setAttribute("Bus",myBean);

%>

<f:view>

<html xmlns="http://www.w3.org/1999/xhtml"

xmlns:b="http://www.backbase.com/b"

xmlns:s="http://www.backbase.com/s">

<head>

<bjs:boot var="bootDir" />

</head>

......................

........................

Thanks

3-jsf lifeclycle reder de *.jsf with the data load on the control binding in the jsf page

juanjo.garciaa at 2007-7-29 14:10:43 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...