AW: Set DynaActionForm to see values in textfields...(form-page)
Oh sorry, the HashMaps works correct, BUT only if you DONT use a DyaActionForm Formular. If you use the Validation you have to use also a DynaActionForm-Session Object (or request-Object). now i have find something which helps me!! http://radio.javaranch.com/channel/jason/2004/03/23/1080083794000.html I used all the code and now i can -> put Database-Values into my formular to edit the values and update it into the database or -> put really new Values into the Database Thanks for your help! Johannes -Ursprüngliche Nachricht- Von: johannes Schwarz [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 25. Mai 2004 13:54 An: '[EMAIL PROTECTED]' Betreff: AW: Set DynaActionForm to see values in textfields...(form-page) Thanks... For two minnutes i tested the following code in one Action bevor a struts-formular it works ;-) - HashMap linkMap = new HashMap(); linkMap.put("name", "Schwarz"); linkMap.put("vorname", "Johannes"); linkMap.put("textbereich", "Johannes TEXTETXTEXT"); session.setAttribute("PageA", linkMap); --- All fields have the values which are defined in the session. Thanks Johannes -Ursprüngliche Nachricht- Von: Nimish Chourey [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 25. Mai 2004 11:17 An: Struts Users Mailing List Betreff: Re: Set DynaActionForm to see values in textfields...(form-page) Hi Johannes , Are you sure this code works ?? String field1 = (String) PageA.get("field1"); String textfield2 = (String) PageA.get("textfield2"); . DynaActionForm PageB = (DynaActionForm) session_automatic.getAttribute("PageB"); String textfield1 = (String) PageB.get("textfield1"); String textfield2 = (String) PageB.get("textfield2"); Have you checked the text field values ? I feel only one form would be submited . You shoud be using the form in "execute" method and I feel One action is related to one form , so you would get only values of one form . public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { RegistrationForm regform = (RegistrationForm) form; } - Original Message - From: "johannes Schwarz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 25, 2004 4:13 PM Subject: Set DynaActionForm to see values in textfields...(form-page) > Hello, > > I have created more than one form-pages with struts. After validation > i can read the values in the Action with: > > - > HttpSession session = httpServletRequest.getSession(); DynaActionForm > PageA = (DynaActionForm) session_automatic.getAttribute("PageA"); > //This is a DynaActionForm-Object in the Session > String field1 = (String) PageA.get("field1"); > String textfield2 = (String) PageA.get("textfield2"); > . > DynaActionForm PageB = (DynaActionForm) > session_automatic.getAttribute("PageB"); > String textfield1 = (String) PageB.get("textfield1"); > String textfield2 = (String) PageB.get("textfield2"); > . > -- > > All works! > Now i would like to edit one entry from the Database. > So i have to define the Sessions and after the definition i go to the > form-page. Than the fields must have the values from the Database. > > But this doesn't work!! > > My Code: > --- > HttpSession session = httpServletRequest.getSession(); DynaActionForm > PageA = new DynaActionForm(); PageA.set("textfield1","My Value"); > PageA.set("textfield2","My Value"); > DynaActionForm PageB = new DynaActionForm(); > PageB.set("textfield1","My Value"); > PageB.set("textfield2","My Value"); > > > //Define a DynaActionForm-Object in the session > session.setAttribute("PageA", PageA); session.setAttribute("PageB", > PageB); > - > > This breaks at the line PageA.set(). > The ERROR is "java.lang.NullPointerException" > > Can you help me? > Thanks! > > > - > 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]
AW: Set DynaActionForm to see values in textfields...(form-page)
Oh sorry, the HashMaps works correct, BUT only if you DONT use a DyaActionForm Formular. If you use this (the Validation) you have to use also a DynaActionForm-Session Object (or request-Object). now i have find something which helps me!! http://radio.javaranch.com/channel/jason/2004/03/23/1080083794000.html I used all the code and now i can -> put Database-Values into my formular to edit the values and update it into the database -> or i can put really new Values into the Database Thanks for your help! Johannes -Ursprüngliche Nachricht- Von: johannes Schwarz [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 25. Mai 2004 13:54 An: '[EMAIL PROTECTED]' Betreff: AW: Set DynaActionForm to see values in textfields...(form-page) Thanks... For two minnutes i tested the following code in one Action bevor a struts-formular it works ;-) - HashMap linkMap = new HashMap(); linkMap.put("name", "Schwarz"); linkMap.put("vorname", "Johannes"); linkMap.put("textbereich", "Johannes TEXTETXTEXT"); session.setAttribute("PageA", linkMap); --- All fields have the values which are defined in the session. Thanks Johannes -Ursprüngliche Nachricht- Von: Nimish Chourey [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 25. Mai 2004 11:17 An: Struts Users Mailing List Betreff: Re: Set DynaActionForm to see values in textfields...(form-page) Hi Johannes , Are you sure this code works ?? String field1 = (String) PageA.get("field1"); String textfield2 = (String) PageA.get("textfield2"); . DynaActionForm PageB = (DynaActionForm) session_automatic.getAttribute("PageB"); String textfield1 = (String) PageB.get("textfield1"); String textfield2 = (String) PageB.get("textfield2"); Have you checked the text field values ? I feel only one form would be submited . You shoud be using the form in "execute" method and I feel One action is related to one form , so you would get only values of one form . public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { RegistrationForm regform = (RegistrationForm) form; } - Original Message - From: "johannes Schwarz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 25, 2004 4:13 PM Subject: Set DynaActionForm to see values in textfields...(form-page) > Hello, > > I have created more than one form-pages with struts. After validation > i can read the values in the Action with: > > - > HttpSession session = httpServletRequest.getSession(); DynaActionForm > PageA = (DynaActionForm) session_automatic.getAttribute("PageA"); > //This is a DynaActionForm-Object in the Session > String field1 = (String) PageA.get("field1"); > String textfield2 = (String) PageA.get("textfield2"); > . > DynaActionForm PageB = (DynaActionForm) > session_automatic.getAttribute("PageB"); > String textfield1 = (String) PageB.get("textfield1"); > String textfield2 = (String) PageB.get("textfield2"); > . > -- > > All works! > Now i would like to edit one entry from the Database. > So i have to define the Sessions and after the definition i go to the > form-page. Than the fields must have the values from the Database. > > But this doesn't work!! > > My Code: > --- > HttpSession session = httpServletRequest.getSession(); DynaActionForm > PageA = new DynaActionForm(); PageA.set("textfield1","My Value"); > PageA.set("textfield2","My Value"); > > DynaActionForm PageB = new DynaActionForm(); > PageB.set("textfield1","My Value"); > PageB.set("textfield2","My Value"); > > > //Define a DynaActionForm-Object in the session > session.setAttribute("PageA", PageA); session.setAttribute("PageB", > PageB); > - > > This breaks at the line PageA.set(). > The ERROR is "java.lang.NullPointerException" > > Can you help me? > Thanks! > > > - > 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]
AW: Set DynaActionForm to see values in textfields...(form-page)
Thanks... For two minnutes i tested the following code in one Action bevor a struts-formular it works ;-) - HashMap linkMap = new HashMap(); linkMap.put("name", "Schwarz"); linkMap.put("vorname", "Johannes"); linkMap.put("textbereich", "Johannes TEXTETXTEXT"); session.setAttribute("PageA", linkMap); --- All fields have the values which are defined in the session. Thanks Johannes -Ursprüngliche Nachricht- Von: Nimish Chourey [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 25. Mai 2004 11:17 An: Struts Users Mailing List Betreff: Re: Set DynaActionForm to see values in textfields...(form-page) Hi Johannes , Are you sure this code works ?? String field1 = (String) PageA.get("field1"); String textfield2 = (String) PageA.get("textfield2"); . DynaActionForm PageB = (DynaActionForm) session_automatic.getAttribute("PageB"); String textfield1 = (String) PageB.get("textfield1"); String textfield2 = (String) PageB.get("textfield2"); Have you checked the text field values ? I feel only one form would be submited . You shoud be using the form in "execute" method and I feel One action is related to one form , so you would get only values of one form . public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { RegistrationForm regform = (RegistrationForm) form; } - Original Message - From: "johannes Schwarz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, May 25, 2004 4:13 PM Subject: Set DynaActionForm to see values in textfields...(form-page) > Hello, > > I have created more than one form-pages with struts. After validation > i can read the values in the Action with: > > - > HttpSession session = httpServletRequest.getSession(); DynaActionForm > PageA = (DynaActionForm) session_automatic.getAttribute("PageA"); > //This is a DynaActionForm-Object in the Session > String field1 = (String) PageA.get("field1"); > String textfield2 = (String) PageA.get("textfield2"); > . > DynaActionForm PageB = (DynaActionForm) > session_automatic.getAttribute("PageB"); > String textfield1 = (String) PageB.get("textfield1"); > String textfield2 = (String) PageB.get("textfield2"); > . > -- > > All works! > Now i would like to edit one entry from the Database. > So i have to define the Sessions and after the definition i go to the > form-page. Than the fields must have the values from the Database. > > But this doesn't work!! > > My Code: > --- > HttpSession session = httpServletRequest.getSession(); DynaActionForm > PageA = new DynaActionForm(); PageA.set("textfield1","My Value"); > PageA.set("textfield2","My Value"); > > DynaActionForm PageB = new DynaActionForm(); > PageB.set("textfield1","My Value"); > PageB.set("textfield2","My Value"); > > > //Define a DynaActionForm-Object in the session > session.setAttribute("PageA", PageA); session.setAttribute("PageB", > PageB); > - > > This breaks at the line PageA.set(). > The ERROR is "java.lang.NullPointerException" > > Can you help me? > Thanks! > > > - > 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]
Set DynaActionForm to see values in textfields...(form-page)
Hello, I have created more than one form-pages with struts. After validation i can read the values in the Action with: - HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = (DynaActionForm) session_automatic.getAttribute("PageA"); //This is a DynaActionForm-Object in the Session String field1 = (String) PageA.get("field1"); String textfield2 = (String) PageA.get("textfield2"); . DynaActionForm PageB = (DynaActionForm) session_automatic.getAttribute("PageB"); String textfield1 = (String) PageB.get("textfield1"); String textfield2 = (String) PageB.get("textfield2"); . -- All works! Now i would like to edit one entry from the Database. So i have to define the Sessions and after the definition i go to the form-page. Than the fields must have the values from the Database. But this doesn't work!! My Code: --- HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = new DynaActionForm(); PageA.set("textfield1","My Value"); PageA.set("textfield2","My Value"); DynaActionForm PageB = new DynaActionForm(); PageB.set("textfield1","My Value"); PageB.set("textfield2","My Value"); //Define a DynaActionForm-Object in the session session.setAttribute("PageA", PageA); session.setAttribute("PageB", PageB); - This breaks at the line PageA.set(). The ERROR is "java.lang.NullPointerException" Can you help me? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Set DynaActionForm to see values in textfields...(form-page)
Hello, I have created more than one form-pages with struts. After validation i can read the values in the Action with: - HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = (DynaActionForm) session_automatic.getAttribute("PageA"); //This is a DynaActionForm-Object in the Session String field1 = (String) PageA.get("field1"); String textfield2 = (String) PageA.get("textfield2"); . DynaActionForm PageB = (DynaActionForm) session_automatic.getAttribute("PageB"); String textfield1 = (String) PageB.get("textfield1"); String textfield2 = (String) PageB.get("textfield2"); . -- All works! Now i would like to edit one entry from the Database. So i have to define the Sessions and after the definition i go to the form-page. Than the fields must have the values from the Database. But this doesn't work!! My Code: --- HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = new DynaActionForm(); PageA.set("textfield1","My Value"); PageA.set("textfield2","My Value"); DynaActionForm PageB = new DynaActionForm(); PageB.set("textfield1","My Value"); PageB.set("textfield2","My Value"); //Define a DynaActionForm-Object in the session session.setAttribute("PageA", PageA); session.setAttribute("PageB", PageB); - This breaks at the line PageA.set(). The ERROR is "java.lang.NullPointerException" Can you help me? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Set DynaActionForm to see values in textfields...(form-page)
Hello, I have created more than one form-pages with struts. After validation i can read the values in the Action with: - HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = (DynaActionForm) session_automatic.getAttribute("PageA"); //This is a DynaActionForm-Object in the Session String field1 = (String) PageA.get("field1"); String textfield2 = (String) PageA.get("textfield2"); . DynaActionForm PageB = (DynaActionForm) session_automatic.getAttribute("PageB"); String textfield1 = (String) PageB.get("textfield1"); String textfield2 = (String) PageB.get("textfield2"); . -- All works! Now i would like to edit one entry from the Database. So i have to define the Sessions and after the definition i go to the form-page. Than the fields must have the values from the Database. But this doesn't work!! My Code: --- HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = new DynaActionForm(); PageA.set("textfield1","My Value"); PageA.set("textfield2","My Value"); DynaActionForm PageB = new DynaActionForm(); PageB.set("textfield1","My Value"); PageB.set("textfield2","My Value"); //Define a DynaActionForm-Object in the session session.setAttribute("PageA", PageA); session.setAttribute("PageB", PageB); - This breaks at the line PageA.set(). The ERROR is "java.lang.NullPointerException" Can you help me? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Set DynaActionForm to see values in textfields...(form-page)
Hello, I have created more than one form-pages with struts. After validation i can read the values in the Action with: - HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = (DynaActionForm) session_automatic.getAttribute("PageA"); //This is a DynaActionForm-Object in the Session String field1 = (String) PageA.get("field1"); String textfield2 = (String) PageA.get("textfield2"); . DynaActionForm PageB = (DynaActionForm) session_automatic.getAttribute("PageB"); String textfield1 = (String) PageB.get("textfield1"); String textfield2 = (String) PageB.get("textfield2"); . -- All works! Now i would like to edit one entry from the Database. So i have to define the Sessions and after the definition i go to the form-page. Than the fields must have the values from the Database. But this doesn't work!! My Code: --- HttpSession session = httpServletRequest.getSession(); DynaActionForm PageA = new DynaActionForm(); PageA.set("textfield1","My Value"); PageA.set("textfield2","My Value"); DynaActionForm PageB = new DynaActionForm(); PageB.set("textfield1","My Value"); PageB.set("textfield2","My Value"); //Define a DynaActionForm-Object in the session session.setAttribute("PageA", PageA); session.setAttribute("PageB", PageB); - This breaks at the line PageA.set(). The ERROR is "java.lang.NullPointerException" Can you help me? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validation - can i use multiple properties ?
Hello, with struts-config.xml i define: Than I can write the following code in a jsp-File: (i see the Field1-value from the XXX-File) (I see the Field1-value from the YYY-File) now I am using a form with validation.xml. Some fields are required and the shown error is: ... ... On Submit I see the Field1.error-value from the XXX-File. I would like to see the error-value from the YYY-File. Is this possible? Thanks Johannes - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Validation - can i use multiple properties ?
I know this and i use this language files. XXX_de.properties XXX_en.properties AND YYY_de.properties YYY_en.properties I use a action to set the language: - String lang = httpServletRequest.getParameter("language"); Locale newlang = new Locale(lang); this.setLocale(httpServletRequest, newlang); - And in all jsp-Pages i can use the properties. But why isn't it possible to use different properties between the validation file? If i use three different forms (html-formular), than i would like to use also -> three different validationfiles it works, i use between struts-config: X-Validation.xml is defined for formular 1 Y-Validation.xml is defined for formular 2 and so on -> three different configfiles it works, i use between struts-config: [ ] and at the position i write &actions; MyActions1.xml is defined for formular 1 (all actions for this fields...) MyActions2.xml is ... -> three different properties-files it works between the jsp-pages, but NOT between VALIDATION. //The defenition between config //My jsp-Pages: Page1.jsp: ...: :
Validation - can i use multiple properties ?
Hello, with struts-config.xml i define: Than I can write the following code in a jsp-File: (i see the Field1-value from the XXX-File) (I see the Field1-value from the YYY-File) now I am using a form with validation.xml. Some fields are required and the shown error is: ... ... On Submit I see the Field1.error-value from the XXX-File. I would like to see the error-value from the YYY-File. Is this possible? How to define? Thanks Johannes - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]