Faces in ADF can't get the request parameters
Asked Answered
B

2

0

I have an ADF web application with Faces 1.2

In my managed bean I am trying to access the parameters of the post request, but always getting null.

This is my post form that I am posting to the Faces:

<form name="input" action="http://127.0.01:7072/myapplication/faces/login.jspx" method="post">
   <input type="hidden" name="user" id="user" value="myUserName"/>
   <input type="submit" value="Submit"/>
</form>

FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("user");

FacesContext.getCurrentInstance().getExternalContext().getRequest().getParameter("user");

But I always get null and the method of the form I get is: GET, strange!

Bacteriostat answered 6/5, 2014 at 20:4 Comment(5)
is this generated html of your jsf form? or do you try to post pure html form?Louiselouisette
@Louiselouisette I try to post pure html formBacteriostat
Then read this post of @BalusC. it can give you idea .Louiselouisette
@Louiselouisette the form in that post you mentioned has very defined elements, I can't specify those, The client that sends the post request is not controlled by us, and will send the above post form, so any other help please?Bacteriostat
@Louiselouisette What is the reason that the faces external context doesn't include the post parameters of the form I can't understand . . .Bacteriostat
C
1

when you make a request for a URL like:

http://server/faces/somepage.jspx

ADF framework respone you by a "HTTP Error 302 Moved temporarily" response and redirect you to the URL like :

http://server/faces/somepage.jspx?_adf.ctrl-state=888888&_afrLoop=9999999

so your first POST request is omit and browser send an other request to the new URL that ADF returned in response, so because POST method send parameter in the request body the browser dont resend them in new Get request so i think there is no way for you to get parameters direcly in side the ADF page ! :(

but i think the best way is to create a Servlet and get you param in it and put them to session and then redirect the user from servlet to your ADF page :)

Claudieclaudina answered 12/6, 2016 at 7:5 Comment(0)
B
0

I managed reading the request parameters through including my parsing operations in the filter mappings that my application was using.

In a very abnormal way FacesContext always rejected revealing the current parameters, till now it's a mystery for me why it's designed liked that, even through its external context ...

Bacteriostat answered 24/5, 2014 at 12:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.