?
Solved

double-entry validation feature

Posted on 2005-03-08
16
Medium Priority
?
233 Views
Last Modified: 2010-04-01
hi!

I am work on sort of double-entry validation feature that promotes accuracy in data entry and it works like this:

After a user’s first input entry, the data is stored in temporary storage and table is cleared when a user clicks a button. And then the user must enter data for second time to match first input. If any input is not matched, it highlights unmatched input.

Now, I was doing this for client side by using javascript and it was quite ugly, so I am changing to server side. Since there are many forms like this, I am trying to create this feature that works for every pages. So, what options do I have? Is there any sort of built-in tools like this? I appreciate any comments. Btw, I am using struts.

Thanks,
0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
  • +1
16 Comments
 
LVL 29

Accepted Solution

by:
bloodredsun earned 272 total points
ID: 13490836
It would require you porting your application but the only one I know where it is built in is in Struts.

Else you would need to role your own and do something like this:

if ( stringOne.equals(stringTwo) == false){ //they don't match
    RequestDispatcher rd = request.getRequestDispatcher("form.jsp?stringOne="+ stringOne );//and the rest
    rd.forward(request, response) ;
   
}

for the form input field, to re-enter the values use somehting like JSTL as they default to empty strings when the value is null

so

<input type="text" name="stringOne" value="<c:out value='${param.stringOne}'>" />
0
 
LVL 28

Expert Comment

by:rrz
ID: 13491675
I am not an expert, but have you considered JSF  .
> I was doing this for client side by using javascript and it was quite ugly, so I am changing to server side.    
Yes, JSF can hold client state at server and it has event listeners.  
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSFIntro.html#wp114889
Experts please comment.           rrz
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13494146
I've never worked with JSF (it's always seemed a little immature for any big project, I'm waiting for Shale) but it does seem to do what rrz@871311 has said and he has posted a cracking link.
0
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!

 
LVL 28

Expert Comment

by:rrz
ID: 13496499
>it's always seemed a little immature    
I don't think that is true today.  
Look at
http://www-106.ibm.com/developerworks/library/j-jsf1/
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13496816
Thanks rrz, that's a genuinely interesting article. It made some points about JSF that I didn't realise and frankly I'd give you points just for that link! I hadn't realised just how similar JSF was to struts in some areas, but much simpler (which is both good and bad).
0
 
LVL 28

Expert Comment

by:rrz
ID: 13498858
>but much simpler (which is both good and bad).  
Please explain.
I don't use Struts.       rrz
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13504429
I like the fact that Struts has an action class as part of the controller which allows forwarding to a specific view depending on code, as well as using business delegates in the same way as JSF.
0
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 264 total points
ID: 13505468
>> I don't think that is true today.  
>> Look at
>> http://www-106.ibm.com/developerworks/library/j-jsf1/

Cool, but he goes through 3 items of FUD that I hadn't considered...

1) I'm not bothered about a WYSIWYG editor (I don't use one for Struts either)
2) I know you can combine JSF and Struts if needs be, so that shouldn't be a problem
3) Heh, Struts isn't easy either ;-)  At least at the beginning, so that doesn't concern me

What does concern me, and his example compounds that fear, is that it isn't production ready yet, and that I will develop something for weeks and months, only to come up against a brick wall where JSF just doesn't go there (or doesn't work).  His example of a very simple calculator just adds to my fear that it won't handle the hundreds of thousands of items of data that my webapps have to support.  I know Struts doesn't really without a bit of kicking, but I am in the situation of "better the devil you know"

It's strange that he doesn't seem to cover that item of FUD.

I too am waiting for Shale...but Struts will do till then...

Tim
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13505488
I think my fear comes from looking at loads of JSF tutorials, and the examples they give either;

a) look awful, or
b) are incredibly simple

Is there anything like Tiles for JSF?  Or do I have to use Tiles?

I love being able to make system wide design changes by editing 2 files...
0
 

Author Comment

by:dkim18
ID: 13507968
Thanks for your comments. (I read all your comments. )

I guess I need to tell more about this feature.
First, I want to make this feature to work for all pages since there are many. (so, i don't have to write for every action .)

Second, if there is any unmatched input, this feature should erase first input and a user needs to enter first and second again. Additionally, while this process, I want to make all matched input fields inactive so that a user do not change matched fields accidentally and can see those are matched fields. (I guess making fields inactive should be client side??)

Third, those matched input will be store in DB tables of course and I am thinking creating just one DAO that will handle all. (This will be a different issue, but might related to this problem.)

So, considering all those facts, what possible solution do I have?

Thanks again,
0
 
LVL 28

Expert Comment

by:rrz
ID: 13513042
>what possible solution do I have?  
I don't know enough about it to know if it is good solution. I am just learning but  here is my view.  
 JSF has support for server-side validation of a single component(like a field in a form). But, you have to write custum validators to validate relationships among components.  The basic outline as I understand it is

public class BackingBean  {
         private UIInput passwordField;
         private UIInput confirmField;
...... .
    public void validateConfirmField(FacesContext context, UIComponent component,Object value){  
            if(!passwordField.getLocalValue.equals(value))// then do something
                               
   }
}
On a page,  each field can be bound to a bean property and have an attached validator.

<h:inputText    binding="#{backingBean.confirmField}"
                      validator="#{backingBean.validateConfirmField}" />  




0
 
LVL 28

Assisted Solution

by:rrz
rrz earned 264 total points
ID: 13513246
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 14231760
I'm happy with this
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The well known Cerber ransomware continues to spread this summer through spear phishing email campaigns targeting enterprises. Learn how it easily bypasses traditional defenses - and what you can do to protect your data.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

801 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