Link to home
Start Free TrialLog in
Avatar of kls1
kls1

asked on

Initial Value in a JSF input field as Compared to the Bean Name you want to save it in

I'm new to JSF. I'm familiar with using a Bean to save the value by using the value parameter with the inputText component. But, what if I want to save the value to the Bean when I leave the page and I want to pull the initial value from another field on the page? (i.e. Let's say I have a mailing address and a shipping address and I want the default shipping address to be what the mailing address is) Would this need to involved Javascript or is there a simple way/field to handle this in JSF?
Avatar of jaggernat
jaggernat

use two hidden fields, one for the mailing address and other for shipping address.
Avatar of kls1

ASKER

Wouldn't that require a submit? I need this to to immediate as the person navigates the fields.
Avatar of kls1

ASKER

Maybe I don't follow what you are saying.
Avatar of kls1

ASKER

I suspect my initial description is poorly worded. My situation is different, but a common example would be that I have a page where there is listed both a billing and shipping street address field. I am familiar with the situation where the person presses the button that says "they are the same" but that isn't really appropriate for my situation. What I need is for the shipping street address field to automatically populate with whatever is in the billing street address.

So, I guess another way of asking this would be: is there a means is JSF where I can do event handling, where when the billing street address is changed then the shipping street address gets a value added if it doesn't already have one.
ASKER CERTIFIED SOLUTION
Avatar of jaggernat
jaggernat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kls1

ASKER

Ok, so JSF doesn't handle this sort of thing then? I would just do the usual Javascript event handling?

I'm trying to do things the "right" way with JSF.
using javascript you are doing it on the client side.
using jsf you will be doing it on the server side, but, UNLESS you click a button or submit the jsp, you cannot do it on the server side using jsf. thats not possible.

since you are not submitting the jsp, javascript would be your best choice. I am also pretty sure thats the only choice!







Avatar of kls1

ASKER

Yeah, I guess that makes sense. I just haven't been clear on what JSF adds to JSP. So, the event handling mechisms with JSF are server side also (yeah, I know "Java Server Faces") ? This is what I have been unclear about -- what does JSF offer in addition to JSP....
let me make this clear to you:

JSF is a front end framework using which you can control the front-end peice of an application. So JSF provides its own tag library and stuff using which you will design the jsps. So basically, you are putting in jsf tags in a jsp and designing your jsp pages.
 there is no event handling mechanism in jsf. you would have to use javascript to accomplish your event handling stuff

Avatar of kls1

ASKER

Ok, thanks. That means I need to remove one of my reference urls from my list! (it mentioned JSF doing event handling)

Thanks for your help