bean missing after validation
hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: bean missing after validation
hi sebastian, If you have configured action to use redirect ( which is normal case ), ur request attributes will be lost. Try putting that bean seesion scope. sachin xoriant, mumbai PS : also make sure, how does struts take us back to input page ?( using forward or redirect i guees its redirect) -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:59 PM To: Struts Users Mailing List Subject: bean missing after validation hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean missing after validation
First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type text). But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time. See if this helps: http://www.reumann.net/struts/articles/request_lists.jsp Erik Sebastian Ho wrote: hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean missing after validation
Could you be little bit clear at your JSP? Thanks. Jitender Kumar C.V.
RE: bean missing after validation
I dont think this is right solution.. Jitender Kumar C.V.
Re: bean missing after validation
Why didnt I use html:hidden? Whenever I use that I have parsing error and exception thrown which I think is because of the bean:write within html:hidden. Using input didn't cause any problem. If html:hidden will not cause the problem and I am doing it the wrong way. Pls advise. Ok..now I understand the scope implication. I guess the only way to resolve this is to put everyting into session instead of request. Sebastian On Mon, 2004-09-20 at 15:38, Erik Weber wrote: First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type text). But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time. See if this helps: http://www.reumann.net/struts/articles/request_lists.jsp Erik Sebastian Ho wrote: hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: bean missing after validation
I thought you can't control redirect/forwrd for validation? I can control that for mapping forward only. Sebastian On Mon, 2004-09-20 at 15:14, Sachin Bhutada wrote: hi sebastian, If you have configured action to use redirect ( which is normal case ), ur request attributes will be lost. Try putting that bean seesion scope. sachin xoriant, mumbai PS : also make sure, how does struts take us back to input page ?( using forward or redirect i guees its redirect) -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:59 PM To: Struts Users Mailing List Subject: bean missing after validation hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean missing after validation
Hi Sebastian, I would suggest you to manually call validate method and let your data still remains in the request scope incase of validation being failed. I feel this to be a better solution for your scenario. Jitender Kumar C.V.
Re: bean missing after validation
Perhaps you would like to use the html-el tags (which also come with the Struts dist), like this: html-el:hidden property=${myBean.myField}/ But there is nothing wrong with using the standard html hidden input as far as I know (but you give up some Struts luxuries). Using Session scope is one way, but not the only way, to solve your problem. (Don't be afraid of it though). This is not an easy problem despite the simplicity of the concept of scope. Keep reading! Erik Sebastian Ho wrote: Why didnt I use html:hidden? Whenever I use that I have parsing error and exception thrown which I think is because of the bean:write within html:hidden. Using input didn't cause any problem. If html:hidden will not cause the problem and I am doing it the wrong way. Pls advise. Ok..now I understand the scope implication. I guess the only way to resolve this is to put everyting into session instead of request. Sebastian On Mon, 2004-09-20 at 15:38, Erik Weber wrote: First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type text). But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time. See if this helps: http://www.reumann.net/struts/articles/request_lists.jsp Erik Sebastian Ho wrote: hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean missing after validation
Tried changing it to session scpope. Guess wat, I hit into another problem. Because the values are in session scope, whenever there's validation errors, the values entered by user previously was reset to whats set in session! Guess have to continue reading to find a workaround.. If only struts does this for me.. Sebastian On Mon, 2004-09-20 at 16:29, Erik Weber wrote: Perhaps you would like to use the html-el tags (which also come with the Struts dist), like this: html-el:hidden property=${myBean.myField}/ But there is nothing wrong with using the standard html hidden input as far as I know (but you give up some Struts luxuries). Using Session scope is one way, but not the only way, to solve your problem. (Don't be afraid of it though). This is not an easy problem despite the simplicity of the concept of scope. Keep reading! Erik Sebastian Ho wrote: Why didnt I use html:hidden? Whenever I use that I have parsing error and exception thrown which I think is because of the bean:write within html:hidden. Using input didn't cause any problem. If html:hidden will not cause the problem and I am doing it the wrong way. Pls advise. Ok..now I understand the scope implication. I guess the only way to resolve this is to put everyting into session instead of request. Sebastian On Mon, 2004-09-20 at 15:38, Erik Weber wrote: First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type text). But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time. See if this helps: http://www.reumann.net/struts/articles/request_lists.jsp Erik Sebastian Ho wrote: hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean missing after validation
What did you change to Session scope? It looks to me like you are trying to put the current user ID into the form as a hidden variable. I would have thought that your user bean would already have been in Session scope . . . not the case? Are you retrieving other values for your form from Session scope? Erik Sebastian Ho wrote: Tried changing it to session scpope. Guess wat, I hit into another problem. Because the values are in session scope, whenever there's validation errors, the values entered by user previously was reset to whats set in session! Guess have to continue reading to find a workaround.. If only struts does this for me.. Sebastian On Mon, 2004-09-20 at 16:29, Erik Weber wrote: Perhaps you would like to use the html-el tags (which also come with the Struts dist), like this: html-el:hidden property=${myBean.myField}/ But there is nothing wrong with using the standard html hidden input as far as I know (but you give up some Struts luxuries). Using Session scope is one way, but not the only way, to solve your problem. (Don't be afraid of it though). This is not an easy problem despite the simplicity of the concept of scope. Keep reading! Erik Sebastian Ho wrote: Why didnt I use html:hidden? Whenever I use that I have parsing error and exception thrown which I think is because of the bean:write within html:hidden. Using input didn't cause any problem. If html:hidden will not cause the problem and I am doing it the wrong way. Pls advise. Ok..now I understand the scope implication. I guess the only way to resolve this is to put everyting into session instead of request. Sebastian On Mon, 2004-09-20 at 15:38, Erik Weber wrote: First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type text). But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time. See if this helps: http://www.reumann.net/struts/articles/request_lists.jsp Erik Sebastian Ho wrote: hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: bean missing after validation
Ok I resolved it and I think this is the best way at least for now. In my ActionForm, set the attribute back in request if there's error : if(errors != null) { ActionForm form = new ActionForm(); form.set form.set request.setAttribute(user, form); } Sebastian On Mon, 2004-09-20 at 16:11, Sebastian Ho wrote: I thought you can't control redirect/forwrd for validation? I can control that for mapping forward only. Sebastian On Mon, 2004-09-20 at 15:14, Sachin Bhutada wrote: hi sebastian, If you have configured action to use redirect ( which is normal case ), ur request attributes will be lost. Try putting that bean seesion scope. sachin xoriant, mumbai PS : also make sure, how does struts take us back to input page ?( using forward or redirect i guees its redirect) -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:59 PM To: Struts Users Mailing List Subject: bean missing after validation hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean missing after validation
Hi, Test like this! In JSP input type=hidden property=userID / write get and set method for userID in ActionForm On 20 Sep 2004 17:44:15 +0800, Sebastian Ho [EMAIL PROTECTED] wrote: Ok I resolved it and I think this is the best way at least for now. In my ActionForm, set the attribute back in request if there's error : if(errors != null) { ActionForm form = new ActionForm(); form.set form.set request.setAttribute(user, form); } Sebastian On Mon, 2004-09-20 at 16:11, Sebastian Ho wrote: I thought you can't control redirect/forwrd for validation? I can control that for mapping forward only. Sebastian On Mon, 2004-09-20 at 15:14, Sachin Bhutada wrote: hi sebastian, If you have configured action to use redirect ( which is normal case ), ur request attributes will be lost. Try putting that bean seesion scope. sachin xoriant, mumbai PS : also make sure, how does struts take us back to input page ?( using forward or redirect i guees its redirect) -Original Message- From: Sebastian Ho [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:59 PM To: Struts Users Mailing List Subject: bean missing after validation hi i have the following codes in my JSP : input type=hidden name=userID value=bean:write name=user property=userID scope=request// which converts into input type=hidden name=userID value=1/. If validation is used and there are errors, the input page is displayed. Now the above value became : input type=hidden name=userID value=/ The valus is missing.. Can anyone explain why this is happening and how to resolve it? sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]