redirection problems

hi,

i have been searching for a while in the forums for a previus response but i have not found any answer for mi problem. but sorry if this is an old and very discussed issue.

i have two pages, and i have to navigate from one to another using a command button (one for "going" in one page, and one for "getting back" in the second one). in order to do this, i have to include in my navigation xml the tag <redirect></redirect> ( because if i dont do this, i am not able to get back, from the second to the first)

<navigation-rule>

<from-view-id>/Gestion/ConfirmacionActividad.jsp</from-view-id>

<navigation-case>

<from-outcome>navegacionConfirmarListado</from-outcome>

<to-view-id>/Gestion/GestionActividadesListadoTrabajo.jsp</to-view-id>

<redirect></redirect>

</navigation-case>

</navigation-rule>

<navigation-rule>

<from-view-id>/Gestion/GestionActividadesListadoTrabajo.jsp</from-view-id>

<navigation-case>

<from-outcome>navegacionListadoConfirmar</from-outcome>

<to-view-id>/Gestion/ConfirmacionActividad.jsp</to-view-id>

<redirect></redirect>

</navigation-case>

i have also to exchange data beteween the two pages, and i have been forbideen to use a sessionBean (and an ApplicationBean of course) .

first of all i think on writing my own requestBean, so i can set data in the first page and get it in the second ( i also should change data between the second and the first, so both of them would perform sets and gets against the bean).

the problem is that i need to use the redirect tag, which mades the requestBean to be empty, no matter the data i have setted in the first page, what i always get in the second is null.

any ideas ?

thanks to everyone

[1952 byte] By [Asmodeana] at [2007-11-26 19:47:07]
# 1
You have to store the data somewhere on server between the requests:- session attribute (Why can you not use session beans?)- static reference (field, singleton)- database- file
Ingmara at 2007-7-9 22:33:43 > top of Java-index,Development Tools,Java Tools...
# 2

thanks for your solutions.

* i cannot use session beans as a requisite, because they are supossed to be heavy for the server as there should be floods of users. if this is not true, i cannot use then anyway, unfortunately i am not a boss :S

* i cannot also use a singleton cos that way all the users would share the same information, and i dont want that. i cant even make a singleton with sessionids so as to distinguis who is who, because the same user may have had the same page open more than once.

* i have no acces to a database

* the file should be a good idea, but i need to name it, in a way both pages know it. but, as i have mentioned before (in the singletion paragraph), i have no found a way to name it. so as both pages, know the name

thanks a lot

Asmodeana at 2007-7-9 22:33:43 > top of Java-index,Development Tools,Java Tools...
# 3

Has your boss already decided where to store the data?

Does he think it's recommendable to store data in client side and transfer it between browser windows using javascript?

If you don't want or can't store data in memory or database you have to store it in a file. To create unique filenames use the user ID or the session ID.

Ingmara at 2007-7-9 22:33:43 > top of Java-index,Development Tools,Java Tools...
# 4

after a "relaxing" discussion with my boss i am finally able to use session beans.

thanks a lot for your answers.

but there is a problem assuming my last conditions.

as the same user can have two pages opened (being the same page but with diferent data) at the same time, i am not able to name the files using the userid or the sessionid, as both files would be named the same.

it does not matter now, but it is still a problem :S

Asmodeana at 2007-7-9 22:33:43 > top of Java-index,Development Tools,Java Tools...
# 5

Yes. The standard implementation from SUN uses one component tree per page (URL). I solved this with an own window management. The base technology is as follows.

1. Windows

Every window has an ID. You can use the name of the window or a generated number. In every request must be included a parameter with the window's ID. To catch all windows every popup is raised indirectly. First a normal action method in a backing bean of a page fragment is called. A new Window is instantiated in this method and stored in the session. In the answer is included a small javascript which does the popup including sending the parameter with the new window's ID.

2. PhaseListener

2.1 incoming request

A PhaseListener identifies the window in before RESTORE_VIEW and stores it in RequestBean. The UIViewRoot which is stored in the Window instance is added to the session.

2.2. Processing in page beans

- normal processing

2.3 outgoing response

After RENDER_RESPONSE the PhaseListener stores the actual view in the actual Window instance and removes the last view and a due to navigation created view from the session.

In this way you have process scope instead of page scope.

Ingmara at 2007-7-9 22:33:43 > top of Java-index,Development Tools,Java Tools...