Results 1 to 6 of 6
Thread: JSF Request value on Page2
- 10-10-2008, 05:00 PM #1
JSF Request value on Page2
I created a new JSF project in NetBeans and I managed displaying a page with some elements and a button. In the faces-config.xml I setup moving to Page2.jsp on submission.
Then - in the init method in the java file of page2 I want to get form values posted from page2.
How do I manage this in java code?
And how do I retrieve the session id?
I didn't find helpful information searching.Greetings, Martin Wildam.
- 10-13-2008, 09:22 AM #2
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
you can get session id by getting Facesconttext object.
FacesContext context = FacesContext.getCurrentInstance();
HttpSession session = (HttpSession) context.getExternalContext().getSession(false);
session.setAttribute(”sessionObj”, mySession);
and
i didnt get what exactly u want for the request fields.
and by what iam understanding you can get the from field values. just u post the values through <inputhidden > tag and maintain the scope in session then u can get the values where do u want
- 10-13-2008, 09:32 AM #3
The request-question was about normal form fields - when I have a second page and I want to retrieve the values of the form fields posted from page1 to page2 - how to do it?
Greetings, Martin Wildam.
- 12-09-2008, 06:04 PM #4
Thanks for your hints - playing a little around starting from your suggestions I found out how to retrieve parameters (just some dirty sample):
Java Code:FacesContext finst = FacesContext.getCurrentInstance(); ExternalContext ext = finst.getExternalContext(); HttpSession session = (HttpSession) ext.getSession(false); Enumeration<String> atts = session.getAttributeNames(); result = "Session attributes: \r\n"; while (atts.hasMoreElements()) { String attrName = atts.nextElement(); result += attrName + "=" + session.getAttribute(result) + "\r\n"; } result += "\r\n\r\n"; Iterator<String> it = ext.getRequestParameterNames(); Map props = ext.getRequestParameterMap(); while (it.hasNext()) { String pName = it.next(); result += pName + "=" + props.get(pName).toString() + "\r\n"; }Greetings, Martin Wildam.
- 12-10-2008, 05:07 AM #5
Member
- Join Date
- Oct 2008
- Posts
- 5
- Rep Power
- 0
Thanks Martin Wildam.
- 09-17-2009, 09:12 AM #6
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
[SOLVED] http request
By Eranga in forum Advanced JavaReplies: 30Last Post: 11-27-2008, 04:35 AM -
request.get not using generics
By Nicholas Jordan in forum Java ServletReplies: 4Last Post: 07-27-2008, 02:09 PM -
Session and request in JSF
By felixtfelix in forum Web FrameworksReplies: 0Last Post: 05-08-2008, 05:10 PM -
respose with out request
By karthikiniyan in forum Java ServletReplies: 1Last Post: 04-09-2008, 03:06 PM -
Help with request.getParameter()
By Albert in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 07-13-2007, 03:39 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks