How can I put a message in a jsf page after an action in another page?

G

guess85

Hi everybody, I know that what I try to explain is a bit difficult to
understand without know all the context but I try to do it the same:).
I have a datatable that contains a list of student. In another page I
insert a new student. When I click on "save" button I save the new
student and I return to the page with the datatable. The problem is:
when I add a student I must notify the user that the student is added
correctly with a message in the 1st page like "The student is added
correctly". This message must display only after I added the student
not when I see for the first time the page with the datatable. How can
i do this? Thanks to all.
 
L

Lew

guess85 said:
Hi everybody, I know that what I try to explain is a bit difficult to
understand without know all the context but I try to do it the same:).
I have a datatable that contains a list of student. In another page I
insert a new student. When I click on "save" button I save the new
student and I return to the page with the datatable. The problem is:
when I add a student I must notify the user that the student is added
correctly with a message in the 1st page like "The student is added
correctly". This message must display only after I added the student
not when I see for the first time the page with the datatable. How can
i do this? Thanks to all.

Don't think of it as "returning" to the "first" page but as moving forward to
the control page.

A simple approach is to use a dynamic element such as a request attribute to
hold the message or a state variable to drive retrieval of the message. Use
EL, JSTL or JSF idioms to control whether the message is displayed.

I am still learning JSF, so undoubtedly I'm ignoring some JSF component that
manages messages such as these.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,097
Latest member
RayE496148

Latest Threads

Top