File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes  how to pass value from jsf to php Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark " how to pass value from jsf to php" Watch " how to pass value from jsf to php" New topic
Author

how to pass value from jsf to php

raghavendra bhat
Greenhorn

Joined: Sep 25, 2012
Posts: 3
Hi

I have 2 applications.. one is my own application developed using JSF.. Another one is a document Repositary fully developed using PHP. Now i need to integrate both..

i dont kno anything abt php..

The problem is the user needs to login inside my jsf application and once he logs in that user imformation should be passed to php page which is responsible for the authentication process so as to check whether the user is valid user for the document repositary.. so the user need not provide his username and password seperately for the document repositary.. is this possible.. can any one help.. the scenario is the person who is authenticated for one particular usergroup of my jsf application will be automatically authenticated for doc rep..for both of these cases i need to understand how to pass value from jsf to php.
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Assuming the PHP application is hosted somewhere you can always access the PHP service by submitting a POST HTTP request. Alternatively you can expose the PHP logic as a webservice (may be RESTful) and then invoke that webservice from your JSF application. In either case your PHP application should return some result indicating whether the user credentials are valid or not.


Mohamed Sanaulla | My Blog
raghavendra bhat
Greenhorn

Joined: Sep 25, 2012
Posts: 3
Hi, I dont know anything about webservice.. but i will tell you what idea i have, check whether this is ok... i will start the php server and jboss each time my application starts.. so the doclib is avl for me in xamp.. when user enters the username and password in jsf page i get the values and pass it to the php code where the authentication takes place..




Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

raghavendra bhat wrote:Hi, I dont know anything about webservice.. but i will tell you what idea i have, check whether this is ok... i will start the php server and jboss each time my application starts.. so the doclib is avl for me in xamp.. when user enters the username and password in jsf page i get the values and pass it to the php code where the authentication takes place..

this might work but I am not sure how good the approach is. Are you running them locally? i.e localhost? In anycase you send the data as request parameters to he URL on which your PHP application is running.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

Ideally, you would have some sort of SSO (Single Signon) service that both Java and PHP webapps could tap into. Java's built-in security allows for SSO Realms - the CAS system is one such provider and it's almost certainly usable with PHP as well.

Next best would be to implement a custom Realm that authenticated against the PHP system and used the results to construct the UserPrincipal object which anchors a user's identity within the Java webapp.

Worst would be to write a user-defined login process as part of the Java application itself and make it pass on the request using the HttpURLRequest object.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to pass value from jsf to php