?
Solved

How to prevent an item from the update  in the jsf?

Posted on 2011-10-16
6
Medium Priority
?
279 Views
Last Modified: 2012-05-12
Hi All,

I want to make a field as a non up-datable field in the page, to achieve this, i need to capture the old and new values entered by the user in the particular field.

I am using Xhtml & JSF.

i can get new value from the bean or by using the following logic
String newUserId = COMP_USERID.getValue().toString();

but i don't know how to get old value which is previously entered by user, if i can get the old value,then i can compare both old and new values, then i can throw the Exception.

So, kindly  help me how to get it.
0
Comment
Question by:BhanuSVS
  • 3
  • 3
6 Comments
 
LVL 20

Expert Comment

by:a_b
ID: 36977630
Store the values in the JSF context or session and retrieve it from there.
0
 

Author Comment

by:BhanuSVS
ID: 36977638
Hi a_b,

Thanks For u r prompt response,

I have an update button in my Page, if i entered a value,and i press update button,then  the new value is saved in FacesContext / session, so how i can get the old value,if i click update button.

Please clarify...
0
 
LVL 20

Expert Comment

by:a_b
ID: 36977644
You will have have to store the old value in the  FacesContext / session in your backing bean as a temp variable. Use that temp variable to compare the fields the next time the update button is clicked.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:BhanuSVS
ID: 36977695
Hi a_b,

I am new to JSF, can you share the code please.
0
 
LVL 20

Accepted Solution

by:
a_b earned 2000 total points
ID: 36983869

use FacesContext.getExternalContext().getSession();
session.setAttribute("myTempVariable", variableValue);
0
 

Author Closing Comment

by:BhanuSVS
ID: 37088274
Thanks...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question