« Return to Thread: html:multibox read but not write
Laurie Harper wrote:None of the JSP code made it out of your mail client into the message
I'm afraid. Try re-posting with your mail program set for plain text
instead of multipart/mime.
L.
houser wrote:
> Hi All,
>
> I am in very strange situation, and stuck! please help, I have found one
> thread that much more or less but does not help..
>
> http://www.nabble.com/Check-a-multibox-dynamically-to6630704.html#a6630704
> http://www.nabble.com/Check-a-multibox-dynamically-to6630704.html#a6630704
>
> I have already use some example and it works.. Now the situation is lsightly
> different:
>
> I have a form:
>
> ------------ Start Code ------------
>
>
> .... FunctionProForm extends ActionForm {
> private List functionProList = new ArrayList();
>
> ...
>
> public List getSelectedPros(FunctionDto fun){
>
> List result = new ArrayList();
> for(FunProMap fp : functionProList){
>
> if(fp.getFunction().getName().equals(fun.getName())){
>
> for(int i = 0; i < fp.getSelectedPros().length; i++){
> result.add(fp.getSelectedPros()[i]);
> }
> return result;
> }
> }
>
> return result;
> }
> }
>
>
> ------ the serializable object FunProMap ------------------
>
>
> public class FunProMap implements Serializable{
>
> private static final long serialVersionUID = 1L;
>
> private FunctionDto function = new FunctionDto();
> private List pros = new ArrayList();
> private String[] selectedPros = {};
>
> ....
> }
>
>
> --------------- in JSP: -------------
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --------------------- in the SaveAction ----------------------
>
>
> .... SaveAction extends Action {
> protected ActionForward doExecute(ActionMapping mapping,
> ActionForm form, HttpServletRequest request,
> HttpServletResponse response){
>
> FunctionProForm myForm = (FunctionProForm) form;
> ...
>
> List functions = myService.listFunctions();
>
> for(FunctionDto fun : functions){
>
> fun.setPros(myForm.getSelectedPros(fun));
>
> myService.updateFunction(fun);
> }
> ....
> return mapping.findForward("success");
> }
> }
>
>
> ------------ End Code ------------
>
> The check boxes are populated correctly from the database, i.e. for each
> FUnction, the corresponding checkbos is checked according to the list of
> available Pros (function.pros).
>
> The problem is that if I edit these boxes, check and uncheck, and click the
> Submit button, the changed is not saved to the database.
>
> I have run the debug and find that the method myForm.getSelectedPros(fun)
> returns the old values but not the new checked-unchecked boxes' values :-(
> !!
>
> I have used with a simple form according to:
>
> http://www.jguru.com/faq/view.jsp?EID=925277
> http://www.jguru.com/faq/view.jsp?EID=925277
>
>
> MyForm extends ActionForm {
> List myList;
> String[] selectedValues;
> // ....
> }
>
>
> and
>
>
>
>
>
>
>
>
>
>
>
> and this works fine..
>
> Please help...
>
> ruga
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
« Return to Thread: html:multibox read but not write
| Free Forum Powered by Nabble | Forum Help |