• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending variables in forms

 
Pavel Husek
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

first iam new in jsf so i dont know much about it.


Here is problem:

i have 3 pages with forms.

it look like that:

registration--->test--->result

on each page is a form. When i fill registration on first page and press submit it goes to Test page where are some question and information from first page ( adress,name etc.). And here comes problem. When i press submit on this page it goes to result page where are displayed results from test (it is ok) but there are not displayed information from first page (registration.........for example) like name, adress etc.... it look like all variables are empty.

I though that when i save some value into variables on first page ( ....e.g.) they will be there for good. In bean class i have all setters and getters and i guess also faces-config.xml is set properly.


Hope it is understandable
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as understandable, we get stuff that's harder to understand than that. But in English, the pronoun "I" is always capitalized. Just one of the silly rules.

When variables in a JDF form are unexpectedly blank, that usually means that the backing bean scope isn't wide enough. Most often, it means that you're using "request" scope when you should use "session" scope. JSF is bad about requiring session scope.
 
Pavel Husek
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for answer...and sorry about "i" "I"......

About problem.....yes Iam using request scope.....If I will use session. Is there any special setting to work this right ? Or I can just change request for session in faces-config.xml and it is all ?
 
Pavel Husek
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok....main problem is solved thanks to session.....but I have another one related with it. On last page ( result ) I have link for new registration leads to first page ( registration ) again. Problem is that all variables are saved so when I click on link and return on first page there are last time used values in form. Question is, how can I erase session ? I found some solution here but didnt work for me
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you are done, you can just set the values in the managed bean to empty strings. So, when the page re-displays, you'll just get empty data. Or you can programatically remove the managed bean from the appropriate scope.

It's best to post new questions in a new thread. You'll attract people who see the subject line and think they can help with your problem. So don't be afraid to start a new thread!

-Cameron McKenzie
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!