Call a JSF application from a Standar Web application (JSP)
Hi all,
We have 2 aplication, one is JSF and the other one is standar web jsp.
We want to invoke from the standard web application to the JSF application and pass param from the jsp to the *.jsf page.
how can I do that?
Thanks.
# 1
Check here how to pass GET request parameters to JSF:
http://balusc.xs4all.nl/srv/dev-jep-com.html
# 2
But we have 2 diferent app. the first one is a standard web JSP application on tomcat, and in other side we have a JSF applicacttion, so we need to invoke from the first one(NO JSF) to the JSF app.
# 3
OK.
And what's the problem/question?
# 4
So I not quite sure how to invoke and pass param from the standar d web app to the index.jsf app,.
And one, Ive passed the param and the index.jsf receive the param, the index.jsf generate a event to perfom action manage by JSF framework.
you know what I mean?
# 5
Yeah.
Like I suggested, pass a GET request parameter. I also have given a link how to capture the GET parameter in a JSF backing bean.
# 6
I think I not sure if I explain ok.
We have 2 diffente app.
the first one is the other company page (JSP app)I we can only modify its JSP writen a link to our JSF aplication, so I cant invoke a backingbean, only can introduce a hiperlink inside the JSP Page.
# 7
I think that you don't understand what's a GET request parameter.
# 8
OK, now both undertand the problem. is there any solution?.
I cant believe that I cans invoke from one standard we app to other JSF application.
# 9
As I suggested in my first reply: use a GET request parameter.
I don't see any problem.
# 10
your page is good link
but is commandButton relation of param?
my meanning is whether commandButtion is support param or not?
and whether jsf have tag <f:attribute /> or not?
# 11
Read the text of the article and not only the code snippets of the article.
# 12
I not quite sure how to do it, because from the app1 and only can insert in the page a hiperlink so this hiperlink I suppose must invoke to the FacesServlet to start the jsf Framework, you know what I mean, so:
app1: Jsp:
<form action=http://XXXX/FaceServlet?=(what param)>
.....
</form>
# 13
A form action is not a hyperlink.
If you want to use a form, set the form method to GET and pass the parameter as an (hidden?) input field.
If you want to use POST, checkout the Apache Commons HttpClient PostMethod API.
# 14
You can open a jsf page from any other application.
<form action="http://hostip:port/app/MyPage.jsf?key1=value1&key1=value1">
as we do in any other jsp page.
Now in JSF application, in MyPage.jsf write a scriptlet to get the parameters and from there you can use these params.
You can get a managed Bean reference in your jsp page. Here is the code for that.(ResultsInExcelBean is my managed bean.)
FacesContext fc = FacesContext.getCurrentInstance();
ResultsInExcelBean resultsInExcelBean = (ResultsInExcelBean)fc.getApplication().createValueBinding("#{ResultsInExcelBean}").getValue(fc);
Hope this helps you.
Sravan
# 15
Yes, this help me,That I need .
1-I get the parmam from the jsp on my *.jsf
2-With this data I have to generate a event on load function of the *jsf to invoke to FacesServelet automatily( im not quite sure how to do it)
but the last part I cant undertand for this reason:
1-The managed bean is on standar JSP I can get on the JSF application?
Thank anyway