RE: Handling Date objects in ActionForm gracefully
What's the problem? robert -Original Message- From: Sreenivasa Chadalavada [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 2:28 PM To: Struts Users Mailing List Subject: Handling Date objects in ActionForm gracefully All, We are facing a problem when we define java.util.Date field in ActionForm. Is there any way to override the default behavior provided by Struts? I very much appreciate your help!! Thanks and Regards, Sree/- This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Handling Date objects in ActionForm gracefully
+1 -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 2:36 PM To: Struts Users Mailing List Subject: Re: Handling Date objects in ActionForm gracefully Have it as a string and convert it to a date or calendar when you pass it back to the model. On 25 Mar 2004, at 20:28, Sreenivasa Chadalavada wrote: All, We are facing a problem when we define java.util.Date field in ActionForm. Is there any way to override the default behavior provided by Struts? I very much appreciate your help!! Thanks and Regards, Sree/- --- - This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose. --- - - 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: Using JSTL Instead of Nested Tags
Mike, you will have to expose the form like: c:set var=form value=${myForm}/ ...where myForm is its name defined in the struts-config file. If its DynaForm then you have to expose the form map: c:set var=form value=${myForm.map}/ Once you do this, you can use JSTL to access and render values: c:out value=${form.someProperty}/ or c:out value=${form.some.nestedProperty}/ robert -Original Message- From: Mike Duffy [mailto:[EMAIL PROTECTED] Sent: Thursday, March 25, 2004 4:46 PM To: Struts Users Mailing List Subject: Using JSTL Instead of Nested Tags I'm trying to convert an application from Struts display tags to JSTL (still using Struts as the MVC). I am having some difficulty converting nested tags to JSTL. Can anyone offer any guidance? Thanks. Mike __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html - 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: Indexed Property
http://jakarta.apache.org/struts/faqs/indexedprops.html -Original Message- From: Prakasan OK [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 6:18 AM To: Struts Users Mailing List Subject: Indexed Property Hi, can anyone give me a sample code for implementing indexed properties? how should the jsp page and the corresponding Action class look like? thanks, Prakasan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: user login authentication and session timeout
Charles, you can use container managed security or the SecurityFilter to authenticate users when accessing protected resources. You can set the session time out by adding something like the following to your web.xml file: session-config session-timeout60/session-timeout /session-config You can find more information on SecurityFilter here: http://sourceforge.net/projects/securityfilter/ Your servlet container documentation should let you know how to implement container managed security. robert -Original Message- From: Charles Jordan [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 1:35 PM To: [EMAIL PROTECTED] Subject: user login authentication and session timeout I'm looking for examples or to be pointed in the right direction on how to achieve the following. I want my users to be able to access a mojority of my pages without having to login, but if they select a specific page a small login pop-up window would display which would require a valid user name and password. I also want the session to time-out after a period of time. Any ides? Charles (Allen) Jordan [EMAIL PROTECTED] System Administrator(407)771-8919 Convergys 285 International Parkway, Lake Mary, FL 32746-5007 - 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:write
Try using the following with JSTL: c:set var=myValue value=${teacher.SSN}/ or you can try the following using bean:*.../ bean:define id=myValue name=teacher property=SSN/ If you are still getting a error make sure you are using proper JavaBean naming conventions. You can find this in the JavaBean specification. robert -Original Message- From: as as [mailto:[EMAIL PROTECTED] Sent: Sunday, March 21, 2004 12:47 PM To: Struts Users Mailing List Subject: Bean:write Hi, In my logic:iterate tag, I want to pull out the value of the bean:write tag. I am using following syntax. something is probably wrong, as i am getting a compile error. looking for right syntax basically all i want to to is pull out the value of the bean:write tag. Thanks in advance. % java.lang.String myValue = bean:write name=teacher property =SSN/;. Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: access variable value in html tag
You will need to use Struts-EL taglib then you should be able to do what you want. http://jakarta.apache.org/struts/faqs/struts-el.html html:select property=no_account c:forEach var=accounts items=${Accounts} varStatus=status html_el:option value=${account.no_account} c:out value=${accounts.number}/html_el:option /c:forEach /html:select You might also investigate using the html:optionsCollection .../ or the html:options .../ http://jakarta.apache.org/struts/userGuide/struts-html robert -Original Message- From: Steltner, Joern [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 7:28 AM To: [EMAIL PROTECTED] Subject: access variable value in html tag Dear, I'm not an expert in Struts and Java. I need some simple help: html:select property=no_account c:forEach var=accounts items=${Accounts} varStatus=status html:option value=c:out value=${accounts.number}/html:option /c:forEach /html:select Everything works fine, but at ??? mark I would like take account.no_account like ${accounts.number}, but it doesn't work. May someone can give me a small note about the right syntax to get the value from accounts.number as text in the quotes. Thanks Regards J. Steltner - 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: action - delegate - facade
Adam, I think Nick was just asking about the trip from the server to the client, not from the client to the server. As already discussed, the method for transfering user input to the business tier would be to copy the values from the action form to the appropriate DTO's using BeanUtils or some other method. robert -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, March 18, 2004 4:57 AM To: Struts Users Mailing List Subject: Re: action - delegate - facade Downside is though, trying to cram string request parameters into your DTO in your form before you validate them. Causes ugly exception messages on the browser. On 03/18/2004 02:25 AM Robert Taylor wrote: Well, I would say it depends. If I had a DTO ( a domain object) which had all the fields I needed to display...including types like int, Date, boolean, etc... I would probably just pass that along to the form bean and let view helpers like the Struts tags or JSTL render the contents. With JSTL you can format Dates and numbers. I believe those tags leverage the java.text.* package for formatting data. If I needed to perform some specialized formatting which could not be done by view helpers then I may just convert the necessary fields to Strings (maybe using BeanUtils) format them, and populate my ActionForm. If the view I needed of the data was not encapsulated in a single DTO, then you could retrieve multiple DTO objects and rendered them as described above or use a pattern described as Transfer Object Assembler which builds a custom DTO or a collection of customer DTO objects which you could pass along to the ActionForm. You can read more about Transfer Object Assembler here: http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObjectAssembler.html robert -Original Message- From: Nick Wesselman [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 6:28 PM To: Struts Users Mailing List Subject: Re: action - delegate - facade What about when simply displaying data on a page? Do developers typically copy data out of the domain object just to display it? (As opposed to using it w/ a form.) The only issue I see is that you may end up introducing view helper methods to your model beans. Nick Robert Taylor wrote: Adam, its frowned upon to pass a web tier object (ActionForm) into the business tier. I believe a widely used technique is to use BeanUtils to copy the properties from the ActionForm to a DTO (a Domain Object) which can be passed to the business tier. robert - 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] -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - 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: SSLEXT
Use the sslext:pageScheme secure=false/ on the main page. This should switch it back to HTTP. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 9:58 AM To: 'Struts Users Mailing List' Subject: SSLEXT Hello. I'm now using the SSLEXT for struts (following some advices frm the list). Now I have my login action protected by HTTPS, but I want the user, after login, being forward to the main page of the application using HTTP protocol. Is this possible? Or I can only change the protocol in diferrente requests? Thanks, JP - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SSLEXT
Okay. Then you should be able to place the following in your struts-config action mapping for the main page. set-property property=secure value=false/ robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:17 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT I can't. Because my main page is not a page at all. It's a Tiles definition. Where can I find the documentation about SSLEXT? I mean the description of the tags? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:09 To: Struts Users Mailing List Subject: RE: SSLEXT Use the sslext:pageScheme secure=false/ on the main page. This should switch it back to HTTP. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 9:58 AM To: 'Struts Users Mailing List' Subject: SSLEXT Hello. I'm now using the SSLEXT for struts (following some advices frm the list). Now I have my login action protected by HTTPS, but I want the user, after login, being forward to the main page of the application using HTTP protocol. Is this possible? Or I can only change the protocol in diferrente requests? Thanks, JP - 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: SSLEXT
Yes. Instead of forwarding directly to the Tile, define an action which simply forwards (or redirects) to that main page (tile) and in that action mapping configuration define it to be secure using the set-property element. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:39 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Ok, but the main page is still in HTTPS. Let me try to explain the flow: 1. User enter with username and password 2. User submit the form to an HTTPS address 3. A LoginAction try to authenticate the user with the data transmitted (username and password) with HTTPS protocol 4. LoginAction forward the user to the main page. -- Here I want the user being forward to an HTTP address. There is no action defined after LoginAtion. LoginAction must be secure so the username and password are trasmitted in a secure way. But after that, no more HTTPS is necessary. Is there way in step 4 to forward the user to a non secure page? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:29 To: Struts Users Mailing List Subject: RE: SSLEXT Okay. Then you should be able to place the following in your struts-config action mapping for the main page. set-property property=secure value=false/ robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:17 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT I can't. Because my main page is not a page at all. It's a Tiles definition. Where can I find the documentation about SSLEXT? I mean the description of the tags? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:09 To: Struts Users Mailing List Subject: RE: SSLEXT Use the sslext:pageScheme secure=false/ on the main page. This should switch it back to HTTP. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 9:58 AM To: 'Struts Users Mailing List' Subject: SSLEXT Hello. I'm now using the SSLEXT for struts (following some advices frm the list). Now I have my login action protected by HTTPS, but I want the user, after login, being forward to the main page of the application using HTTP protocol. Is this possible? Or I can only change the protocol in diferrente requests? Thanks, JP - 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: SSLEXT
Correction: ...in that action mapping configuration define it to be non-secure using the set-property element. -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:52 AM To: Struts Users Mailing List Subject: RE: SSLEXT Yes. Instead of forwarding directly to the Tile, define an action which simply forwards (or redirects) to that main page (tile) and in that action mapping configuration define it to be secure using the set-property element. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:39 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Ok, but the main page is still in HTTPS. Let me try to explain the flow: 1. User enter with username and password 2. User submit the form to an HTTPS address 3. A LoginAction try to authenticate the user with the data transmitted (username and password) with HTTPS protocol 4. LoginAction forward the user to the main page. -- Here I want the user being forward to an HTTP address. There is no action defined after LoginAtion. LoginAction must be secure so the username and password are trasmitted in a secure way. But after that, no more HTTPS is necessary. Is there way in step 4 to forward the user to a non secure page? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:29 To: Struts Users Mailing List Subject: RE: SSLEXT Okay. Then you should be able to place the following in your struts-config action mapping for the main page. set-property property=secure value=false/ robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:17 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT I can't. Because my main page is not a page at all. It's a Tiles definition. Where can I find the documentation about SSLEXT? I mean the description of the tags? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:09 To: Struts Users Mailing List Subject: RE: SSLEXT Use the sslext:pageScheme secure=false/ on the main page. This should switch it back to HTTP. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 9:58 AM To: 'Struts Users Mailing List' Subject: SSLEXT Hello. I'm now using the SSLEXT for struts (following some advices frm the list). Now I have my login action protected by HTTPS, but I want the user, after login, being forward to the main page of the application using HTTP protocol. Is this possible? Or I can only change the protocol in diferrente requests? Thanks, JP - 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: SSLEXT
The following should work without changing any code in your LoginAction: action path=/login type=mypackage.LoginAction name=formLogin scope=request input=/login.jsp set-property property=secure value=true/ /action My forward: global-forwards forward name=initial path=/prefix/initial/ /global-forwards My LoginAction after a sucessful login: return mapping.findForward(initial); Now I have this action to forward to the tiles definition: action path=/initial forward=tiles.initial set-property property=secure value=false/ /action Note that prefix is what ever prefix you are using to invoke the Struts ActionServlet. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 11:19 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Thanks for your help. Let me just check. You mean, in LoginAction intead of forwarding to my tiles definition, forward to another action? Or call another action? My struts-config.xml is this: Login action: action path=/login type=mypackage.LoginAction name=formLogin scope=request input=/login.jsp set-property property=secure value=true/ /action My forward: global-forwards forward name=initial path=tiles.initial/ /global-forwards My LoginAction after a sucessful login: return mapping.findForward(initial); Now I have this action to forward to the tiles definition: action path=/initial type=org.apache.struts.actions.ForwardAction parameter=tiles.inicial set-property property=secure value=false/ /action What should I put in LoginAction in order to go to a non secure main page? Can I call another action? -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:52 To: Struts Users Mailing List Subject: RE: SSLEXT Yes. Instead of forwarding directly to the Tile, define an action which simply forwards (or redirects) to that main page (tile) and in that action mapping configuration define it to be secure using the set-property element. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:39 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Ok, but the main page is still in HTTPS. Let me try to explain the flow: 1. User enter with username and password 2. User submit the form to an HTTPS address 3. A LoginAction try to authenticate the user with the data transmitted (username and password) with HTTPS protocol 4. LoginAction forward the user to the main page. -- Here I want the user being forward to an HTTP address. There is no action defined after LoginAtion. LoginAction must be secure so the username and password are trasmitted in a secure way. But after that, no more HTTPS is necessary. Is there way in step 4 to forward the user to a non secure page? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:29 To: Struts Users Mailing List Subject: RE: SSLEXT Okay. Then you should be able to place the following in your struts-config action mapping for the main page. set-property property=secure value=false/ robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:17 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT I can't. Because my main page is not a page at all. It's a Tiles definition. Where can I find the documentation about SSLEXT? I mean the description of the tags? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:09 To: Struts Users Mailing List Subject: RE: SSLEXT Use the sslext:pageScheme secure=false/ on the main page. This should switch it back to HTTP. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 9:58 AM To: 'Struts Users Mailing List' Subject: SSLEXT Hello. I'm now using the SSLEXT for struts (following some advices frm the list). Now I have my login action protected by HTTPS, but I want the user, after login, being forward to the main page of the application using HTTP protocol. Is this possible? Or I can only change the protocol in diferrente requests? Thanks, JP - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL
RE: SSLEXT
Hmmm. Okay, then try using your original action mapping def: action path=/initial type=org.apache.struts.actions.ForwardAction parameter=tiles.initial set-property property=secure value=false/ /action robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 11:51 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Thanks again. But now I have this error message: java.lang.IllegalArgumentException: Path tiles.initial does not start with a / character This is because the following action: action path=/initial forward=tiles.initial set-property property=secure value=false/ /action Any idea? Thanks! -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 16:35 To: Struts Users Mailing List Subject: RE: SSLEXT The following should work without changing any code in your LoginAction: action path=/login type=mypackage.LoginAction name=formLogin scope=request input=/login.jsp set-property property=secure value=true/ /action My forward: global-forwards forward name=initial path=/prefix/initial/ /global-forwards My LoginAction after a sucessful login: return mapping.findForward(initial); Now I have this action to forward to the tiles definition: action path=/initial forward=tiles.initial set-property property=secure value=false/ /action Note that prefix is what ever prefix you are using to invoke the Struts ActionServlet. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 11:19 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Thanks for your help. Let me just check. You mean, in LoginAction intead of forwarding to my tiles definition, forward to another action? Or call another action? My struts-config.xml is this: Login action: action path=/login type=mypackage.LoginAction name=formLogin scope=request input=/login.jsp set-property property=secure value=true/ /action My forward: global-forwards forward name=initial path=tiles.initial/ /global-forwards My LoginAction after a sucessful login: return mapping.findForward(initial); Now I have this action to forward to the tiles definition: action path=/initial type=org.apache.struts.actions.ForwardAction parameter=tiles.inicial set-property property=secure value=false/ /action What should I put in LoginAction in order to go to a non secure main page? Can I call another action? -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:52 To: Struts Users Mailing List Subject: RE: SSLEXT Yes. Instead of forwarding directly to the Tile, define an action which simply forwards (or redirects) to that main page (tile) and in that action mapping configuration define it to be secure using the set-property element. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:39 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Ok, but the main page is still in HTTPS. Let me try to explain the flow: 1. User enter with username and password 2. User submit the form to an HTTPS address 3. A LoginAction try to authenticate the user with the data transmitted (username and password) with HTTPS protocol 4. LoginAction forward the user to the main page. -- Here I want the user being forward to an HTTP address. There is no action defined after LoginAtion. LoginAction must be secure so the username and password are trasmitted in a secure way. But after that, no more HTTPS is necessary. Is there way in step 4 to forward the user to a non secure page? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:29 To: Struts Users Mailing List Subject: RE: SSLEXT Okay. Then you should be able to place the following in your struts-config action mapping for the main page. set-property property=secure value=false/ robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:17 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT I can't. Because my main page is not a page at all. It's a Tiles definition. Where can I find the documentation about SSLEXT? I mean the description of the tags? Thanks, JP -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:09 To: Struts Users Mailing
RE: SSLEXT
Did you correct the typo in your original action mapping? You had: parameter=tiles.inicial Instead of: parameter=tiles.initial Also, as David already pointed out, make sure you are using SecureTilesPlugin, and SecureTilesRequestProcessor. When you say it doesn't work, do you get any error messages? robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 12:10 PM To: 'Struts Users Mailing List' Subject: RE: SSLEXT I've already tried. But this doesn't work... I don't understand why... It seems that I'll have to create a page just to change the protocol. What do you think? -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 17:09 To: Struts Users Mailing List Subject: RE: SSLEXT Hmmm. Okay, then try using your original action mapping def: action path=/initial type=org.apache.struts.actions.ForwardAction parameter=tiles.initial set-property property=secure value=false/ /action robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 11:51 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Thanks again. But now I have this error message: java.lang.IllegalArgumentException: Path tiles.initial does not start with a / character This is because the following action: action path=/initial forward=tiles.initial set-property property=secure value=false/ /action Any idea? Thanks! -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 16:35 To: Struts Users Mailing List Subject: RE: SSLEXT The following should work without changing any code in your LoginAction: action path=/login type=mypackage.LoginAction name=formLogin scope=request input=/login.jsp set-property property=secure value=true/ /action My forward: global-forwards forward name=initial path=/prefix/initial/ /global-forwards My LoginAction after a sucessful login: return mapping.findForward(initial); Now I have this action to forward to the tiles definition: action path=/initial forward=tiles.initial set-property property=secure value=false/ /action Note that prefix is what ever prefix you are using to invoke the Struts ActionServlet. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 11:19 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Thanks for your help. Let me just check. You mean, in LoginAction intead of forwarding to my tiles definition, forward to another action? Or call another action? My struts-config.xml is this: Login action: action path=/login type=mypackage.LoginAction name=formLogin scope=request input=/login.jsp set-property property=secure value=true/ /action My forward: global-forwards forward name=initial path=tiles.initial/ /global-forwards My LoginAction after a sucessful login: return mapping.findForward(initial); Now I have this action to forward to the tiles definition: action path=/initial type=org.apache.struts.actions.ForwardAction parameter=tiles.inicial set-property property=secure value=false/ /action What should I put in LoginAction in order to go to a non secure main page? Can I call another action? -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: quarta-feira, 17 de março de 2004 15:52 To: Struts Users Mailing List Subject: RE: SSLEXT Yes. Instead of forwarding directly to the Tile, define an action which simply forwards (or redirects) to that main page (tile) and in that action mapping configuration define it to be secure using the set-property element. robert -Original Message- From: Joao Batistella [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 10:39 AM To: 'Struts Users Mailing List' Subject: RE: SSLEXT Ok, but the main page is still in HTTPS. Let me try to explain the flow: 1. User enter with username and password 2. User submit the form to an HTTPS address 3. A LoginAction try to authenticate the user with the data transmitted (username and password) with HTTPS protocol 4. LoginAction forward the user to the main page. -- Here I want the user being forward to an HTTP address. There is no action defined after LoginAtion. LoginAction must be secure so the username and password are trasmitted in a secure way. But after that, no more HTTPS is necessary. Is there way in step 4 to forward the user to a non secure page? Thanks, JP -Original
RE: Links within ActionErrors
Use c:out value=${error} escapeXml=false/ robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 1:43 PM To: [EMAIL PROTECTED] Subject: Links within ActionErrors I know this probably violates some basic guidlines but... I am trying to display an html link rendered by the message in the ActionErrors section of a JSP. My problem is that the '' and '' symbols are being replaced by ' l t;' and ' # 034;' (their equivelent) How can I prevent this translation from happening? Example: In the applicationresources file we have something like the following: error.save.dup.link=a href={0}click for details/a The action class creates the actual link address and adds an actionError as follows: tActionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.save.dup.link, iRequest.getRequestURL().substring(0,iRequest.getRequestURL().lastIndexOf(/ )) + /blah blah blah )); saveErrors(iRequest, tActionErrors); In the JSP we have tags to dislay the errors: logic:messagesPresent tabletrtd bspan id=errorsHeaderbean:message key=errors.validation.header//span/b html:messages id=error c:out value=${error}/ /html:messages /td/tr/table /logic:messagesPresent When the error is displayed because the '' and '' signs have been replaced it just show the text as follows: a href=http://localhost:8080/blah blah blah click to see /a - 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: action - delegate - facade
by xdoclet? I've been using an xml schema to generate my value objects so far (not with EJB) via JAXB, but this isn't going to work with EJB because the things aren't serializable. Another question (my last!): what is the best way to handle home interfaces in the delegate? Do you cache them? Do you treat them like a logger object or a singleton? Or do you just instantiate them fresh each call? Thanks! Adam On 03/17/2004 09:22 AM HG wrote: Hi Robert and Adam... Guess I am paranoid or prepared.. :-) I use nearly the approach Robert described, using a Factory for the delegatealthough the purpose is not the same.. I use the Delegate as the web tier view of the business logic/services in the system. That becomes important, when different business rules/logic applies to different modules/plugin. In my scenario I call the business delegates for business plugins because of the dynamic plugable nature. Plugins are hosted by a plugin manager (the factory), and access the plugin interfaces always goes through the plugin manager. You get an interface to a plugin (ie. web tier view of a business service), not an implementation...that's important as you state correctly Robert. The difference is that I don't care if it is a POJO, EJB, whatever I am talking to behing the scenes, I care about HOW the business service is implemented... Let me give you an example: Way through system is: Action-Plugin-Facade-Entity Pseudo code for action execute: AccountManagement plugin = pluginManager.getPlugin(core.account.management); What I get here is an interface (AccountManagement) of a business service plugin. Behind the interface, one specific implementation of it resides. WHAT implementation to use is decided by the plugin manager. I my scenario it is based on a customer, which have a certain business role. But it can be whatever logic to decide which implementation to use. Now I use the the plugin business service interface from my action plugin.createAccount(001, Hans Gruber); With this one call a specific implementation of the Management interface is called. What happens behind the scenes is not important from the actions point of view. Maybe different business rules/logic applies for different implementations of the AccountManagement. What actually happens is that the plugin service implementation calls a facade to fulfil the business action of creating an account. This approach is highly flexible...You have the possibility of hosting different customers (with different needs) under the same application constrcuted using business plugins building blocks. It also (like other business delegates as you stated Robert) promotes loosely coupling between the web tier and EJB or whatever tier is behind. With this clean interface it is very very easy to provide an additonal XML WebServices interface (maybe though Axis) that makes your business services accessible from other platforms, systems, whatever... My few bucks...Anyone has comments...they are welcome... Regards Henrik - Original Message - From: Robert Taylor [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 2:51 AM Subject: RE: action - delegate - facade Adam, IMHO the Business Delegate pattern abstracts the client from knowing your business implementation, whether it be EBJ, JDO, POJO, roll your own. The client interfaces with the Business Delegate and not its implementation. For example, if you have an Action (client) interface with the Business Delegate instead of directly with a SessionFacade, then you can change the underlying implementation of the Business Delegate without changing anything in the client. If your really paranoid (or prepared), you can use the Abstract Factory pattern which you could then initialize/subclass to create the appropriate Business Delegate implementations (EJB, JDO, main frame). Also by using a Business Delegate the client isn't exposed to implementation details such as (if your using EJB) looking up the appropropriate EJB or handling implementation specific exceptions. The Business Delegate becomes a high level abstraction of the business rules raising application level exceptions when error occur to which the client can respond appropriately. So, you wouldn't necessarily have to modify the Delegate-Facade interface. The interface itself remains unchanged. You have to use a different implementation. That is where the factory comes in. I imagine you could do something like the following: Properties props = // get initialization
RE: action - delegate - facade
Adam, its frowned upon to pass a web tier object (ActionForm) into the business tier. I believe a widely used technique is to use BeanUtils to copy the properties from the ActionForm to a DTO (a Domain Object) which can be passed to the business tier. robert -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 5:57 PM To: Struts Users Mailing List Subject: Re: action - delegate - facade Great book. Thanks for the link. I think I need more knowledge of xdoclet before I make my mind up though. This offers alot to mull over. Plus I'm also quite keen to use faster, quicker patterns. I use dynaactionforms in struts almost exclusively and regarding this Data Transfer Hashmap, it irritates me that the data must be transferred out of one hashmap into another. In fact it would be ideal to be able to transfer the data in the dynaactionform right down the line to the entity bean. The data elements of each form are primarily defined in the struts-config.xml, so I can't see a clean way of telling the entity bean (or any other object) how to get the data out. On 03/17/2004 11:33 PM [EMAIL PROTECTED] wrote: Actually this is a pattern mentioned in EJB Design Patterns - Advanced Patterns Processes and Idioms called Data Transfer HashMap. You can download the pdf from TheServerSide.com. It's a pretty good read. The book goes into detail on the pros and cons of this pattern. Well... it wasn't my intention to implement a software pattern :) (I am kidding :) form-beans does the same job - I think - but mixes form input data with form build data - again, feel free to criticize, afterall I am still new with Struts). We already discussed this... but here goes for the rest of the mailing list: - It surely saved me some time (I dont have to define on one XML file the beans I need and after that execute something to automatically generate the java beans - you have to be more carefull though, since you may only encounter some bugs on runtime... unless you use strutstestcase/junit) - made a great work decoupling the presentation from business logic (just like with form-beans) - I dont get confused about what is the user input data and what is the data to help build the user form - it also had another side effect: much less lines for xml configuration file... but more files per application (I can live with this :) ) - it seems easier to reuse view-beans/form-beans when they are decoupled... but i will need more time/experience to support this Thank you for the document. I will read it very carefully and see if there is another challenge waiting outside this framework. Pedro Salgado http://www.theserverside.com/books/wiley/EJBDesignPatterns/downloads/ejbdesignpatterns.pdf robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - 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: action - delegate - facade
Well, I would say it depends. If I had a DTO ( a domain object) which had all the fields I needed to display...including types like int, Date, boolean, etc... I would probably just pass that along to the form bean and let view helpers like the Struts tags or JSTL render the contents. With JSTL you can format Dates and numbers. I believe those tags leverage the java.text.* package for formatting data. If I needed to perform some specialized formatting which could not be done by view helpers then I may just convert the necessary fields to Strings (maybe using BeanUtils) format them, and populate my ActionForm. If the view I needed of the data was not encapsulated in a single DTO, then you could retrieve multiple DTO objects and rendered them as described above or use a pattern described as Transfer Object Assembler which builds a custom DTO or a collection of customer DTO objects which you could pass along to the ActionForm. You can read more about Transfer Object Assembler here: http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObjectAssembler.html robert -Original Message- From: Nick Wesselman [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 17, 2004 6:28 PM To: Struts Users Mailing List Subject: Re: action - delegate - facade What about when simply displaying data on a page? Do developers typically copy data out of the domain object just to display it? (As opposed to using it w/ a form.) The only issue I see is that you may end up introducing view helper methods to your model beans. Nick Robert Taylor wrote: Adam, its frowned upon to pass a web tier object (ActionForm) into the business tier. I believe a widely used technique is to use BeanUtils to copy the properties from the ActionForm to a DTO (a Domain Object) which can be passed to the business tier. robert - 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: [OT] Search string tokenizer
Cool! I'll take a look. Thanks David. robert -Original Message- From: Hibbs, David [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 16, 2004 9:20 AM To: 'Robert Taylor'; [EMAIL PROTECTED] Subject: RE: [OT] Search string tokenizer I wrote some code to do this for an open-source project on sf.net an eon or two ago, before the regex packages matured. You can probably enhance what I wrote with regex, but it's at least a starting point... http://cvs.sourceforge.net/viewcvs.py/omd/java/coruscant/omd/util/StringSear cher.java?rev=1.2view=markup Anyway, what the code does is split the input into lists (ok, so I used vectors, I was still learning Java!) of 3 types: required present (i.e. +) , required absent (i.e. -), and optional terms. In short, the yahoo search style. Usage: 1) call setCriteriaString (passing your user search input) 2) call compareString (passing the content to search/validate) In your case, since you're going to pass the search criteria to SQL, you can probably just use the tokeinzing logic and add some getters for the criteria lists... David Hibbs, ACS Staff Programmer / Analyst American National Insurance Company -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Monday, March 15, 2004 3:20 PM To: [EMAIL PROTECTED] Subject: [OT] Search string tokenizer I did a google search on this and didn't really come up with anything useful. Before I implement this myself, is there an existing implementation of parsing a search string which would produce tokens similar to how Google or other search engines parse search strings. For example, I would like to parse a search string into tokens where tokens are delimited by either a blank space or a quoted phrase. So the string: 'Struts web presentation tier' would return 2 tokens: - Struts - web presentation tier but the string: 'Struts web presentation tier' would return 4 tokens: - Struts - web - presentation - tier Any help is appreciated. robert - 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: logic:equal
Daniel, it would be easier to use JSTL for this: c:if test=${myValue == 1} The string contained the word Struts. /c:if JSTL can compare values coming from any scope; application, session, pagecontext, request, or request parameters. Currently, the bean:define .../ value attribute doesn not accept runtime values. You can verify this by looking at the struts-bean.tld Another alternative would be to use the Struts-EL tag libraries. robert -Original Message- From: Daniel [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 16, 2004 2:30 PM To: Struts Users Mailing List Subject: logic:equal Why it doesn't work, but if I change the value of bean:define value attribute for value=1, it's work? I need compare dinamic values. bean:define id=string value=%=1% / logic:equal name=string value=1 The string contained the word Struts /logic:equal cheers Danie S. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: action - delegate - facade
Adam, IMHO the Business Delegate pattern abstracts the client from knowing your business implementation, whether it be EBJ, JDO, POJO, roll your own. The client interfaces with the Business Delegate and not its implementation. For example, if you have an Action (client) interface with the Business Delegate instead of directly with a SessionFacade, then you can change the underlying implementation of the Business Delegate without changing anything in the client. If your really paranoid (or prepared), you can use the Abstract Factory pattern which you could then initialize/subclass to create the appropriate Business Delegate implementations (EJB, JDO, main frame). Also by using a Business Delegate the client isn't exposed to implementation details such as (if your using EJB) looking up the appropropriate EJB or handling implementation specific exceptions. The Business Delegate becomes a high level abstraction of the business rules raising application level exceptions when error occur to which the client can respond appropriately. So, you wouldn't necessarily have to modify the Delegate-Facade interface. The interface itself remains unchanged. You have to use a different implementation. That is where the factory comes in. I imagine you could do something like the following: Properties props = // get initialization properties // to initialize factory to return EJB BD implementations BusinessDelegateFactory bdf = BusinessDelegateFactory.init(props); In your client, suppose AccountBD is your BusinessDelegate interface: BusinessDelegateFactory bdf = BusinessDelegateFactory.getInstance(); AccountBD accountBD = (AccountBD)bdf.createBusinessDelegate(AccountBD.BD_NAME); So you just end up plugging in new implementations as needed. Anyhow, that's my interpretation of the some of the forces behind the pattern and an idea on implementing it. Here's more information: http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html http://www.developer.com/java/other/article.php/626001 robert -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 16, 2004 6:26 PM To: Struts Users Mailing List Subject: action - delegate - facade I've just been perusing the archive to check out what people have been saying about struts to EJB interfacing. One thing that occurs to me is that the only reason mentioned for having a business delegate layer between the Actions and the Session Facade is to allow for loose coupling of the struts-dependent code with the EJB dependent code. How necessary is that? If you choose to drop EJB and go with, say Hibernate, you would have to modify the interface, whether it is the Action - Facade interface or the Delegate - Facade interface. Or have I missed an important other reason for the existence of the Delegate layer? Adam -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - 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: [SwitchAction] How do you switch in between application contexts?
Mike, I don't believe the Servlet spec. allows you to forward to another web application. You will have to redirect. robert -Original Message- From: Mike Zatko [mailto:[EMAIL PROTECTED] Sent: Monday, March 15, 2004 9:14 AM To: Struts Users Mailing List Subject: Re: [SwitchAction] How do you switch in between application contexts? Ok, I don't think SwitchAction is going to do what I thought it was meant for. I need to know how to forward control to another web application. Right now, in my action, I'm doing a response.sendRedirect and returning null to the action forward. I figure there has to be a more graceful way built into struts but it eludes me. Thanks for any input. Mike Zatko James Mitchell wrote: http://sourceforge.net/project/showfiles.php?group_id=49385package_id=74324 release_id=147944 -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx MSN: [EMAIL PROTECTED] Yahoo IM:[EMAIL PROTECTED] Mike Zatko [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, Does anyone have a simple example on how to use a SwitchAction? How is it defined properly in the config file? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael H. Zatko WebSphere Developer Boscov's Information Services Work: 610-929-7317 Home: 610-562-2407 - 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: [SwitchAction] How do you switch in between application contexts?
In your struts-config.xml file you can define forwards to redirect instead of forwarding. robert -Original Message- From: Mike Zatko [mailto:[EMAIL PROTECTED] Sent: Monday, March 15, 2004 11:11 AM To: Struts Users Mailing List Subject: Re: [SwitchAction] How do you switch in between application contexts? I know, I'm sorry I meant redirect. I'm just wondering if struts allows an elegent way to create redirects to other applications without hardcoding it? Robert Taylor wrote: Mike, I don't believe the Servlet spec. allows you to forward to another web application. You will have to redirect. robert -Original Message- From: Mike Zatko [mailto:[EMAIL PROTECTED] Sent: Monday, March 15, 2004 9:14 AM To: Struts Users Mailing List Subject: Re: [SwitchAction] How do you switch in between application contexts? Ok, I don't think SwitchAction is going to do what I thought it was meant for. I need to know how to forward control to another web application. Right now, in my action, I'm doing a response.sendRedirect and returning null to the action forward. I figure there has to be a more graceful way built into struts but it eludes me. Thanks for any input. Mike Zatko James Mitchell wrote: http://sourceforge.net/project/showfiles.php?group_id=49385package_id=74324 release_id=147944 -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx MSN: [EMAIL PROTECTED] Yahoo IM:[EMAIL PROTECTED] Mike Zatko [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, Does anyone have a simple example on how to use a SwitchAction? How is it defined properly in the config file? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Michael H. Zatko WebSphere Developer Boscov's Information Services Work: 610-929-7317 Home: 610-562-2407 - 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] -- Michael H. Zatko WebSphere Developer Boscov's Information Services Work: 610-929-7317 Home: 610-562-2407 - 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: Accessing boolean attribute using logic
Try this: logic:equal scope=session name=userid property=admin value=false robert -Original Message- From: Theodosios Paschalidis [mailto:[EMAIL PROTECTED] Sent: Monday, March 15, 2004 2:04 PM To: [EMAIL PROTECTED] Subject: Accessing boolean attribute using logic Hi all, I have unsuccessfuly spent all this time trying to figure this and it must be very simple... In my JSP I have code like this: logic:equal scope=session name=userid property=Admin value=false for a bean boolean property defined like this: private boolean admin = false; public boolean isAdmin(){ return admin; } public void setAdmin(boolean b) { admin = b;} I get this error trying to access my JSP org.apache.jasper.JasperException: Exception accessing property Admin for bean userid: java.lang.NoSuchMethodException: Unknown property 'Admin' I am sure I read somewhere that boolean properties can be also used. why the java.lang.NoSuchMethodException? Is it only meant to work with Strings? The property must be picked up correctly since I successfully use it my actions. Any ideas on how to achieve that check using Strut tags? (have looked everywhere for an example!) Thank you for your time, Theo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Search string tokenizer
I did a google search on this and didn't really come up with anything useful. Before I implement this myself, is there an existing implementation of parsing a search string which would produce tokens similar to how Google or other search engines parse search strings. For example, I would like to parse a search string into tokens where tokens are delimited by either a blank space or a quoted phrase. So the string: 'Struts web presentation tier' would return 2 tokens: - Struts - web presentation tier but the string: 'Struts web presentation tier' would return 4 tokens: - Struts - web - presentation - tier Any help is appreciated. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Search string tokenizer
Jason and Larry, I think I'm going to investigate using regexp. Michael, I looked into Lucene and I really don't need something that heavy. I just need to perform some simple searches against the database. Thanks to everyone who responded on and off list. robert -Original Message- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Monday, March 15, 2004 5:30 PM To: Struts Users Mailing List Subject: Re: [OT] Search string tokenizer Regular Expressions should work: There are a few implementations too like http://jakarta.apache.org/oro/index.html With a pattern like this: (.+|[\d\w]*) You should get close to what you need (i think the above will return the space character as a token too, not sure). And here is a program that lets you test out patterns to see how they match strings or will be split http://www.weitz.de/regex-coach/ Robert Taylor wrote: I did a google search on this and didn't really come up with anything useful. Before I implement this myself, is there an existing implementation of parsing a search string which would produce tokens similar to how Google or other search engines parse search strings. For example, I would like to parse a search string into tokens where tokens are delimited by either a blank space or a quoted phrase. So the string: 'Struts web presentation tier' would return 2 tokens: - Struts - web presentation tier but the string: 'Struts web presentation tier' would return 4 tokens: - Struts - web - presentation - tier Any help is appreciated. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - 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: security framework!!!
http://sourceforge.net/projects/securityfilter/ emulates container managed security. robert -Original Message- From: Mailing List [mailto:[EMAIL PROTECTED] Sent: Saturday, March 13, 2004 6:19 AM To: [EMAIL PROTECTED] Subject: security framework!!! I'm developing a web application with struts.I had a problem for support security at jsp pages level for different roles.I send an email and recived 2 response to solve my problem: 1.with HTML tags. 2.2.with define role in tiles definition but I'm searching for a good framework that be compatibled with struts framework and support the security for different roles at page levels. I mean for example if I have a jsp page with tow textfields and a submit deponds on user's role at the system,one user just can see one of the textfield and submit buttom and another user can see both of the textfield and submit buttom. Can you suggest a good framework for me. regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: sslext http/https switching taglib and tiles
Adam, I've been using SecurityFilter (sslext taglib form and link tags) with Tiles for a while without any issues. robert -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Saturday, March 13, 2004 11:25 AM To: Struts Users Mailing List Subject: sslext http/https switching taglib and tiles Is anybody using Tiles and the sslext taglib form link tags? I am thinking of using them with Tiles. Has this been implemented yet? I was wondering because I think it must be a fairly complicated algorithm to check whether a link URL or a form submit action needs HTTPS or not. I was also wondering whether sslext is going to be absorbed by the struts project? Adam -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - 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: [OT] 2 JSF questions
I don't know. You may want to try the JSTL users mailing list: [EMAIL PROTECTED] robert -Original Message- From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 1:30 PM To: [EMAIL PROTECTED] Subject: [OT] 2 JSF questions 1) Since JSF is written in Java, why does Sun have 3 different download available, Windows, Solaris, Linux? 2) Would any of those work for Mac OS X? Thanks, jim - 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: [OT] Object Design Question
+1. Join the tables in a query and write an algorithm to parse the results into the view you need. One connection, one query, let the database do the work. Not very OO, but very efficient. robert -Original Message- From: Hookom, Jacob [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 3:37 PM To: Struts Users Mailing List Subject: RE: [OT] Object Design Question It's always on a case by case basis. When and how much do you need at a given time? Hibernate/JDO/OJB/etc can handle these things for you via a config to specify lazy relationships. When you are talking about web application with read data (data purely pushed to the view like a list of persons with addresses), then the best way IMHO is to write a special view object and query for this case. List View Objects Select By Id Grab Business Object By Id -Original Message- From: Avinash Gangadharan [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 2:26 PM To: '[EMAIL PROTECTED]' Subject: [OT] Object Design Question People, I have a design question. It is regarding the retrieval of parent and child objects in the best possible manner. For eg. Let's say there is a Person object with properties such as ssn, lastName and firstname. It also has a list child objects ( Address ) of addresses and a list of previous employees ( Employee ). The Person, Address and Employee objects are separate tables in the DB linked thru ssn. Now what do you guys think is the most efficient way of retrieving a complete Person. The simplest way is ofcourse issue 3 queries one for person, other for the list of address and the third for previous employees. But this does not scale well with increasing size of the table data. For 100 rows of Person 201 queries are issued. 1 which gets 100 persons, 100 each for there subequent address and previous employees. Similarly for a 1000, 2001 queries. Complex queries may be a solution which relies on filtering the resultset but is there a more simple and intelligent approach. Is there a problem with the inherent design itself or is this a common problem. Thanks and Regards Avinash - 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: [OT] Object Design Question
OO is not alwasy the best way; and there are trade offs for every implementation. As Jacob mentioned... It's always on a case by case basis. robert -Original Message- From: Avinash Gangadharan [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 4:46 PM To: 'Struts Users Mailing List' Subject: RE: [OT] Object Design Question That's the way I have it now, a view object querying the datastore and forming the business objects. The view issues a query for the parent and then calls the views of the children to give their list of objects for that parent and then constituting the parent completely. I agree getting them back together and then parsing them out would be better but sure not a clean OO way of getting data. -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 1:01 PM To: Struts Users Mailing List Subject: RE: [OT] Object Design Question +1. Join the tables in a query and write an algorithm to parse the +results into the view you need. One connection, one query, let the database do the work. Not very OO, but very efficient. robert -Original Message- From: Hookom, Jacob [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 3:37 PM To: Struts Users Mailing List Subject: RE: [OT] Object Design Question It's always on a case by case basis. When and how much do you need at a given time? Hibernate/JDO/OJB/etc can handle these things for you via a config to specify lazy relationships. When you are talking about web application with read data (data purely pushed to the view like a list of persons with addresses), then the best way IMHO is to write a special view object and query for this case. List View Objects Select By Id Grab Business Object By Id -Original Message- From: Avinash Gangadharan [mailto:[EMAIL PROTECTED] Sent: Friday, March 12, 2004 2:26 PM To: '[EMAIL PROTECTED]' Subject: [OT] Object Design Question People, I have a design question. It is regarding the retrieval of parent and child objects in the best possible manner. For eg. Let's say there is a Person object with properties such as ssn, lastName and firstname. It also has a list child objects ( Address ) of addresses and a list of previous employees ( Employee ). The Person, Address and Employee objects are separate tables in the DB linked thru ssn. Now what do you guys think is the most efficient way of retrieving a complete Person. The simplest way is ofcourse issue 3 queries one for person, other for the list of address and the third for previous employees. But this does not scale well with increasing size of the table data. For 100 rows of Person 201 queries are issued. 1 which gets 100 persons, 100 each for there subequent address and previous employees. Similarly for a 1000, 2001 queries. Complex queries may be a solution which relies on filtering the resultset but is there a more simple and intelligent approach. Is there a problem with the inherent design itself or is this a common problem. Thanks and Regards Avinash - 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: can anyone help me address this issue
You can't send data structures over HTTP you can only send strings. You could set those values as hidden form elements with a naming convention that would enable your server side code to recognize the elements in the request and create the appropriate server side data structure. This is essentially what Chris has suggested. robert -Original Message- From: Mu Mike [mailto:[EMAIL PROTECTED] Sent: Thursday, March 11, 2004 8:25 PM To: [EMAIL PROTECTED] Subject: RE: can anyone help me address this issue Sorry,maybe I didnt make my question clear my question is: the java script variable is supposed to be an array of such a strutcture(although java doesnt have a struture, I just use it here to describe my idea,maybe I should use a class instead) ,I d like to know how I can submit such a value? Structure[] javascriptvalue; Structure{ int colIndex int newWidth } ThanksRegards From: McCormack, Chris [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: can anyone help me address this issue Date: Thu, 11 Mar 2004 12:24:43 - use onResize on the html element that is clicked to report its new value to a form variable. use an onChange for the form to auto submit itself. If you need to hide the submission of the form use an IFrame. messy eugh, javascript is the pits. Chris -Original Message- From: Mu Mike [mailto:[EMAIL PROTECTED] Sent: 11 March 2004 12:16 To: [EMAIL PROTECTED] Subject: RE: can anyone help me address this issue I really need to get some idea about this issue, any suggestions? ThanksRegards From: Mu Mike [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: can anyone help me address this issue Date: Thu, 11 Mar 2004 05:12:16 + I m using javascript doing dhtml, now I have a table, every time a user changes the width of a specific column(by draging the border line), I will save the column index and the new width to variables in javascript.Now ,after doing many such changes, I need to submit those values saved in the vairables to the server side program by submiting a form, which has an action path designing what action should be called after it get the submitted value. Now, I m wondering how I should define such javasript variables and how I can submit these values by submiting a form? I m using struts, is there any possibility to implement this idea in struts? ThanksRegards _ MSN Hotmail http://www.hotmail.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN Messenger: http://messenger.msn.com/cn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *** This e-mail and its attachments are confidential and are intended for the above named recipient only. If this has come to you in error, please notify the sender immediately and delete this e-mail from your system. You must take no action based on this, nor must you copy or disclose it or any part of its contents to any person or organisation. Statements and opinions contained in this email may not necessarily represent those of Littlewoods. Please note that e-mail communications may be monitored. The registered office of Littlewoods Limited and its subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB. Registered number of Littlewoods Limited is 262152. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN Hotmail http://www.hotmail.com - 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: [OT] Database locking and deadlock
Is it possible that dbConnection.doUpdate() gets a new connection each time which could possibly use up (exceed max allowed) the connections in the pool. Just a guess. robert -Original Message- From: Shyam A [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 4:32 PM To: [EMAIL PROTECTED] Subject: [OT] Database locking and deadlock Hi, I know the subject of my mail is off-topic but I hope somebody will be able to help me out with my problem. I experienced a wierd problem today when a deadlock occured in my database - Oracle 9i, and it locked up all connections in the connection pool on my server - OC4J (Oracle 9iAS). I have a connection pool, which is configured on my server- OC4J. It is intialized on server startup, using a Servlet. I would like to verify if the code I use in my DAO may cause any deadlock condition. In my DAO, I use Update queries as part of a transaction. i.e, I turn off auto-commit, do my Update queries, and commit or rollback depending on the outcome of the queries. In one of the queries, I may need to update multiple rows of a table, and hence do the update operation in a loop (over a collection). Given below is the relevant portion of the code: snip //method that updates votes for candidates in an election public int updateVotes(BallotList ballotList) { int result=0; //result of insert operation String query=; Ballot ballot=null; CandidateList candList=null; Candidate candidate=null; int currVote=0; int electionNo = ballotList.getElectionNo(); try { for(int i=0;iballotList.getSize();i++) { ballot = ballotList.getBallot(i); candList = ballot.getCandidateList(); for(int j=0;jcandList.getSize();j++) { candidate = candList.getCandidate(j); //update votes for candidate if(candidate.getVote() 0) { //get current vote count and update currVote = getCurrentVote(electionNo,candidate.getPostNo(),candidate.getPidm()); currVote++; query = Update DZRCAND set DZRCAND_NUM_VOTE = +currVote+ + where DZRCAND_ELCTN_NO = +electionNo+ + and DZRCAND_POST_NO = +candidate.getPostNo()+ + and DZRCAND_CAND_PIDM = +candidate.getPidm()+; result += dbConnection.doUpdate(query); } } //end of inner for loop } //end of outer for loop } catch(Exception e) { System.out.println(Exception in DZRCAND update for votes: + e.getMessage()); System.out.println(query: + query); } return result; } /snip Is there a possibilty of a deadlock occuring in the above code when there are mutliple users concurrently accessing the system.i.e, multiple users update multiple rows of the table at the same time Could somebody throw some light on this? My understanding is that deadlocks are automatically handled by the DBMS. Anyway, is there a way to prevent the possiblity of deadlocks in my program ? One more thing - in the code above and in other Select queries, I open and close the Connection from the connection pool. However, I do not close the Statement or ResultSet objects. Will this lead to problems ? My understanding is that closing the Connection object will free up all the associated resources. Any help/pointers/suggestions will be greatly appreciated. Thanks, Shyam __ Do you Yahoo!? Yahoo! Search - Find what youre looking for faster http://search.yahoo.com - 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: Sorting table columns in jsp using struts
The JSTL spec is a great reference. I would recommend you download it. robert -Original Message- From: as as [mailto:[EMAIL PROTECTED] Sent: Friday, March 05, 2004 8:48 AM To: Struts Users Mailing List Subject: RE: Sorting table columns in jsp using struts Henri, Thanks for the explanatory smaples.The syntax below seems JSTL c:forEach var=category items=${requestScope.categories} tr tda Any quick intro I read on JSTL... Thanks Henri Yandell [EMAIL PROTECTED] wrote: Just to show how easy it can be with beanutils: display_categories.do points to a struts action that preloads like: * List list = new ArrayList(); list.addAll( DummyDao.getAllCategories() ); String sortBy = request.getParameter(sortBy); if(sortBy != null) { BeanComparator comparator = new BeanComparator(sortBy); Collections.sort( list, comparator ); } request.setAttribute( categories, list ); return mapping.findForward(success); * and the jsp page that success points to contains: name description where Category has 'name' and 'description' as properties. This handles things with natural sorting. Doing the reverse sort used to be pretty easy, but is harder now that we separate the view and model [as the model wants to record view-state, or maybe the view wants to record model-view state...ugh]. The trick is by having: if(reverse) { comparator = new ReverseComparator(comparator); } after the BeanComparator line. The only complication is where you decide to store reverse. You can use the session, or as you'll probably want little arrows showing the sort direction, you can write it into the column-header with '?sortBy=namereverse=true'. This can be tricky and probably involves the Action storing things in the request scope for the jsp to discover later. Anyway, I assume the display-tag library contains this pretty much, but Comparators are lovely so it can't hurt to babble on about them :) Hen On Thu, 4 Mar 2004, as as wrote: Thanks in advance. Sam (I am currently truying out display tag though, as per Ashish) Henri Yandell wrote: I imagine display tags does it for you mostly if you go that way, else I'll knock up an example tonight. Finally getting back into taglibs and jsp :) Hen On Thu, 4 Mar 2004, as as wrote: thanks much. sample code by any cance? Thank you! ~~Sam Henri Yandell wrote: BeanUtils' BeanComparator is a useful way to do the sorting by the way, and will be in your classpath if you're using Struts [depending on version]. Also ReverseComparator in Commons Collections. Between them you can write a nice abstract table sorting system. Hen On Thu, 4 Mar 2004, as as wrote: Wendy, Thanks for the quick reply. books is a session attribute (request.setParameter(books,books) I retrieve books from database - Book.java so books is a List object. Will try your approach and post back the results Thanks, Sam~~ Wendy Smoak wrote: Sam wrote: Any clues on best easy ways to do table column sorting my rows in the table are generated as follows using as below. I do it on the server side, holding the items to be sorted in a Map and creating a new Map passing a Comparator to the constructor to get the new order. Then when you're back on the JSP iterating over it, the items are in the correct order. Map accountMap = (Map) session.getAttribute( accountMap ); Map newMap = new TreeMap( new CostCenterComparator() ); newMap.putAll( accountMap ); session.setAttribute( accountMap, newMap ); [Comments welcome, I'm not sure this is the best way to do it, but it works...] What type of Collection is 'books' in your example? -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Search - Find what youre looking for faster. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Search - Find what youre looking for faster. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Search - Find what youre looking for faster. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:
RE: Validation help for same Form, multiple pages/tabs
Are you using DispatchAction or LookupDispatchAction? robert -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, March 05, 2004 1:24 PM To: Struts Users Mailing List Subject: Validation help for same Form, multiple pages/tabs I'm using the same [dynamic] ActionForm on all my pages. Which was just *fine* until I wanted to use validation. :( I need separate validation per tab which is essentially a forward tag in struts-config. I have a Struts-Menu tab that has fields for fund, function and cost center, which are elements of an account, and I string the bits together later. Another tab has radio buttons where they pick an account. On the first, I need all three fields to be required. But if I do that in validation.xml, then the second page complains that the three fields are required. I understand what's happening, I just don't know the best way to fix it. I'm using 1.2.0, if there's something new that might be of use. I found this, advocating DynaValidatorActionForm http://www.mail-archive.com/[EMAIL PROTECTED]/msg93220.html But it seems to be controlled by the path, which is going to be the same in both cases. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - 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: Validation help for same Form, multiple pages/tabs
Okay. Here is what I do which may or may not help. I have subclassed DispatchAction to handle image buttons. The newer Struts version may handle this, but it didn't prior to 1.1. Image buttons may not be your problem but it has a special method to extract the dispatched operation. Anyhow you can see the implementation here. http://issues.apache.org/bugzilla/show_bug.cgi?id=19925 I also subclass DynaValidatorActionForm which uses the static method defined in ImageButtonDispatchAction to extract the operation parameter. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return ActionErrors containing validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { // set the page variable before validating Map props = this.getMap(); if (props.containsKey(page)) { this.page = ((Integer) props.get(page)).intValue(); } ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); String validationKey = this.getValidationKey(mapping, request); logger.fine(validationKey: + validationKey); Validator validator = Resources.initValidator( validationKey, this, application, request, errors, page); logger.fine(validator: + validator.getClass().getName()); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } /** * Get the validation key used to determine which validation * rules will be executed. * * @return the validation key */ protected String getValidationKey(ActionMapping mapping, HttpServletRequest request) { String path = mapping.getPath(); String parameter = mapping.getParameter(); if (parameter == null) { return path; } String operation = ImageButtonDispatchAction.getOperation(parameter, request); return MessageFormat.format( VALIDATION_KEY_TEMPLATE, new Object[]{path, operation}); } This allows me to have validation keys of the form: path-operation. So in my validation.xml I have form elements that look somewhat like: form name=/applications/account/doSaveChanges-create /form form name=/applications/account/doSaveChanges-update /form As you can see, the same action mapping path is used but the operation is appended to them allowing for more granular validations. This may not be the best way to handle things, but I've been using this approach for a couple years and it works quite well. robert -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, March 05, 2004 2:00 PM To: Struts Users Mailing List Subject: RE: Validation help for same Form, multiple pages/tabs Robert wrote: Are you using DispatchAction or LookupDispatchAction? LookupDispatchAction. And even worse, it's a cookie that controls which tab to show, not always a request parameter. I think I may have painted myself into a corner... -Wendy Smoak - 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: DispatchAction and validate
Yes. The DispatchAction will only invoke the method defined in the request under the name defined in the parameter attribute of your action mapping. So if I had update() and restore() as methods in a DispatchAction, and I only wanted to validate on the update, then I would only define validate=true in the action mappping for the DispatchAction which is designated to invoke update(). This is assuming you have two separate action mappings which map to the same DispatchAction. robert -Original Message- From: Frers Michael [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 3:23 AM To: Struts Users Mailing List Subject: DispatchAction and validate Hello i want to use DispatchAction now my questions is can i use in one action the struts-config entry validate=true and in the other action validate=false Thx for any hints Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ServletContextListener init parameters
The problem is your servlet init parameters don't exist in the ServletContext. If you want them to be available to your code, then define them as init parameters to your application: ?xml version=1.0 encoding=UTF-8? web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-nameapp name/display-name context-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value description![CDATA[Struts configuration file]]/description /context-param context-param param-namejcaConnector/param-name param-valuejava:/eis/bongers/autos/content/param-value /context-param context-param param-nametempFile/param-name param-valuec:/mtbtemp/param-value /context-param context-param param-nameproperties_db_name/param-name param-valuebmpauto/bau_content.nsf/param-value /context-param etc... Then your code will yield the expected results. robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 4:45 AM To: [EMAIL PROTECTED] Subject: ServletContextListener init parameters Hi all, I have my ActionServlet serving as a ServletContextListener: public class ActionServlet extends org.apache.struts.action.ActionServlet implements ServletContextListener In the following method (which gets called upon startup) I need the ActionServlet init Parameters: public void contextInitialized(ServletContextEvent event) I want to do something like: public void contextInitialized(ServletContextEvent event) { ServletContext ctx = event.getServletContext(); Enumeration e = ctx.getInitParameterNames(); while (e.hasMoreElements()) { log.debug(Parameter: + e.nextElement()); } } Unfortunatly when I use the code above, my enumeration is empty. My web.xml looks like this: servlet init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value description![CDATA[Struts configuration file]]/description /init-param init-param param-namejcaConnector/param-name param-valuejava:/eis/bongers/autos/content/param-value /init-param init-param param-nametempFile/param-name param-valuec:/mtbtemp/param-value /init-param init-param param-nameproperties_db_name/param-name param-valuebmpauto/bau_content.nsf/param-value /init-param ... etc ... etc ... etc ... How can I obtain those init parameters when contextInitialized(ServletContextEvent event) is called? Your help is highly appreciated. Regards, Harm de Laat Informatiefabriek The Netherlands. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ServletContextListener init parameters
You should be able to use either scriptlets or JSTL because they are in the ServletContext: % Enumeration enum = application.getInitParameterNames(); % c:forEach var=paramName items=${application.initParameterNames} /c:forEach robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 11:17 AM To: Struts Users Mailing List Cc: [EMAIL PROTECTED] Subject: RE: ServletContextListener init parameters Thanks Robert for this quick anwser. This solved my problem. However. Is there a possibility to access context-params from a JSP page? Thanks, Regards, Harm de Laat Informatiefabriek The Netherlands Robert Taylor [EMAIL PROTECTED] 02-03-2004 13:43 Please respond to Struts Users Mailing List [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] cc Subject RE: ServletContextListener init parameters The problem is your servlet init parameters don't exist in the ServletContext. If you want them to be available to your code, then define them as init parameters to your application: ?xml version=1.0 encoding=UTF-8? web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi= http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; display-nameapp name/display-name context-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value description![CDATA[Struts configuration file]]/description /context-param context-param param-namejcaConnector/param-name param-valuejava:/eis/bongers/autos/content/param-value /context-param context-param param-nametempFile/param-name param-valuec:/mtbtemp/param-value /context-param context-param param-nameproperties_db_name/param-name param-valuebmpauto/bau_content.nsf/param-value /context-param etc... Then your code will yield the expected results. robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 4:45 AM To: [EMAIL PROTECTED] Subject: ServletContextListener init parameters Hi all, I have my ActionServlet serving as a ServletContextListener: public class ActionServlet extends org.apache.struts.action.ActionServlet implements ServletContextListener In the following method (which gets called upon startup) I need the ActionServlet init Parameters: public void contextInitialized(ServletContextEvent event) I want to do something like: public void contextInitialized(ServletContextEvent event) { ServletContext ctx = event.getServletContext(); Enumeration e = ctx.getInitParameterNames(); while (e.hasMoreElements()) { log.debug(Parameter: + e.nextElement()); } } Unfortunatly when I use the code above, my enumeration is empty. My web.xml looks like this: servlet init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value description![CDATA[Struts configuration file]]/description /init-param init-param param-namejcaConnector/param-name param-valuejava:/eis/bongers/autos/content/param-value /init-param init-param param-nametempFile/param-name param-valuec:/mtbtemp/param-value /init-param init-param param-nameproperties_db_name/param-name param-valuebmpauto/bau_content.nsf/param-value /init-param ... etc ... etc ... etc ... How can I obtain those init parameters when contextInitialized(ServletContextEvent event) is called? Your help is highly appreciated. Regards, Harm de Laat Informatiefabriek The Netherlands. - 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: DispatchAction and validate
I've never used XDoclet (although I mean to learn about it) so I can't help you there. Maybe someone else on the list can. robert -Original Message- From: as as [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 12:39 PM To: Struts Users Mailing List Subject: RE: DispatchAction and validate do I need an updated .xdt file for this? y xdoclet generated Struts-config.xml is not having the action mappings for the actiin class of mine, extending Dispatch Action. It shows it fine for classes extending Action class though. Thanks n advance for the help, Sam Robert Taylor [EMAIL PROTECTED] wrote: Yes. The DispatchAction will only invoke the method defined in the request under the name defined in the parameter attribute of your action mapping. So if I had update() and restore() as methods in a DispatchAction, and I only wanted to validate on the update, then I would only define validate=true in the action mappping for the DispatchAction which is designated to invoke update(). This is assuming you have two separate action mappings which map to the same DispatchAction. robert -Original Message- From: Frers Michael [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 02, 2004 3:23 AM To: Struts Users Mailing List Subject: DispatchAction and validate Hello i want to use DispatchAction now my questions is can i use in one action the struts-config entry validate=true and in the other action validate=false Thx for any hints Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? Yahoo! Search - Find what youre looking for faster. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: row counts in logic:iterate...
First: Please do not send HTML emails to the list. Now to address your question: JSTL makes this easy. c:forEach var=item items=${form.items} varStatus=status tr tdc:out value=${status.count}//td tdc:out value=${item.someValue}//td /tr /c:forEach Using Struts tags: logic:iterate id=item name=form property=items indexId=index tr td%=indexId.intValue() + 1%/td tdbean:write name=item property=someValue//td /tr /logic:iterate robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:05 PM To: [EMAIL PROTECTED] Subject: row counts in logic:iterate... colorparam0100,0100,0100/paramnewbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. colorparam7F00,,7F00/paramFontFamilyparamCourier New/paramlogic:iteratecolorparam,,/param colorparam,7F00,/paramnamecolorparam,,/param=colorparam,,FF00/paramdateForm colorparam,,/param colorparam,7F00,/parampropertycolorparam,,/param=colorparam,,FF00/paramraw colorparam,,/param colorparam,7F00,/paramidcolorparam,,/param=colorparam,,FF00/paramfoocolor param,,/param colorparam,7F00,/paramindexIdcolorparam,,/param=colorparam,,FF00/paramctr colorparam,,/param colorparam7F00,,7F00/paramcolorparam,,/param colorparam0100,0100,0100/paramFontFamilyparamArial/param I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? tdboldcolorparam7F00,,/paramFontFamilyparamCourier New/param%=/boldcolorparam0100,0100,0100/param colorparam,,/paramctrcolorparam0100,0100,0100/param colorparam,,/param+colorparam0100,0100,0100/param colorparam,,/param1colorparam0100,0100,0100/param boldcolorparam7F00,,/param%/td /bold/colorFontFamilyparamARIAL/paramI would guess: ctr and 1 are added, and is then cast to a string, and then print it in my table column. Then why do i get this error? colorparam0100,0100,0100/paramFontFamilyparamTimes New Roman/parambiggeroperator + cannot be applied to java.lang.Integer,int [javac] out.print( ctr + 1 ); ^ It also does not work when I create a new variabel with %! int i=0; %, and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp?? RinkeFontFamilyparamArial/paramsmaller - 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: row counts in logic:iterate...
Dohhh! You are correct. I mistyped :) robert -Original Message- From: Paul, R. Chip [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 2:11 PM To: 'Struts Users Mailing List' Subject: RE: row counts in logic:iterate... Shouldn't that be %= index.intValue() + 1 % instead of using indexId, since you set the index variable to be called index in the iterate tag? -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 11:15 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: row counts in logic:iterate... First: Please do not send HTML emails to the list. Now to address your question: JSTL makes this easy. c:forEach var=item items=${form.items} varStatus=status tr tdc:out value=${status.count}//td tdc:out value=${item.someValue}//td /tr /c:forEach Using Struts tags: logic:iterate id=item name=form property=items indexId=index tr td%=indexId.intValue() + 1%/td tdbean:write name=item property=someValue//td /tr /logic:iterate robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:05 PM To: [EMAIL PROTECTED] Subject: row counts in logic:iterate... colorparam0100,0100,0100/paramnewbie question: I have a jsp which displays several rows with a logic:iterate, also using the indexId-tag. colorparam7F00,,7F00/paramFontFamilyparamCourier New/paramlogic:iteratecolorparam,,/param colorparam,7F00,/paramnamecolorparam,,/param =colorparam,,FF00/paramdateForm colorparam,,/param colorparam,7F00,/parampropertycolorparam,,/pa ram=colorparam,,FF00/paramraw colorparam,,/param colorparam,7F00,/paramidcolorparam,,/param= colorparam,,FF00/paramfoocolor param,,/param colorparam,7F00,/paramindexIdcolorparam,,000 0/param=colorparam,,FF00/paramctr colorparam,,/param colorcolorparam7F00,,7F00/paramcolorparam,,/par am colorparam0100,0100,0100/paramFontFamilyparamArial/param I'd like to display row numbers in my table. But the ctr-variable is 0- based, and I would like to present 1 as the first number to my users. Now, this should work, isn't it?? tdboldcolorparam7F00,,/paramFontFamilyparamCour ier New/param%=/boldcolorparam0100,0100,0100/param colorparam,,/paramctrcolorparam0100,0100,0100/param colorparam,,/param+colorparam0100,0100,0100/param colorparam,,/param1colorparam0100,0100,0100/param boldcolorparam7F00,,/param%/td /bold/colorFontFamilyparamARIAL/paramI would guess: ctr and 1 are added, and is then cast to a string, and then print it in my table column. Then why do i get this error? colorparam0100,0100,0100/paramFontFamilyparamTimes New Roman/parambiggeroperator + cannot be applied to java.lang.Integer,int [javac] out.print( ctr + 1 ); ^ It also does not work when I create a new variabel with %! int i=0; %, and then try to set this i as i = ctr + 1, same error. So how can I get this row number printed in my table, inside the jsp?? RinkeFontFamilyparamArial/paramsmaller - 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: servlet filters and authentication
You may want to see if this supports your requirements: https://sourceforge.net/projects/securityfilter/ robert -Original Message- From: David Evans [mailto:[EMAIL PROTECTED] Sent: Thursday, February 26, 2004 12:07 PM To: Struts Users Mailing List Subject: servlet filters and authentication Hello, I'm configuring the skeleton of a multi module struts application, and i would like use a filter for the authentication. here is psuedojava (for easier reading) of the filter: public final class AuthFilter implements Filter { public void doFilter(request, response, chain) session = request.getSession(); auth = session.getAttribute(authenticated); if (auth == true) { chain.doFilter(request, response); return; } else { dispatcher = request.getRequestDispatcher(/WEB-INF/jsp/security/login.jsp); dispatcher.forward (request, response); return; } } } I've seen this skeleton suggested in several places on the web. The question i have is this: After the user submits the login form, the request will come through the filter, and since it has not yet been authenticated, it will again forward to the login.jsp. I've thought of a couple of ways to deal with this and would like to get input on these and any other approaches. 1) set the mapping of the filter in web.xml in such a way that it allows the login action through. maybe set all actions to have an extension of .do except the login action, which has an extension of .auth. I don't think this will work for me, because the multi module support of Struts requires extension mapping. I guess i could write a small serlvet that is not in the struts mapping but is in the same context and have it mapped to *.auth 2) check within the above filter to see if the request is for the login action, and if so allow it through. so the if statement above would be: if (auth == true || req.getPath().equals(login.do)) Any comments on these ideas or approaches i haven't listed would be greatly appreciated. dave - 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: Common Services across Different Actions.
Wrap the service in a ServletContextListener. The Servlet2.3 spec and higher mandate that these listeners be invoked before the application can process requests; so initialization can take place here and they have access to the application init parameters through web.xml. Then place them in ServletContext for application wide access. robert -Original Message- From: Kommineni, Sateesh (GE Consumer Industrial) [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 7:21 AM To: [EMAIL PROTECTED] Subject: Common Services across Different Actions. Importance: High Hi All, In our Application we have identified few common Services which we are planning to develop as reusable components. The approaches we identified are 1) Representing each service as a Plug-in so that we can initialize all the Service when the Web App is initialized . 2) Create a BaseAction and have all the resources available in that Action class . Sub Class all your Custom Actions from the BaseAction. Is there any Other Approach that we are missing here Thanks a lot Sateesh - 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: A question on Struts taglib.
Try this: logic:iterate id=parts indexId=index collection=%=ShopWorkOrderFormBean.getShopWorkOrder().getPartList()% type=com.cat.sdl.fdd.dataBean.shopWorkOrder.PartBean/td tr td class=formCellbean:write name=parts property=partNumber/nbsp;/td td class=formCellbean:write name=parts property='partDescription' /nbsp;/td td class=formCell a href=app/fdd/shopWorkOrder/UpdatePartRequest.exec?partAction=updatepartInd ex=%=index% img src=images/icoEdit.gif/anbsp; /td /tr /logic:iterate If you can use JSTL, this may work for you, assuming ShopWorkOrderFormBean named shopWorkOrderForm in some scope: c:forEach var=item items=${shopWorkOrderForm.shopWorkOrder.partList} varStatus=status tr td class=formCellc:out value=${item.partNumber}//td td class=formCellc:out value=${item.partDescription}//td td class=formCell a href='app/fdd/shopWorkOrder/UpdatePartRequest.exec?partAction=updatepartIndex=c:out value=${status.index}/'img src=images/icoEdit.gif/anbsp;/a /td /c:forEach robert -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 6:12 PM To: 'Struts Users Mailing List' Subject: RE: A question on Struts taglib. I changed my code to use indexId and got the following error: symbol : variable indexId location: class jsp_servlet._app._fdd._shopworkorder.__createshopworkorder out.print(weblogic.utils.StringUtils.valueOf(indexId )); //[ /app/fdd/shopWorkOrder/CreateShopWorkOrder.jsp; Line: 136] Here's the changed code: logic:iterate id=parts indexId=index collection=%=ShopWorkOrderFormBean.getShopWorkOrder().getPartList()% type=com.cat.sdl.fdd.dataBean.shopWorkOrder.PartBean/td tr td class=formCellbean:write name=parts property=partNumber/nbsp;/td td class=formCellbean:write name=parts property='partDescription' /nbsp;/td td class=formCell a href=app/fdd/shopWorkOrder/UpdatePartRequest.exec?partAction=updatepartInd ex=%=indexId% img src=images/icoEdit.gif/anbsp; /td /tr /logic:iterate Any Idea? What did I do wrong? -Original Message- From: Ramadoss Chinnakuzhandai [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 3:45 PM To: Struts Users Mailing List Subject: RE: A question on Struts taglib. add index attribute in your logic iterate and append that index to your host string. e.g logic:iterate id=xyzID name=xyzForm property=xyz indexId=index yourhoststring+%=indexId % /logic:iterate -R -Original Message- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 24, 2004 3:18 PM To: [EMAIL PROTECTED] Subject: A question on Struts taglib. A question on Struts taglib. Can someone tell me how to reference the index of each element so I can pass it as a parameter with the a href path string? For example I have the following code, I want to print out 'partNumber' and 'partDescription' and a a href' with index of each element'. logic:iterate id=parts collection=%=ShopWorkOrderFormBean.getShopWorkOrder().getPartList()% type=com.cat.sdl.fdd.dataBean.shopWorkOrder.PartBean/td tr td class=formCellbean:write name=parts property=partNumber/nbsp;/td td class=formCellbean:write name=parts property='partDescription' /nbsp;/td td class=formCell a href=app/fdd/shopWorkOrder/UpdatePart.exec?index=How to reference the index here img src=images/iconEdit.gif/anbsp; /td/tr /logic:iterate Thanks in advance! Stella - 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]
[OT] RE: An OCI - JDBC Source Code snippet is required for inserting CLOB data using Java.
Google: http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=Storing+CLOB+in+Oracle+using+JDBC Hit: http://otn.oracle.com/tech/java/jroadmap/jdbc/listing.htm robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 7:20 AM To: [EMAIL PROTECTED] Subject: An OCI - JDBC Source Code snippet is required for inserting CLOB data using Java. Hi, Currently, I am using OCI - JDBC driver (for Oracle) to insert/fetch records using Java. I would like to store CLOB data into a table. May I request you to please provide the source code snippet for inserting CLOB data into Oracle DB? Thanks Regards S Srikanth Satyam Computer Services Limited 12 C P Ramaswamy Road Alwarpet Chennai 600018 Office +(91)-(44)-24983221 Extn 2793 - 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: [OT] Sending email from struts
Matt, we ended up storing our email templates in a configuration file and loading them into memory (using Digester) at application run time. The configuration templates can contain both plain text and HTML message versions. We leverage the java.text.MessageFormat API to replace place holders in the templates with actual data. In the application, we use a design pattern called EmailHelper. EmailHelper provides a business API to which the application passes information. For example, after a customer downloads a product, the application might do something like: EmailHelper.getInstance().sendThankYouMessage(user, product); where user and product are application data structures respectively representing the current user and the product which was just downloaded. Subsequently, EmailHelper mines the necessary data from the arguments and then performs lower level operations such as retrieving the appropriate email template from the in memory configurations, populating the template and then persisting the email to the appropriate queue where it will be delivered later. A different application (daemon) periodically retrieves unsent email from the queue and sends them using the JavaMail API. It has worked quite well so far. If we need to tweak the templates, we can do so and reload the configurations. You could take this idea a step further and store the templates in the database. This does seem like a common task in applications and it would be nice if there were some standard framework to use, but I don't know of any in development currently. robert -Original Message- From: Matt Bathje [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 11, 2004 11:03 AM To: strutslist Subject: [OT] Sending email from struts Hi all. This is kind of off topic as it is not really struts related, but somebody here would probably have the answer. We have our application sending emails to users at some points and it is working fine. The problem is that we have the email message hardcoded into the Java, which we would like to avoid either by storing the message in application.properties or our database. This would be easy, except all of the messages contain user-specific information like their name or phone number or order id or something like that. Anybody have any ideas (or links to programs!) that can read in an email, replace the information it needs to from the db, and send that to the user. I could obviously write something myself to do it, but wouldn't want to reinvent the wheel. Turns out this is hard to search for too - email is not a search term that makes things easy. Thanks, Matt Bathje - 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: [OT] Examining Response Headers
Adam, thanks. I did that. The problem is that I need to see request and response headers from different browsers. robert -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Saturday, February 07, 2004 5:59 AM To: Struts Users Mailing List Subject: Re: [OT] Examining Response Headers here's my suggestion: Firebird or Mozilla browser with LiveHttpHeaders extension. On 02/07/2004 12:35 AM Mike Duffy wrote: Robert, DevProxy is a great program for monitoring the request and response headers: http://www.widgetbuilders.com/ I recently did some socket programming. DevProxy was an invaluable tool. You can see exactly what flows through the socket between browser and host. Very good GUI interface. Mike --- Robert Taylor [EMAIL PROTECTED] wrote: Sorry for the OT post, but Googling and searching the mailing list archives are not producing much. I may not be asking the right question though. Anyhow, I need a tool (free) to examine the request and response headers. Any suggestions? robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - 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: how to output html symbol to jsp page from user-defined taglib?
Try c:out value=${symbal} escapeXml=false/ or don't encode your HTML symbols in your file. Let c:out .../ do it for you. robert -Original Message- From: Ricky Lee [mailto:[EMAIL PROTECTED] Sent: Saturday, February 07, 2004 9:42 AM To: [EMAIL PROTECTED] Subject: how to output html symbol to jsp page from user-defined taglib? hi, thanks for reading.. i have a problem about output a html symbol from taglib if i in a jsp page, use the code below: % String abc=gt;; out.println(abc); % it can show the symbol ; if in my taglib class, i use code below: pageContext.setAttribute(symbal, gt;); and in the jsp page, i use code below to output the page context attrubite. c:out value=${symbal} / it doesn't show me the symbol, it still show me gt; please help methanks! __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - 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]
[OT] Examining Response Headers
Sorry for the OT post, but Googling and searching the mailing list archives are not producing much. I may not be asking the right question though. Anyhow, I need a tool (free) to examine the request and response headers. Any suggestions? robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Examining Response Headers
Thanks to all who responded. Richard, the TcpTunnelGui looks like what I want. I'll check it out. Thanks again. robert -Original Message- From: Richard Yee [mailto:[EMAIL PROTECTED] Sent: Friday, February 06, 2004 5:01 PM To: Struts Users Mailing List Subject: Re: [OT] Examining Response Headers Robert, You can use the org.apache.soap.util.net.TcpTunnelGui tool to monitor your request and response messages. It comes in the Jakarta SOAP distribution. It acts like a proxy. You will need to run it using something like java org.apache.soap.util.net.TcpTunnelGui server_host_name 80 where is the port the tool listens on. server_host_name is your app server name 80 is the port your server listens on. You then need to configure your browser to use and localhost to proxy. Regards, Richard --- Robert Taylor [EMAIL PROTECTED] wrote: Sorry for the OT post, but Googling and searching the mailing list archives are not producing much. I may not be asking the right question though. Anyhow, I need a tool (free) to examine the request and response headers. Any suggestions? robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - 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: [OT]CVS client
You might try Tortois CVS: http://www.tortoisecvs.org/ robert -Original Message- From: Ramadoss Chinnakuzhandai [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 3:17 PM To: [EMAIL PROTECTED] Subject: [OT]CVS client Importance: High Hi, can anybody suggest me any better CVS client other than WinCVS and JCVS? Tnx in advance, -Ramadoss - 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: global data objects -- best practices?
Yes, the ServletContext is the most appropriate place to put it if you want your data to be available during the life time of the application. If your container conforms to Servlet spec. 2.3 or higher, a solution is to implement one or more ServletContextListener(s). Is the a best practice? I think that may be subjective, but it does not bind you to any third party solutions. The container must invoke these upon application start up before it processes any requests. For more information refer to the Servlet 2.3 spec or higher. http://java.sun.com/aboutJava/communityprocess/first/jsr053/index.html robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 3:00 PM To: [EMAIL PROTECTED] Subject: global data objects -- best practices? hi, I have a question regarding data objects that should be accessible from the entire application and which must be created at container startup time. I need to either create and load an existing index or load a serialized index if one exists. This can be a time-consuming process, and I would like to do it once when the servlet container starts, then keep the index in memory thereafter and available to the entire web application. I've seen a few different ways of doing this by searching the archives, but there wasn't a definitive best practice solution that I came across, and the struts API has also changed since many of the suggestions were offered. At present, I am extending the ActionServlet and taking care of the initialization stuff in the subclass's init(). I place the generated index in the ServletContext. This ensures that the index creation will occur only once, at container startup, and that it will be available to the action classes of that web application, but I'm not sure if this is the best solution. Also, I have just come across plugins for the first time, and it seems that they also provide a way of doing application-specific initialization. Having the index creation code in the ActionServlet, as it is at present, seems messy to me, so perhaps that is not the best place for it. In short, what is the best method for ensuring that a global index is created exactly once, and at container startup time? At present, I am subclassing ActionServlet, and doing it there, but is the plugin mechanism an alternate (better?) solution? Is the ServletContext the appropriate place for global data? thanks in advance, n. - 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: Using Parameter in Action via the struts-config.xml
But how can I get the value specified in the parameter attribute in my action class. ActionMapping.getParameter() will get you the value of the parameter attribute. Also using set-property inside a action tag does not work? It works for me. You have to subclass ActionMapping and declare it in your struts-config file. action-mappings type=com.companyname.SubclassedActionMapping So when you use set-property, Struts can set those values using reflection. My guess as to why its not working is that it silently fails to set those properties because they don't exist in the default ActionMapping class. robert -Original Message- From: Anand Patil [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 4:06 PM To: [EMAIL PROTECTED] Subject: Using Parameter in Action via the struts-config.xml Hi All, The struts configuration DTD supports having a parameter attribute to a action. But how can I get the value specified in the parameter attribute in my action class. Also using set-property inside a action tag does not work? Anyone have any idea about this? Regards Anand Patil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] looking for a method that will be called on application startup
The ServletContextListener does exactly what you want. When the web application starts the ServletContextListener.contextInitialized() is invoked passing you ServletContextEvent which contains the ServletContext. These are guaranteed to be invoked before the web application can process any requests. It's simply an interface which you implement (2 methods) then define in your web.xml file. For more information refer to the Servlet 2.3 spec or higher. http://java.sun.com/aboutJava/communityprocess/first/jsr053/index.html robert -Original Message- From: Otávio Augusto [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 8:39 AM To: Struts Users Mailing List Subject: Re: [OT] looking for a method that will be called on application startup do you mean a single implementation of a servlet, with methods which fit each developer needs, and declaring this servlet in the appropriate place in the web.xml file? doesn't this servlet need anything special? I ask that because I've never made a ContextListener, and I also need a first time verification in my app. Thanks Otávio Augusto On Mon, 02 Feb 2004 14:07:47 +0100 Marcel Schepers [EMAIL PROTECTED] wrote: Hi Arne, A solution could be create an initialization servlet. Include that servlet in your web.xml and make sure you provide a load-on-startup parameter. Marcel On Mon, 2004-02-02 at 13:59, Arne Brutschy wrote: hi, I'm looking for a method/hook/whatever that will be called from tomcat at application startup. I want to use it to put all my init-stuff (as configuration reading) into it. At the moment, my authentication filter looks for the presence of these objects in application scope, and if they are not found, they will be created. Is there another way to do this more nicly? Regards, Arne - 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: static variables in actions
John, why not retrieve these from the DB at application start up time and place them in the ServletContext where they are accessible for the life time of the application and easily rendered by JSTL or Struts tags. robert -Original Message- From: Menke, John [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 9:36 AM To: Struts (E-mail) Subject: static variables in actions if I have a collection of state names and I don't want to have to retrieve it over and over again can i do something like this in my action? static Collection _collection; if (collection == null ){ _collection = getCollectionFromDB(); } form.setCollection = _collection - 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: [OT] looking for a method that will be called on application startup
javax.servlet.ServletContextListener robert -Original Message- From: Arne Brutschy [mailto:[EMAIL PROTECTED] Sent: Monday, February 02, 2004 8:00 AM To: Struts Users Mailing List Subject: [OT] looking for a method that will be called on application startup hi, I'm looking for a method/hook/whatever that will be called from tomcat at application startup. I want to use it to put all my init-stuff (as configuration reading) into it. At the moment, my authentication filter looks for the presence of these objects in application scope, and if they are not found, they will be created. Is there another way to do this more nicly? Regards, Arne - 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: Validation problem
What's the name of your Cancel button? Struts should not validate if it finds org.apache.struts.taglib.html.CANCEL or org.apache.struts.taglib.html.CANCEL.x Take a look at the RequestProcessor.processValidate() code: if (request.getAttribute(Globals.CANCEL_KEY) != null) { if (log.isDebugEnabled()) { log.debug( Cancelled transaction, skipping validation); } return (true); } That attribute gets set in RequestProcessor.processPopulate(): // Set the cancellation request attribute if appropriate if ((request.getParameter(Constants.CANCEL_PROPERTY) != null) || (request.getParameter(Constants.CANCEL_PROPERTY_X) != null)) { request.setAttribute(Globals.CANCEL_KEY, Boolean.TRUE); } robert -Original Message- From: Nathan Pitts [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 6:16 PM To: Struts List Subject: Validation problem I am wondering how to solve the following problem with a minimal amount of recoding, and hope someone can give some input. I have a form the has three html:submit buttons -- Update, Cancel and Delete. I am using a LookupDispatchAction and an ActionForm with the validation in the validate() method. Under normal conditions everything works fine..But when a user clicks Update with invalid data on the form, the validate method catches the bad data and returns the proper error message. If the user then decides to click Cancel (without changing the invalid data), the validate() method is still called and the user is returned the same error. One thing that I might be able to do is to somehow find out what button was clicked in the validate() method...?? How would I do that, I wonder... thanks in advance, -nathan - 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: Unit Test in struts
Google: http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=Unit+Test+In+Struts I believe you want: http://strutstestcase.sourceforge.net/ but I could be wrong. robert -Original Message- From: Vinicius Carvalho [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 2:17 PM To: [EMAIL PROTECTED] Subject: Unit Test in struts Hi there! I've heard about a tool (like JUnit) but especific to be used with struts, where I can test my actions, forms and jsp pages, problem is ... I cant rememeber the name, does anyone knows about it? thnx Vinicius - 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: Using ArrayList instead of String[] properties
Wendy, If you simply want to present a list of options to the user represented as check boxes and collect the selected options, and the selected options are just single string values, then you can do the following: Define accounts property as an java.lang.String[] and initialize it to {}. form-property name=accounts type=java.lang.String[] initial={}/ Retrieve you options and store them in an ArrayList named accountOptions and render the options like so: c:forEach var=account items=${accountOptions} html:multibox property=accountsc:out value=${account}//html:multibox /c:forEach This should generate HTML like: input type=checkbox name=accounts value=someValue/ input type=checkbox name=accounts value=someValue2/ input type=checkbox name=accounts value=someValue3/ The servlet container will collect these values and place them in a single String array under the accounts name. Struts will reset your form and them populate the accounts property of your form with the String array. Unless I've missed something, I don't see the need to using indexed properties here if the selected value is single String and order doesn't matter. robert -Original Message- From: shankarr [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 7:07 AM To: Struts Users Mailing List Subject: RE: Using ArrayList instead of String[] properties Hi! I was myself trying to work on a similar issue. My problem is as follows: i query db. Then store data in Araylist. How to pass this to jsp page? Any sample code great appreciation. Please urgent. Sha At 02:27 PM 1/12/2004 -0700, you wrote: From: Wendy Smoak Apparently you don't have to use logic-el:iterate with html-el:checkbox indexed=true. This works: c:forEach items=${accountMap[accountForm.map.calendarYear]} var=account html-el:checkbox property=accounts indexed=true I lied, that doesn't work at all. It produces HTML like this: input type=checkbox name=org.apache.struts.taglib.html.BEAN[0].accounts value=on10_U_FADA0001 I read that indexed properties only work with logic:iterate, so I'm trying to change over from logic:forEach. Can someone help me sort this out? This works to generate HTML, but BeanUtils can't populate the ArrayList that is the 'accounts' property of accountForm because the bracketed [] indexes are missing. logic-el:iterate collection=${accountMap[accountForm.map.calendarYear]} id=acct indexId=ctr html-el:checkbox property=accounts c:out value=${acct.key}/ /html-el:checkbox ... However, if I add indexed=true like so: logic-el:iterate collection=${accountMap[accountForm.map.calendarYear]} id=acct indexId=ctr html-el:checkbox property=accounts indexed=true c:out value=${acct.key}/ /html-el:checkbox It renders this HTML: input type=checkbox name=org.apache.struts.taglib.html.BEAN[0].accounts value=on10_U_FADA0001 ??! This is my first attempt at indexed properties, which apparently I need in order to use an ArrayList. (The items in the ArrayList are just Strings, not complex objects. This isn't nested properties, it's just a bunch of checkboxes. I'm trying to use ArrayList instead of String[] to avoid out of bounds errors. String[] was working *fine* last week, until I got the bright idea to use ArrayList.) I'm getting the feeling that the things in the ArrayList property of the form have to be complex objects and not just Strings. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To achieve all that is possible, one must attempt the impossible - 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: Generic Error Handler
Matthew, What we do is define this in our web.xml file so that when the container gets a 500, 404, etc... error status code, I can then assign the appropriate Struts action to handle it. For example: error-page error-code500/error-code location/c/systemError/location /error-page error-page error-code404/error-code location/c/fileNotFoundError/location /error-page For application exceptions that occur in an action class, you could (as you have already mentioned) defined some general global exceptions handlers and then define more fine grained exception handlers as necessary (per action). hth, robert -Original Message- From: Matthew J. Vincent [mailto:[EMAIL PROTECTED] Sent: Monday, January 12, 2004 11:08 AM To: Struts Users Mailing List Subject: Generic Error Handler I searched the archives and I must have missed it. I want to have a generic JSP or Servlet get invoked when an error occurs in my application. For example, when I try to clink on a link on one of my pages I get an error message: HTTP Status 500 - No action instance for path /detailSearch could be created Looking at the logs it is obvious why there is an error (because I didn't create the org.jax.mgi.mtb.wi.actions.DetailSearchAction class). What is the best approach to handle this type of error? I tried adding the following to my struts-config.xml, but it is not going to the appError.jsp page. global-exceptions exception key=system.error type=java.lang.Exception path=/appError.jsp/ exception key=system.error type=java.lang.ClassNotFoundException path=/appError.jsp/ /global-exceptions What is the best way to handle this? What about other types of errors? Is there a rule of thumb that everyone follows? Sorry for the hopefully easy (probably already asked) question. Matt Here is an output of the logs: SEVERE: No action instance for path /detailSearch could be created java.lang.ClassNotFoundException: org.jax.mgi.mtb.wi.actions.DetailSearchAction at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClass Loader.jav a:1366) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClass Loader.jav a:1213) at org.apache.struts.util.RequestUtils.applicationClass(RequestUtils. java:207) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUti ls.java:23 1) at org.apache.struts.action.RequestProcessor.processActionCreate(Requ estProcess or.java:326) at org.apache.struts.action.RequestProcessor.process(RequestProcessor .java:268) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.j ava:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:204) at org.jax.mgi.mtb.wi.filters.TimerFilter.doFilter(TimerFilter.java:23) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.j ava:233) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp erValve.ja va:256) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:564) at org.apache.catalina.core.StandardContextValve.invokeInternal(Stand ardContext Valve.java:24 5) at org.apache.catalina.core.StandardContextValve.invoke(StandardConte xtValve.ja va:199) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:564) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValv e.java:195 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValv e.java:164 ) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline. java:564) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngine Valve.java :156) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardV alveContex t.java:151) at
RE: [OT] Properties and Singleton
You could simply store the loaded Properties object in the ServletContext where the same instance would be available to the entire web application thus acting as a singleton of sorts without necessarily implementing the pattern. robert -Original Message- From: jay andrews [mailto:[EMAIL PROTECTED] Sent: Monday, January 12, 2004 1:57 PM To: [EMAIL PROTECTED] Subject: [OT] Properties and Singleton I have some configuration properties for my structs app that I am thinking of moving to properties and creating a singleton objects to hold this property values. Is there any reason not to to this with struts? does anyone know if there is an example of this somewhere? my recent search have been fruitless. 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]
RE: Exception handling in struts
http://www.mail-archive.com/cgi-bin/htsearch?config=struts-user_jakarta_apac he_orgrestrict=exclude=words=handle+exceptions http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=Struts+Exception+Hand ling robert -Original Message- From: vasudevrao gupta [mailto:[EMAIL PROTECTED] Sent: Sunday, January 11, 2004 2:07 AM To: 'Struts Users Mailing List' Subject: Exception handling in struts Hi All, Please give me some inputs on how to handle exceptions in struts. It would be easier for me understand with a sample code. Regards VasudevRaoGupta Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - 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: Exception handling in struts
H. When I cut and paste the url (both lines because it was split in the email message) it works for me. Try this: Cut and paste this into the browser address window: http://www.mail-archive.com/cgi-bin/htsearch?config=struts-user_jakarta_apac then...cut and append the rest of the url into the browser address window: he_orgrestrict=exclude=words=handle+exceptions I usually do this when the url wraps in me email client. robert -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Sunday, January 11, 2004 10:32 AM To: Struts Users Mailing List; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Exception handling in struts Robert Attempting to link to the first link.. ht://Dig error htsearch detected an error. Please report this to the webmaster of this site. The error message is: Unable to read configuration file ???-Martin - Original Message - From: Robert Taylor [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, January 11, 2004 8:45 AM Subject: RE: Exception handling in struts http://www.mail-archive.com/cgi-bin/htsearch?config=struts-user_ja karta_apac he_orgrestrict=exclude=words=handle+exceptions http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=Struts+Exce ption+Hand ling robert -Original Message- From: vasudevrao gupta [mailto:[EMAIL PROTECTED] Sent: Sunday, January 11, 2004 2:07 AM To: 'Struts Users Mailing List' Subject: Exception handling in struts Hi All, Please give me some inputs on how to handle exceptions in struts. It would be easier for me understand with a sample code. Regards VasudevRaoGupta Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - 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: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm)
Glad it worked for you. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Friday, January 09, 2004 5:12 PM To: Struts Users Mailing List Subject: RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Robert, I followed your advices. Your code works very well. I have successfully inserted all the values of my bean properties into the database. Thank you very much. --- Robert Taylor [EMAIL PROTECTED] wrote: The same problem exists, you are calling getters on a ThreadBean instance which has not yet been populated. Below three ways to accomplish your goal: METHOD 1: Try this (proxy): public final class ThreadHandler { MessageDAO md = new MySQLMessageDAO(); public int insertThread(ThreadBean bean) throws throws MessageDAOSysException, ObjectNotFoundException { int identity = 0; md.createThread(bean.getReceiver(), bean.getSender(), bean.getThreadTopic(), bean.getThreadBody(), bean.getThreadCreationDate(), bean.getThreadViewCount(), bean.getThreadReplyCount()); // get identity return identity; } } ThreadBean bean = new ThreadBean(); BeanUtils.copyProperties(bean, postForm); ThreadHandler th = new ThreadHandler() th.insertThread(bean); If you do it this way, then it would be better if ThreadHandler was a singleton, but that's a different discussion :) METHOD 2: Another way to do it (design by composition). public final class ThreadHandler { MessageDAO md = new MySQLMessageDAO(); ThreadBean bean; public ThreadHandler(ThreadBean bean) { this.bean = bean; } public int insertThread() throws throws MessageDAOSysException, ObjectNotFoundException { int identity = 0; md.createThread(bean.getReceiver(), bean.getSender(), bean.getThreadTopic(), bean.getThreadBody(), bean.getThreadCreationDate(), bean.getThreadViewCount(), bean.getThreadReplyCount()); // get identity return identity; } } ThreadBean bean = new ThreadBean(); BeanUtils.copyProperties(bean, postForm); ThreadHandler th = new ThreadHandler(bean) th.insertThread(); METHOD 3: Yet another way via classic inheritance: public final class ThreadHandler extends ThreadBean { MessageDAO md = new MySQLMessageDAO(); public ThreadHandler() { super(); } public int insertThread() throws throws MessageDAOSysException, ObjectNotFoundException { int identity = 0; md.createThread(this.getReceiver(), this.getSender(), this.getThreadTopic(), this.getThreadBody(), this.getThreadCreationDate(), this.getThreadViewCount(), this.getThreadReplyCount()); // get identity return identity; } } ThreadHandler th = new ThreadHandler(); BeanUtils.copyProperties(th, postForm); th.insertThread(); hth, robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 11:48 AM To: Struts Users Mailing List Subject: RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Thank you for your comment, which is very helpful. Instead of extends ThreadBean, I now import the ThreadBean into my ThreadHandler class (see the code below). I am still getting all null or zero values from the bean. What is the proper way to do it? I simply want to insert the value of all the properties into the database. Most of the fields in my database require NOT NULL. code: == import org.apache.artimus.message.ThreadBean; class ThreadHandler { ThreadBean threadBean = new ThreadBean(); String receiver = threadBean.getReceiver(); String sender = threadBean.getSender(); String threadTopic = threadBean.getPostTopic(); String threadBody = threadBean.getPostBody(); Timestamp threadCreationDate = threadBean.getThreadCreationDate(); int threadViewCount = threadBean.getThreadViewCount(); int threadReplyCount = threadBean.getThreadReplyCount(); MessageDAO md = new MySQLMessageDAO(); public int insertThread( ThreadBean threadBean
RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm)
Your code seems a bit confusing based upon what you want to achieve. If indeed you want ThreadHandler to inherit from ThreadBean, you should be able to do something like this: DynaActionForm postForm = ( DynaActionForm )form; ThreadHander = new ThreadHandler(); BeanUtils.copyProperties( threadHandler, postForm ); threadHandler.insertThread(); The reason you are getting null and zero values in ThreadHandler is that you are populating a new instance of ThreadBean here: DynaActionForm postForm = ( DynaActionForm )form; ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); ... and then you get a new instance of ThreadHandler here: ThreadHandler thandler = new ThreadHandler(); At this point, ThreadHandler knows nothing of your populated instance of ThreadBean. Instead it is getting values from its own empty ThreadBean parent here: class ThreadHandler extends ThreadBean { String receiver = getReceiver(); String sender = getSender(); String threadTopic = getPostTopic(); String threadBody = getPostBody(); Timestamp threadCreationDate = getThreadCreationDate(); int threadViewCount = getThreadViewCount(); int threadReplyCount = getThreadReplyCount(); . . } ...unless you do something like the following in ThreadHandler.insertThread(): public int insertThread(ThreadBean bean) throws SomeException { this.receiver = bean.getReceiver(); this.sender = bean.getSender(); // insert code here } which from a design perspective, I'm not sure why you would want to do it this way. hth, robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 10:27 PM To: Struts Users Mailing List Subject: RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) I have narrowed down the problem. Something went wrong in my business tier class (ThreadHandler.java). All the properties in the JavaBean are populated properly (I have checked). The way I coded in the ThreadHandler class failed to retrieve the value of all the properties in the JavaBean (ThreadBean.java). All the values turned out to be null or 0. Now, what is wrong with the code? class ThreadHandler extends ThreadBean { String receiver = getReceiver(); String sender = getSender(); String threadTopic = getPostTopic(); String threadBody = getPostBody(); Timestamp threadCreationDate = getThreadCreationDate(); int threadViewCount = getThreadViewCount(); int threadReplyCount = getThreadReplyCount(); . . } To answer your question: 1. Have you checked to make sure that the fields you expect actually exist in the form before calling BeanUtils.copyProperties()? Yes, I have printed out the contents of the JSP text fields in my action class, which is a servlet. For example: System.out.println( the sender is + postForm.get( sender ) ); 2. If so, have you checked to see if the data was copied properly just after BeanUtils.copyProperties()? Yes, I have also printed out the value of the bean properties. For example: System.out.println( the sender is + threadBean.getSender() ); 3. BeanUtils.copyProperties() uses reflection to copy properties. Are you using proper JavaBeans naming convention? Yes, I used a pair of get and set methods for each properties in the JavaBean (ThreadBean.java). And in my action class, I could print out the value of those properties. --- Robert Taylor [EMAIL PROTECTED] wrote: Have you checked to make sure that the fields you expect actually exist in the form before calling BeanUtils.populate()? If so, have you checked to see if the data was copied properly just after BeanUtils.populate()? BeanUtils.populate() uses reflection to copy properties. Are you usingproper JavaBeans naming convention? Try and isolate exactly where the data is getting lost. I use BeanUtils.populate() all the time with DynaForms and have no problems. Usually when I do, I find that my data member names don't correspond. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 1:42 PM To: [EMAIL PROTECTED] Subject: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Hi, my program compiled OKay. When I ran the application, somehow, the properties of my DynaValidatorForm are not passed from the action class to the business tier and then to the data access tier. Please help me taking a look at what went wrong. It looks that the validation worked fine: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String
RE: forwarding request from select tag
If you use html:option .../ then the selected value should show as being selected when the page is reloaded. robert -Original Message- From: Namasivayam, Sudhakar (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 9:15 AM To: Struts Users Mailing List Subject: forwarding request from select tag Hi all, I have a list page which has a combobox to select the filter. html:select property=statusfilter option value = AllAll/option option value = CompletedCompleted/option option value = In processIn process/option /html:select The page loads with the value all as default. Now if the different option say completed is selected, i want to reload the same page with the new filter status. How should i do it? Thanks, sudhakar
RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm)
The same problem exists, you are calling getters on a ThreadBean instance which has not yet been populated. Below three ways to accomplish your goal: METHOD 1: Try this (proxy): public final class ThreadHandler { MessageDAO md = new MySQLMessageDAO(); public int insertThread(ThreadBean bean) throws throws MessageDAOSysException, ObjectNotFoundException { int identity = 0; md.createThread(bean.getReceiver(), bean.getSender(), bean.getThreadTopic(), bean.getThreadBody(), bean.getThreadCreationDate(), bean.getThreadViewCount(), bean.getThreadReplyCount()); // get identity return identity; } } ThreadBean bean = new ThreadBean(); BeanUtils.copyProperties(bean, postForm); ThreadHandler th = new ThreadHandler() th.insertThread(bean); If you do it this way, then it would be better if ThreadHandler was a singleton, but that's a different discussion :) METHOD 2: Another way to do it (design by composition). public final class ThreadHandler { MessageDAO md = new MySQLMessageDAO(); ThreadBean bean; public ThreadHandler(ThreadBean bean) { this.bean = bean; } public int insertThread() throws throws MessageDAOSysException, ObjectNotFoundException { int identity = 0; md.createThread(bean.getReceiver(), bean.getSender(), bean.getThreadTopic(), bean.getThreadBody(), bean.getThreadCreationDate(), bean.getThreadViewCount(), bean.getThreadReplyCount()); // get identity return identity; } } ThreadBean bean = new ThreadBean(); BeanUtils.copyProperties(bean, postForm); ThreadHandler th = new ThreadHandler(bean) th.insertThread(); METHOD 3: Yet another way via classic inheritance: public final class ThreadHandler extends ThreadBean { MessageDAO md = new MySQLMessageDAO(); public ThreadHandler() { super(); } public int insertThread() throws throws MessageDAOSysException, ObjectNotFoundException { int identity = 0; md.createThread(this.getReceiver(), this.getSender(), this.getThreadTopic(), this.getThreadBody(), this.getThreadCreationDate(), this.getThreadViewCount(), this.getThreadReplyCount()); // get identity return identity; } } ThreadHandler th = new ThreadHandler(); BeanUtils.copyProperties(th, postForm); th.insertThread(); hth, robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 11:48 AM To: Struts Users Mailing List Subject: RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Thank you for your comment, which is very helpful. Instead of extends ThreadBean, I now import the ThreadBean into my ThreadHandler class (see the code below). I am still getting all null or zero values from the bean. What is the proper way to do it? I simply want to insert the value of all the properties into the database. Most of the fields in my database require NOT NULL. code: == import org.apache.artimus.message.ThreadBean; class ThreadHandler { ThreadBean threadBean = new ThreadBean(); String receiver = threadBean.getReceiver(); String sender = threadBean.getSender(); String threadTopic = threadBean.getPostTopic(); String threadBody = threadBean.getPostBody(); Timestamp threadCreationDate = threadBean.getThreadCreationDate(); int threadViewCount = threadBean.getThreadViewCount(); int threadReplyCount = threadBean.getThreadReplyCount(); MessageDAO md = new MySQLMessageDAO(); public int insertThread( ThreadBean threadBean ) throws MessageDAOSysException, ObjectNotFoundException { System.out.println( The sender is + sender + . ); System.out.println( The subject is + threadTopic + . ); System.out.println( The creation date is + threadCreationDate ); System.out.println( The number of replies are + threadReplyCount ); md.createThread( receiver, sender, threadTopic, threadBody, threadCreationDate, threadViewCount, threadReplyCount ); int threadID = 0; . . return threadID; } } --- Robert Taylor [EMAIL PROTECTED] wrote: Your code seems a bit confusing based upon what you want to achieve. If indeed you want ThreadHandler to inherit from ThreadBean, you should be able to do
RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm)
I don't think ThreadHandler represents a java.lang.Thread handler. I think it more or less is a business object to facilitate persistance. I think the use of the word Thread here is more representative of a forum discussion thread. I could be wrong though. robert -Original Message- From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 12:00 PM To: 'Struts Users Mailing List' Subject: RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Caroline, May I ask why you are performing your database updates through a separate thread? It seems to be complicating your code. Creating lots of threads from within your web application is not a good practice if you want your app to scale well. Also, what happens if the update doesn't succeed? You have no way of notifying the user. The code: snip ThreadBean threadBean = new ThreadBean(); String receiver = threadBean.getReceiver(); String sender = threadBean.getSender(); /snip is your problem unless your ThreadBean constructor can populate itself correctly with the desired values. If you must use threads, then you should be able to create a ThreadHandler, call a setter method on it and set you ThreadBean instance variable, and then call the run method on the ThreadHandler to start the thread. Regards, Richard -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 8:48 AM To: Struts Users Mailing List Subject: RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Thank you for your comment, which is very helpful. Instead of extends ThreadBean, I now import the ThreadBean into my ThreadHandler class (see the code below). I am still getting all null or zero values from the bean. What is the proper way to do it? I simply want to insert the value of all the properties into the database. Most of the fields in my database require NOT NULL. code: == import org.apache.artimus.message.ThreadBean; class ThreadHandler { ThreadBean threadBean = new ThreadBean(); String receiver = threadBean.getReceiver(); String sender = threadBean.getSender(); String threadTopic = threadBean.getPostTopic(); String threadBody = threadBean.getPostBody(); Timestamp threadCreationDate = threadBean.getThreadCreationDate(); int threadViewCount = threadBean.getThreadViewCount(); int threadReplyCount = threadBean.getThreadReplyCount(); MessageDAO md = new MySQLMessageDAO(); public int insertThread( ThreadBean threadBean ) throws MessageDAOSysException, ObjectNotFoundException { System.out.println( The sender is + sender + . ); System.out.println( The subject is + threadTopic + . ); System.out.println( The creation date is + threadCreationDate ); System.out.println( The number of replies are + threadReplyCount ); md.createThread( receiver, sender, threadTopic, threadBody, threadCreationDate, threadViewCount, threadReplyCount ); int threadID = 0; . . return threadID; } } --- Robert Taylor [EMAIL PROTECTED] wrote: Your code seems a bit confusing based upon what you want to achieve. If indeed you want ThreadHandler to inherit from ThreadBean, you should be able to do something like this: DynaActionForm postForm = ( DynaActionForm )form; ThreadHander = new ThreadHandler(); BeanUtils.copyProperties( threadHandler, postForm ); threadHandler.insertThread(); The reason you are getting null and zero values in ThreadHandler is that you are populating a new instance of ThreadBean here: DynaActionForm postForm = ( DynaActionForm )form; ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); ... and then you get a new instance of ThreadHandler here: ThreadHandler thandler = new ThreadHandler(); At this point, ThreadHandler knows nothing of your populated instance of ThreadBean. Instead it is getting values from its own empty ThreadBean parent here: class ThreadHandler extends ThreadBean { String receiver = getReceiver(); String sender = getSender(); String threadTopic = getPostTopic(); String threadBody = getPostBody(); Timestamp threadCreationDate = getThreadCreationDate(); int threadViewCount = getThreadViewCount(); int threadReplyCount = getThreadReplyCount(); . . } ...unless you do something like the following in ThreadHandler.insertThread(): public int insertThread(ThreadBean bean) throws SomeException { this.receiver
RE: html link to a action with parameters
html:link action=/myDynaActionFormActionNameInvoke my action which uses a dyna action form/html:link Please do some research before posting. robert -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 1:03 PM To: Struts Users Mailing List Subject: html link to a action with parameters how do you create html links to an action that uses a dyna action form? - 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: dynamic parameters to DynaActionForm
Look at IndexedProperties: http://jakarta.apache.org/struts/faqs/indexedprops.html robert -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 1:02 PM To: Struts Users Mailing List Subject: dynamic parameters to DynaActionForm is it possible to have dynamic parameters sent to to a dyna form? I do not know how many or the name of the parameters that are being sent? Nathan - 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: dynamic parameters to DynaActionForm
Nathan, could you explain in a little more detail: Is is a use case where you retrieve a value from somewhere which tells you how many empty fields to generate and this value could vary. Then these empty fields are populated with user input and sent to the server to update the database. If so, you could do the following: I would also use org.apache.commons.collections.ListUtils.lazyList() implementation. http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect ions/ListUtils.html#lazyList(java.util.List,%20org.apache.commons.collection s.Factory) The lazyList implementation will create a new object using the specified Factory when Struts indexes into a position in the list which is null. form-bean name=myForm type=com.company.MyForm form-property name=colors type=java.util.List/ /form-bean Subclass your DynaActionForm and override the reset() public final class MyForm extends DynaActionForm { private static Logger logger = Logger .getLogger(SearchContractsForm.class.getName()); /** * Reset all bean properties to their default state. This method is * called before the properties are repopulated by the controller servlet. * p * The default implementation uses the initial value specified in the * FormPropertyConfig element for each property. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset(mapping, request); List colors = ListUtils.lazyList(new ArrayList(), new StringFactory()); this.set(colors, colors); } /** * codeStringFactory/code * * @see org.apache.commons.ListUtils */ class StringFactory implements Factory { /** * Create a new instance of the specified object */ public Object create() { return new String(); } } } Define an action which is invoked prior to displaying the jsp. In the action populate the colors data member with a List of empty Strings. In the page do one of the following: One way to display the values is like so: c:forEach var=color items${myForm.colors} varStatus=status c:set var=property value=colors[${status.index}]/ html_el:text property=${property}/ /c:forEach Another way would be to leverage the Struts tags: logic:iterate id=color name=myForm property=colors html:text name=colors property=color indexed=true/ /logic:iterate Either way should render html like: input type=text name=colors[0] value=/ input type=text name=colors[1] value=/ input type=text name=colors[2] value=/ input type=text name=colors[3] value=/ input type=text name=colors[4] value=/ ... input type=text name=colors[n] value=/ Upon submitting the form, Struts will invoke reset() and populate the colors data member with a new lazy list. When Struts indexes into an empty location, lazy list will first create a new String at that location and then Struts will populate that with the value sent from the client. That should give you a better idea of how to use indexed properties. hth, robert -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 3:13 PM To: Struts Users Mailing List Subject: Re: dynamic parameters to DynaActionForm Robert, I have been researching all morning and still can not find a good answer. I need to send the action a set of parameters like.. param1 param2 param3 . . . param# The amount of parameters in the form are dynamic. How or what type of object would you use in a form bean. Nathan On Jan 8, 2004, at 11:18 AM, Robert Taylor wrote: Look at IndexedProperties: http://jakarta.apache.org/struts/faqs/indexedprops.html robert -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, January 08, 2004 1:02 PM To: Struts Users Mailing List Subject: dynamic parameters to DynaActionForm is it possible to have dynamic parameters sent to to a dyna form? I do not know how many or the name of the parameters that are being sent? Nathan - 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
RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm)
Have you checked to make sure that the fields you expect actually exist in the form before calling BeanUtils.populate()? If so, have you checked to see if the data was copied properly just after BeanUtils.populate()? BeanUtils.populate() uses reflection to copy properties. Are you usingproper JavaBeans naming convention? Try and isolate exactly where the data is getting lost. I use BeanUtils.populate() all the time with DynaForms and have no problems. Usually when I do, I find that my data member names don't correspond. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 1:42 PM To: [EMAIL PROTECTED] Subject: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Hi, my program compiled OKay. When I ran the application, somehow, the properties of my DynaValidatorForm are not passed from the action class to the business tier and then to the data access tier. Please help me taking a look at what went wrong. It looks that the validation worked fine: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ . . /form-bean because when I intentionally left several of the text fields blank and submitted my JSP form, an applet got prompted showing something in those fields are required. In my action class (see below), I used BeanUtils to copy all the properties of the DynaValidatorForm to a bean (ThreadBean): DynaActionForm postForm = ( DynaActionForm )form; ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); I then added a number of properties with pre-defined values to the ThreadBean in the Action class: Timestamp now = DateUtil.getCurrentGMTTimestamp(); threadBean.setThreadCreationDate( now ); threadBean.setThreadViewCount( 0 ); I then called a method in a service class ThreadHandler and passing threadBean as the parameter of that method: ThreadHandler thandler = new ThreadHandler(); threadID = thandler.insertThread( threadBean ); In the ThreadHandler class (see below), I first tried to retrieve the values of those properties from the ThreadBean. I FOUND OUT ALL THOSE VALUES ARE NULL! class ThreadHandler extends ThreadBean { int threadID = getThreadID(); String receiver = getReceiver(); String sender = getSender(); Timestamp threadCreationDate = getThreadCreationDate(); int threadViewCount = getThreadViewCount(); public ThreadHandler() {} MessageDAO md = new MySQLMessageDAO(); public int insertThread( ThreadBean threadBean ) throws MessageDAOSysException, ObjectNotFoundException { md.createThread( receiver, sender, threadCreationDate, threadViewCount ); . . return threadID; } } __ Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus - 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: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm)
Sorry, I mean copyProperties(). You can find the differences defined below: http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils /BeanUtils.html#copyProperties(java.lang.Object, java.lang.Object) http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils /BeanUtils.html#populate(java.lang.Object, java.util.Map) robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 2:13 PM To: Struts Users Mailing List Subject: RE: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) What does BeanUtils.populate(); do? I used BeanUtils.copyProperties(); Does it make any difference? --- Robert Taylor [EMAIL PROTECTED] wrote: Have you checked to make sure that the fields you expect actually exist in the form before calling BeanUtils.populate()? If so, have you checked to see if the data was copied properly just after BeanUtils.populate()? BeanUtils.populate() uses reflection to copy properties. Are you usingproper JavaBeans naming convention? Try and isolate exactly where the data is getting lost. I use BeanUtils.populate() all the time with DynaForms and have no problems. Usually when I do, I find that my data member names don't correspond. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 1:42 PM To: [EMAIL PROTECTED] Subject: All The Bean Properties Are Null in the Business Tier!!! (Used BeanUtils to Convert DynaValidatorForm) Hi, my program compiled OKay. When I ran the application, somehow, the properties of my DynaValidatorForm are not passed from the action class to the business tier and then to the data access tier. Please help me taking a look at what went wrong. It looks that the validation worked fine: form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ . . /form-bean because when I intentionally left several of the text fields blank and submitted my JSP form, an applet got prompted showing something in those fields are required. In my action class (see below), I used BeanUtils to copy all the properties of the DynaValidatorForm to a bean (ThreadBean): DynaActionForm postForm = ( DynaActionForm )form; ThreadBean threadBean = new ThreadBean(); BeanUtils.copyProperties( threadBean, postForm ); I then added a number of properties with pre-defined values to the ThreadBean in the Action class: Timestamp now = DateUtil.getCurrentGMTTimestamp(); threadBean.setThreadCreationDate( now ); threadBean.setThreadViewCount( 0 ); I then called a method in a service class ThreadHandler and passing threadBean as the parameter of that method: ThreadHandler thandler = new ThreadHandler(); threadID = thandler.insertThread( threadBean ); In the ThreadHandler class (see below), I first tried to retrieve the values of those properties from the ThreadBean. I FOUND OUT ALL THOSE VALUES ARE NULL! class ThreadHandler extends ThreadBean { int threadID = getThreadID(); String receiver = getReceiver(); String sender = getSender(); Timestamp threadCreationDate = getThreadCreationDate(); int threadViewCount = getThreadViewCount(); public ThreadHandler() {} MessageDAO md = new MySQLMessageDAO(); public int insertThread( ThreadBean threadBean ) throws MessageDAOSysException, ObjectNotFoundException { md.createThread( receiver, sender, threadCreationDate, threadViewCount ); . . return threadID; } } __ Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus - 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] __ Do you Yahoo!? Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: split table
The displaytag library will do what you want: http://sourceforge.net/projects/displaytag/ robert -Original Message- From: Hari_s [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 06, 2004 12:50 AM To: Struts Users Mailing List Subject: Re: split table thank for your response derek... I mean it's split table into separate page, i have 100 data and i want display 10 data every pages... - Original Message - From: Derek Clarkson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, January 06, 2004 8:27 AM Subject: Re: split table On Tuesday 06 January 2004 12:21, Hari_s wrote: is it posible to split table with struts or jstl ? What do you mean by split table - two tables separated at some abitory point in the data ? -- Regards, Derek Clarkson .O. Analyst/Programmer ..O Waterwerks Pty Ltd OOO Melbourne, Australia - 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: Mix protocols transparently in Struts
Take a look at http://struts.ditlinger.com/ , the Struts SSL Extension. robert -Original Message- From: Alain Van Vyve [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 06, 2004 10:48 AM To: [EMAIL PROTECTED] Subject: Mix protocols transparently in Struts I would like to mix HTTP et HTTPS ... A very intersting article http://www.javaworld.com/javaworld/jw-05-2002/jw-0510-struts_p.html has been written about that subject but the solution described was designed in a Struts 1.0 environment ... Does somebody has already adapted that solution in a Struts 1.1 environment ? Thank you ... Alain - 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: selecting a value from drop down list
Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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]
FW: selecting a value from drop down list
-Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:43 AM To: [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Okay. I just saw something in your original post. select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName//option /logic:iterate /select You are not supplying any values in your option! Try this: select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName/bean:write name=results property =sName//option /logic:iterate /select You can also try using the Struts-html tags: html:select style=width:225px property=sName html:optionsCollection name=sNameSetup property=nameList label=sName value=sName/ /html:select robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:29 AM To: Robert Taylor Subject: RE: selecting a value from drop down list Hi, Thanks robert. I tried that but it doesnt return any values Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:18 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Try request.getParameter(sName); robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:06 AM To: Struts Users Mailing List Subject: RE: selecting a value from drop down list Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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: selecting a value from drop down list
Try request.getParameter(sName); robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:06 AM To: Struts Users Mailing List Subject: RE: selecting a value from drop down list Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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: Adding items to a vector of formbean in the jsp
Look at ListUtils.lazyList() http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect ions/ListUtils.html#lazyList(java.util.List,%20org.apache.commons.collection s.Factory) robert -Original Message- From: Paulo Rezende [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 1:03 PM To: Struts Users Mailing List Subject: Adding items to a vector of formbean in the jsp Struters, I need help from somebody. I have a formbean that has a vector property, and my jsp has a iterator that renderizes this: input type=hidden name=userList[0].id value=1 id=id0 input type=hidden name=userList[0].name value=paul id=name0 input type=hidden name=userList[1].id value=2 id=id1 input type=hidden name=userList[1].name value=john id=name1 If i change the value of any of these inputs and submit the page, the requestprocessor parse and update the values of the vector in the formbean correctly. But if i, dinamicly with dom, create new inputs increasing the index (like in the example below) and submit the page, i get a exception of Beans.populate(), a out of ranger error. newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].id; newInput.id = id2; myHmtlBody.appendChild(inp); document.getElementById(id2).value = 3; newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].name; newInput.id = name2; myHmtlBody.appendChild(inp); document.getElementById(name2).value = peter; What i really want is that, when i submit the page, the requestprocessor add a new item in the vector and set the values of the new item with the values of the new inputs. Anybody have any thing to say or suggest, any idea? thanks, Paulo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem in Displaying ArrayList constents in jsp
Are you redirecting instead of forwarding? If so, your request attributes will be lost once the page is rendered. robert -Original Message- From: Sudhakar G [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 12:05 AM To: [EMAIL PROTECTED] Subject: Problem in Displaying ArrayList constents in jsp Hi All, My ArrayList holds a set of ValueObjects.When I try to display the ArrayList contents using logic tag it is throwing an exception saying can't find the clientview bean. In Action class the code is like. request.setAttribute(ClientList,clientListVO); return mapping.findForward(success); In Jsp logic:iterate name=ClientList id=clientview bean:write name=clientview property=clientID/ /logic:iterate Value Object has ClientID as attribute with get and set methods. Can any one help in this problem that will be thankful.. Thanks in advance.. cheers Sudhakar DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. - 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: [Tiles] Populating Tiles definition attribute at runtime
Thanks to all who replied. I'll look into each suggested solution more closely. robert -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 2:15 PM To: Struts Users Mailing List Subject: RE: [Tiles] Populating Tiles definition attribute at runtime Thanks for the reply Pedro, but I was looking for a cleaner solution. robert -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 12:51 PM To: Struts Users Mailing List Subject: Re: [Tiles] Populating Tiles definition attribute at runtime I don¹t know if it is possible to change a tiles definition at runtime but a solution to your problem could be solved by specifying a definition that uses a jsp file that does a conditional include according to a given parameter? definition name=choose.def extends=base.def put name=header value=/header.jsp/ put name=body value=/choose.jsp/ - put name=footer value=/footer.jsp/ /definition choose.jsp c:import url='/WEB-INF/com/website/tiles/choose/${request.choose}'/ Pedro Salgado On 29/12/2003 17:46, Robert Taylor [EMAIL PROTECTED] wrote: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - 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: server-side validation with Validator
One could use DynaValidatorActionForm for wizard processes that used the same form but validate different fields based on the path. robert -Original Message- From: Brice Ruth [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 1:29 PM To: Struts Users Mailing List Subject: Re: server-side validation with Validator Yeah, I read pretty much exactly that in Ted's book, but I have to admit, I'm not entirely sure what it means ... someone previously also mentioned that the DynaValidatorForm uses the name attribute of the action definition, whereas the DynaValidatorActionForm uses the path ... well, my path is the path for the Action ... I'm not sure under what circumstances one would use DynaValidatorActionForm, I guess ... Matthias Wessendorf wrote: Hi, The DynaValidatorForm will match the formset name with the form-bean name. it uses mapping.getAttribute() to init the validator The DynaValidatorActionForm will match the formset name with the action-mapping path. it uses mapping.getPath() for init the validator -Original Message- From: Brice Ruth [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 30, 2003 7:11 PM To: Struts Users Mailing List Subject: Re: server-side validation with Validator OK, nevermind ... I just needed to change DynaValidatorActionForm to DynaValidatorForm ... now it works. Brice Ruth wrote: OK, I have to admit, I'm a bit confused using Validator, despite looking at the online docs having Ted's excellent book at hand. I have everything setup to do server-side validation, as far as I can tell ... I've set a breakpoint in DynaValidatorActionForm.validate and it is getting called ... to test if the validation is working, I've disabled the JavaScript validation by removing the onsubmit call for my html:form element ... fine, now I can submit non-valid data. However, I keep getting to my Action, instead of being shunted back to the input page. My input page is defined as a tile definition, here's what my struts-config.xml looks like (for that section): action path=/US/garden/resources/orangeThumbApply type=com.fiskars.struts.actions.OrangeThumbSaveData name=orangeThumbApp scope=request validate=true input=garden.orangeThumbForm forward name=success path=garden.orangeThumbThankyou/ /action Does anyone see anything wrong here? To test the validation, I've left out a required field and I've entered a text string for a numeric (short) value. My JavaScript validation seems to be working like a champ, but the server-side stuff seems MIA, even though its being called. TIA -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - 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: Design question regarding struts security features
You should be able to do this with standard J2EE security provided by your web container. If you store your user credentials in a database, then you may want to look at SecurityFilter: http://sourceforge.net/projects/securityfilter/ It allows you to leverage standard J2EE security features but provides more flexible authentication. robert -Original Message- From: Patrick Scheuerer [mailto:[EMAIL PROTECTED] Sent: Sunday, December 28, 2003 6:37 PM To: Struts Users List Subject: Design question regarding struts security features Hello everybody, I'm in the process of developing my first Struts application, so forgive me if this question is insulting everybody's intellect. The application I'm working on is a support portal where you can download technical document, drivers etc. The tricky part is, that certain documents should be only accessible to users with a certain role. My idea so far is to put a user object in the session and to evaluate the role (and therefore the access level) of the user for all views that are displaying data which might be restricted. I guess the easiest way would be using a jsp tag like security:checkAccessLevel / which would retrieve the user object from the session (if it exists) and the then filter the data accordingly. Is there such security taglib around? Has anybody worked on a similar scenario? What is the best approach to solve this problem? Is there a best practice for it? Any tips, hints, code snippets are welcome. Thank you very much. Patrick - 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: Testing iterator quantity
Using JSTL tags and assuming you have a collection of elements named elements in some scope: table ... c:forEach var=element items=${elements} varStatus=status c:if test=${(status.index % 10 == 0) !status.first}/tr/c:ifc:if test=${status.index % 10 == 0}tr/c:if td!-- put data here --/td c:if test=${status.last}/tr/c:if /c:forEach /table robert -Original Message- From: Otávio Augusto [mailto:[EMAIL PROTECTED] Sent: Sunday, December 28, 2003 10:58 PM To: [EMAIL PROTECTED] Subject: Testing iterator quantity Is there a way to know how many times i've iterated over a collection, using struts tags ? for instance: i have an iterator with 100 elements. I want to put each 10 elements in a different row of a table. Does anybody have an idea? thanks Otávio Augusto - 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]
[Tiles] Populating Tiles definition attribute at runtime
Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Tiles] Populating Tiles definition attribute at runtime
Thanks for the reply Pedro, but I was looking for a cleaner solution. robert -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 12:51 PM To: Struts Users Mailing List Subject: Re: [Tiles] Populating Tiles definition attribute at runtime I don¹t know if it is possible to change a tiles definition at runtime but a solution to your problem could be solved by specifying a definition that uses a jsp file that does a conditional include according to a given parameter? definition name=choose.def extends=base.def put name=header value=/header.jsp/ put name=body value=/choose.jsp/ - put name=footer value=/footer.jsp/ /definition choose.jsp c:import url='/WEB-INF/com/website/tiles/choose/${request.choose}'/ Pedro Salgado On 29/12/2003 17:46, Robert Taylor [EMAIL PROTECTED] wrote: Greetings, I have a tiles definition in my tiles-defs.xml similar to below: definition name=search extends=layout put name=heading value={0}Search type=string / put name=content value=/search.jsp type=page / /definition which I would like to be able to modify the heading value such that at runtime I could substitute a value for {0}. For example, it would be ideal to use a JSTL type of syntax such as: definition name=search extends=layout put name=heading value=${param.myValue}Search type=string / put name=content value=/search.jsp type=page / /definition but this does not work. robert - 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: DynaBean with JSTL
As long as the DynaBean implentation exposes a Map interface then yes. For example, DynaActionForm implements DynaBean and exposes a Map interface, so if you had a property named customerName, in a form bean named customerDetailForm, then you could render that property like so using JSTL. c:out value=${customerDetailForm.map.customerName}/ robert -Original Message- From: Manganotti Francesco (USI) [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 23, 2003 8:54 AM To: Struts Users Mailing List Subject: R: DynaBean with JSTL ... just to know the state of the art. Is it possible to view a DynaBean throw JSTL1.0? many thanks in advance, Francesco Questo messaggio di posta elettronica contiene informazioni di carattere confidenziale rivolte esclusivamente al destinatario sopra indicato. E' vietato l'uso, la diffusione, distribuzione o riproduzione da parte di ogni altra persona. Nel caso aveste ricevuto questo messaggio di posta elettronica per errore, siete pregati di segnalarlo immediatamente al mittente e distruggere quanto ricevuto (compresi i file allegati) senza farne copia. Qualsivoglia utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo di non prendere cognizione della corrispondenza tra altri soggetti, salvo più grave illecito, ed espone il responsabile alle relative conseguenze. Confidentially notice. This e-mail transmission may contain legally privileged and/or confidential information. Please do not read it if you are not the intended recipient(S). Any use, distribution, reproduction or disclosure by any other person is strictly prohibited. If you have received this e-mail in error, please notify the sender and destroy the original transmission and its attachments without reading or saving it in any manner. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How To Output the Value of a String That Is Passed From Another JSP?
I bet your missing the JSTL taglib directive in your page. Try adding %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % and then your c:x .../ actions will work. -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 9:45 PM To: Struts Users Mailing List Subject: RE: How To Output the Value of a String That Is Passed From Another JSP? Thanks for your advice. I did this in my view.jsp: html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ c:out value=${cr}/ html:submitView/Send Messages/html:submit /html:form bean:write name=articleForm property=creator/ I was able to see the View/Send Messages button displayed. And the bean:write name=articleForm property=creator/ also wrote out the value of the property creator. Now, the question is 1. why the c:set var=cr value=${articleForm.creator} scope=session/ did not put the value in the session scope? 2. What is wrong with the c:set tag? 3. What should I do if I want to put the value of creator in a session scope? -C --- Robert Taylor [EMAIL PROTECTED] wrote: Are you sure that c:set var=cr value=${articleForm.creator} scope=session/ is placing the value in the intended scope? Try doing this: html:form action=/list/Message c:set var=cr value=${articleForm.creator}scope=session/ c:out value=${cr}/ html:submitView/Send Messages/html:submit /html:form To make sure it is actually putting the value in session scope. If so, then on postForm.jsp try using scriplets to make sure that the value can be accessed. If it can, then do you have all of your tag library directives in your pages? robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:40 PM To: Struts Users Mailing List Subject: RE: How To Output the Value of a String That Is Passed From Another JSP? cr is not a form and there is no action involved. There are two JSPs; view.jsp and postForm.jsp and each is with its own form (different forms). In my view.jsp, I am able to write out String creator this way: bean:write name=articleForm property=creator/ and I put the String creator in a session object: html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ html:submitView/Send Messages/html:submit /html:form and in the postForm.jsp, I retrieve the String and try to write it out in a text field: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=%=author% size=82 maxlength=25 tabindex=1/ I got this error message: ServletException in:/article/content/postForm.jsp] Cannot find bean cr in scope session' -Caroline --- David Friedman [EMAIL PROTECTED] wrote: Caroline, How do you save the form cr in session scope? Does your action use 'scope=session' or are you doing a 'request.getSession().setAttribute(cr,cr);' in the first action? Regards, David -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:25 PM To: Struts Users Mailing List Subject: RE: How To Output the Value of a String That Is Passed From Another JSP? Hi, my JSP#1 and JSP#2 use different forms. However, property name in JSP#1 is the same as that in JSP#2. I tried to pass this Sring and write it out in a text field in JSP#2 and just could not get it right. I got this error message: [ServletException in:/article/content/postForm.jsp] Cannot find bean cr in scope session' In my view.jsp, I put a String in a session object: html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ html:submitView/Send Messages/html:submit /html:form And in postForm.jsp, I tried to retrieve that String and write it out in a text field this way: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=%=author% size=82 maxlength=25 tabindex=1/ -Caroline --- Robert Taylor [EMAIL PROTECTED] wrote: There are a couple (3) ways to do it. 1. Have both JSP#1 and 2 use the same form then have the action that processes JSP#1 simply forward to JSP#2 and Struts will auto-populate the field. 2. Have the action that processes JSP#1 forward or redirect to JSP#2 whose form has the same property name. Place the create property value in the query string and Struts will auto-populate the form in JSP#2. 3. Have
RE: How To Output the Value of a String That Is Passed From Another JSP?
Hi, thank you for your attention to my problem. First all, I think that I am missing someting. In order to use the c:set and c:out ... tags, I think that I have to import a taglib into my JSP and assign it with a prefix c. Which taglib should I import? Right now, I have these: %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-logic prefix=logic % %@ taglib uri=/tags/tiles prefix=tiles % %@ taglib uri=/tags/request prefix=req % You are missing this one: %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % Second, html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ c:out value=${cr}/ html:submitView/Send Messages/html:submit /html:form %-- The statement below has no problem to write on the value --% bean:write name=articleForm property=creator/ That's because you were missing the JSTL taglib directive above. Third, the mapping to the next JSP is: action roles=administrator,editor,contributor path=/list/Message forward=.message.Form name=postForm scope=session validate=false/ Why are you defining an action path at all. Once you add the JSTL taglib directive the following line places the value in the session. There is no need to submit. c:set var=cr value=${articleForm.creator} scope=session/ Fourth, in the postForm.jsp, I try to retrieve the value of the String that is passed in a session object and print it out in a text field: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=%=author% size=82 maxlength=25 tabindex=1/ You could use Struts-EL and do something like: html_el:text property=creator value=${cr}/ The Struts-EL taglib and jar file can be found in the /contrib directory of the Struts distribution. Fifth, the error message is that cr cannot be found in the session scope. Once again, this is because the JSTL taglib directive is missing. -Caroline --- Robert Taylor [EMAIL PROTECTED] wrote: What exactly are you trying to accomplish? What's the high level view? If you can explain your intent, maybe we can suggest an easier way to accomplish your goal. Is articleForm associated with action mapping /list/Message? If so, then you could do something like: html:form action=/list/Message html:hidden property=creator/ html:submitView/Send Messages/html:submit /html:form This of course, assumes you have already populated creator in articleForm in some other action using the same form. The action with mapping /list/Message, which processes articleForm could do something like: MyForm articleForm = (MyForm) form; String creator = articleForm.getCreator(); request.getSession().setAttribute(creator, creator); return mapping.findForward(success); In JSP#2 you could do something like this: c:out value=${creator}/ robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:25 PM To: Struts Users Mailing List Subject: RE: How To Output the Value of a String That Is Passed From Another JSP? Hi, my JSP#1 and JSP#2 use different forms. However, property name in JSP#1 is the same as that in JSP#2. I tried to pass this Sring and write it out in a text field in JSP#2 and just could not get it right. I got this error message: [ServletException in:/article/content/postForm.jsp] Cannot find bean cr in scope session' In my view.jsp, I put a String in a session object: html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ html:submitView/Send Messages/html:submit /html:form And in postForm.jsp, I tried to retrieve that String and write it out in a text field this way: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=%=author% size=82 maxlength=25 tabindex=1/ -Caroline --- Robert Taylor [EMAIL PROTECTED] wrote: There are a couple (3) ways to do it. 1. Have both JSP#1 and 2 use the same form then have the action that processes JSP#1 simply forward to JSP#2 and Struts will auto-populate the field. 2. Have the action that processes JSP#1 forward or redirect to JSP#2 whose form has the same property name. Place the create property value in the query string and Struts will auto-populate the form in JSP#2. 3. Have the action that processes JSP#1 access and populate the form used in JSP#2 with the property then forward to JSP#2. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 8
RE: Help needed in form beans
You may want to consider creating a separate object to hold these values in the session and use your form beans for data input. This way you can decide when to populate your form beans with the data that you've captured in the session. To control when reset() affects my form properties I subclassed the action form and subclassed ActionMapping to add an isReset() setReset(boolean reset) methods so I can declaratively define when reset is to be used by adding the following line in my struts-config file: set-property property=reset value=false/ robert -Original Message- From: vasudevrao gupta [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 12:30 AM To: 'Struts Users Mailing List' Subject: Help needed in form beans Hi All, I have a same form bean for 5 JSP's(JSP1,JSP2,JSP3,JSP4,JSP5) All the JSP's use the same form bean.I am keeping the form bean in the session scope. When ever I use JSP1, JSP3, I want to see the blank screen even if there are some values in the formbean. But, in other JSP's, I want to see the screen with prepopulated values. I tried using reset() for this and I have set all the values in formbean to null.But reset is getting called for all the action.I want reset to be called only for JSP1,JSP3. Please provide any direction on this Regards VasudevRaoGupta Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - 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: html:select default value problem
Try this: html:select property=status html:option value=00 - INACTIVE/html:option html:option value=11 - ACTIVE/html:option /html:select The regular HTML option/ element doesn't communicate with Struts. You need to use html:option / robert -Original Message- From: Keith C. Klopfer [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 6:12 AM To: [EMAIL PROTECTED] Subject: html:select default value problem Hi, I know this has been talked about before, and I'm pretty sure I understand the concept, but I don't know why this is not working. The default option for an html:select is not being displayed. I have an ActionForm in request scope called BusinessForm that is populated. The status property has a value of 1 as verified by sticking in a bean:write, but the select list shows the value=0 option as the default item when I load the page. I have twelve other html elements on the page, and they all show the correct defaults, except for this html:select. Am I not seeing something in the code below... thanks...keith --- html:form action=action.do scope=request name=BusinessForm type=BusinessForm !-- to verify the value of the status property (it displays 1) -- bean:write name=BusinessForm property=status / html:select property=status option value=00 - INACTIVE/option option value=11 - ACTIVE/option /html:select ... /html:form - 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: logic:iterate inside a logic:iterate ??
logic:iterate id=document name=formName property=documents logic:iterate id=lv name=document property=labelValueBeans bean:write name=lv property=label/ bean:write name=lv property=value/ /logic:iterate /logic:iterate You should probably use JSTL for this. c:forEach var=document items=${formName.documents} c:forEach var=lv items=${document.lableValueBeans} c:out value=${lv.label}/ c:out value=${lv.value}/ /c:forEach /c:forEach -Original Message- From: gentyjp [mailto:[EMAIL PROTECTED] Sent: Thursday, December 18, 2003 12:16 PM To: [EMAIL PROTECTED] Subject: logic:iterate inside a logic:iterate ?? Hi I'am a Struts newbie, sorry if it is a classic question. My question is about logic:iterate I have a vector of documents. In my application a document is a vector of LabelValueBean. I wish to write both the label and the value. I wish to write all my documents so I iterate through my vector of documents. But after that how can I iterate through my vector of LabelValueBean ??? Basically here's what I want to do : for_each_document { for_each_LabelValueBean_in_the_current_document { write LabelValueBean.Label; write LabelValueBean.Value; } } thanks for you help Genty Jean-Paul - 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: How To Output the Value Of a Hidden Field?
There are a couple (3) ways to do it. 1. Have both JSP#1 and 2 use the same form then have the action that processes JSP#1 simply forward to JSP#2 and Struts will auto-populate the field. 2. Have the action that processes JSP#1 forward or redirect to JSP#2 whose form has the same property name. Place the create property value in the query string and Struts will auto-populate the form in JSP#2. 3. Have the action that processes JSP#1 access and populate the form used in JSP#2 with the property then forward to JSP#2. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 8:33 PM To: [EMAIL PROTECTED] Subject: How To Output the Value Of a Hidden Field? My JSP #2 receives a hidden field passed from JSP #1: html:hidden property=creator/ In the JSP #2, I have a text field: html:text property=creator size=82 maxlength=25 tabindex=1/ and I want the value of the hidden field to be the text in the text field of the JSP #2. Please advise how to do it? __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - 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: Newbie: java.lang.boolean and DynaActionForm?
To address the fundemental question, it is considered a best practice to only use String or Boolean objects or collections of String and/or Boolean objects or collection of data structures which contain String and/or Boolean objects in your forms. This is because it gives you more control over validation. This doesn't mean that DynaActionForms or any DynaForm for that matter doesn't support non-string types. It supports any Object because essentially the DynaXXXForms internal data structure is a Map. In general the Struts form should be a ValueObject passing immutable data from the input to be processed or passing immutable data to the output to be rendered. The great thing about Struts is that it gives you more than enough rope to use wisely or hang yourself :) robert -Original Message- From: Engbers, ir. J.B.O.M. [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 9:24 AM To: '[EMAIL PROTECTED]' Subject: Newbie: java.lang.boolean and DynaActionForm? Hi, Both 'Struts in Action' and 'Programming Jakarta Struts' state that ActionForms and DynaActionForms are nearly equivalent and the main advantage of using DynaActionForms is that you don't have to declare all the getters and setters. In DynaAction Forms each property can be of a (array of a) primitive types. Thanks to Pedro Salgado and Martin Gainty (see Retrieving boolean properties from a DynaActionForm on december 16), I partially succeeded in solving the first problem which only confronted me with the next problem :-( And while looking for a solution to that problem, I found a bugreport (23355) in which Craig states that 'Adding these (getInteger, getBoolean etc, Ben) would encourage a behavior that Struts discourages -- using non-String data types in a form bean.' Maybe that this explains why I have only found examples that use String-properties (which lead me to my first question: where can I find examples that use non_string properties?) but it leaves me with the more fundamental question: Why do DynaActionForms offer the possibility to declare non-String properties without supporting them? Should I avoid using DynaActionForms at all and use the DynaValidatorForm? Ben Engbers - 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: Problem
Did you include the Struts bean tag-lib directive? In other words if you view source, do you see bean:write name=statLine property=lineDate/ ? robert -Original Message- From: Shaun Roach [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 3:13 PM To: [EMAIL PROTECTED] Subject: Problem Hello, I have been using struts for awhile, but after I started a new project last week, I began having a problem with it. It seems like struts cannot find the getter methods in my beans. For instance, when I try the following jsp page: html:html logic:iterate id=statLine name=playerDisplay property=playerStats type=com.rototheory.beans.StatLine br bean:write name=statLine property=lineDate/ /logic:iterate /html:html Nothing is generated, ( suggesting that it didn't find the lineDate getter ). However, if I use the following code: html:html logic:iterate id=statLine name=playerDisplay property=playerStats type=com.rototheory.beans.StatLine br %= statLine.getLineDate() % /logic:iterate /html:html The correct output is generated. I am having similar problems with struts finding collections that I am trying to iterate over. Does anyone have any idea of what might be causing the struts to not find my bean's getters? Thanks for your help, Shaun Roach - 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: How To Output the Value of a String That Is Passed From Another JSP?
What exactly are you trying to accomplish? What's the high level view? If you can explain your intent, maybe we can suggest an easier way to accomplish your goal. Is articleForm associated with action mapping /list/Message? If so, then you could do something like: html:form action=/list/Message html:hidden property=creator/ html:submitView/Send Messages/html:submit /html:form This of course, assumes you have already populated creator in articleForm in some other action using the same form. The action with mapping /list/Message, which processes articleForm could do something like: MyForm articleForm = (MyForm) form; String creator = articleForm.getCreator(); request.getSession().setAttribute(creator, creator); return mapping.findForward(success); In JSP#2 you could do something like this: c:out value=${creator}/ robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:25 PM To: Struts Users Mailing List Subject: RE: How To Output the Value of a String That Is Passed From Another JSP? Hi, my JSP#1 and JSP#2 use different forms. However, property name in JSP#1 is the same as that in JSP#2. I tried to pass this Sring and write it out in a text field in JSP#2 and just could not get it right. I got this error message: [ServletException in:/article/content/postForm.jsp] Cannot find bean cr in scope session' In my view.jsp, I put a String in a session object: html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ html:submitView/Send Messages/html:submit /html:form And in postForm.jsp, I tried to retrieve that String and write it out in a text field this way: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=%=author% size=82 maxlength=25 tabindex=1/ -Caroline --- Robert Taylor [EMAIL PROTECTED] wrote: There are a couple (3) ways to do it. 1. Have both JSP#1 and 2 use the same form then have the action that processes JSP#1 simply forward to JSP#2 and Struts will auto-populate the field. 2. Have the action that processes JSP#1 forward or redirect to JSP#2 whose form has the same property name. Place the create property value in the query string and Struts will auto-populate the form in JSP#2. 3. Have the action that processes JSP#1 access and populate the form used in JSP#2 with the property then forward to JSP#2. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 8:33 PM To: [EMAIL PROTECTED] Subject: How To Output the Value Of a Hidden Field? My JSP #2 receives a hidden field passed from JSP #1: html:hidden property=creator/ In the JSP #2, I have a text field: html:text property=creator size=82 maxlength=25 tabindex=1/ and I want the value of the hidden field to be the text in the text field of the JSP #2. Please advise how to do it? __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - 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] __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - 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: How To Output the Value of a String That Is Passed From Another JSP?
Are you sure that c:set var=cr value=${articleForm.creator} scope=session/ is placing the value in the intended scope? Try doing this: html:form action=/list/Message c:set var=cr value=${articleForm.creator}scope=session/ c:out value=${cr}/ html:submitView/Send Messages/html:submit /html:form To make sure it is actually putting the value in session scope. If so, then on postForm.jsp try using scriplets to make sure that the value can be accessed. If it can, then do you have all of your tag library directives in your pages? robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:40 PM To: Struts Users Mailing List Subject: RE: How To Output the Value of a String That Is Passed From Another JSP? cr is not a form and there is no action involved. There are two JSPs; view.jsp and postForm.jsp and each is with its own form (different forms). In my view.jsp, I am able to write out String creator this way: bean:write name=articleForm property=creator/ and I put the String creator in a session object: html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ html:submitView/Send Messages/html:submit /html:form and in the postForm.jsp, I retrieve the String and try to write it out in a text field: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=%=author% size=82 maxlength=25 tabindex=1/ I got this error message: ServletException in:/article/content/postForm.jsp] Cannot find bean cr in scope session' -Caroline --- David Friedman [EMAIL PROTECTED] wrote: Caroline, How do you save the form cr in session scope? Does your action use 'scope=session' or are you doing a 'request.getSession().setAttribute(cr,cr);' in the first action? Regards, David -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 17, 2003 8:25 PM To: Struts Users Mailing List Subject: RE: How To Output the Value of a String That Is Passed From Another JSP? Hi, my JSP#1 and JSP#2 use different forms. However, property name in JSP#1 is the same as that in JSP#2. I tried to pass this Sring and write it out in a text field in JSP#2 and just could not get it right. I got this error message: [ServletException in:/article/content/postForm.jsp] Cannot find bean cr in scope session' In my view.jsp, I put a String in a session object: html:form action=/list/Message c:set var=cr value=${articleForm.creator} scope=session/ html:submitView/Send Messages/html:submit /html:form And in postForm.jsp, I tried to retrieve that String and write it out in a text field this way: bean:define id=author name=cr scope=session type=java.lang.String/ html:text property=creator value=%=author% size=82 maxlength=25 tabindex=1/ -Caroline --- Robert Taylor [EMAIL PROTECTED] wrote: There are a couple (3) ways to do it. 1. Have both JSP#1 and 2 use the same form then have the action that processes JSP#1 simply forward to JSP#2 and Struts will auto-populate the field. 2. Have the action that processes JSP#1 forward or redirect to JSP#2 whose form has the same property name. Place the create property value in the query string and Struts will auto-populate the form in JSP#2. 3. Have the action that processes JSP#1 access and populate the form used in JSP#2 with the property then forward to JSP#2. robert -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 16, 2003 8:33 PM To: [EMAIL PROTECTED] Subject: How To Output the Value Of a Hidden Field? My JSP #2 receives a hidden field passed from JSP #1: html:hidden property=creator/ In the JSP #2, I have a text field: html:text property=creator size=82 maxlength=25 tabindex=1/ and I want the value of the hidden field to be the text in the text field of the JSP #2. Please advise how to do it? __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - 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] __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - To unsubscribe, e-mail: [EMAIL
RE: Commons validation framework and struts
The attachment didn't come through. robert -Original Message- From: Abhishek Srivastava [mailto:[EMAIL PROTECTED] Sent: Monday, December 15, 2003 12:31 AM To: 'Struts Users Mailing List' Subject: RE: Commons validation framework and struts Hello Robert, Yes. I have also defined the validator plugin in my struts-config.xml file. I am attaching my example code here. Please tell me why it is not working. Thanks for your help and patience. Regards, Abhishek. -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 8:21 PM To: Struts Users Mailing List Subject: RE: Commons validation framework and struts Your field names aren't the same. operator1 != operand1 operator2 != operand2 They must be the same or validation on those fields won't occur. robert -Original Message- From: Abhishek Srivastava [mailto:[EMAIL PROTECTED] Sent: Friday, December 12, 2003 9:35 AM To: [EMAIL PROTECTED] Subject: Commons validation framework and struts Hello All, I am trying to learn the new validation framework provided with struts 1.1 and am facing a few problems. I have a form object which I have derived from ValidatorForm class. In this form I have fields like operator1, operator2. I have created a file called validation.xml where I have made entries like form-validation formset form name='calcForm' field name='operand1' depends='required' /field field name='operand2' depends='required' /field /form /formset /form-validation The entry for action in my struts config is action path='/calc' type='com.abhi.CalcAction' scope='request' name='calcForm' parameter='action' input='/calc.jsp' validate='true' forward name='success2' path='/calc.jsp' / /action form-bean name=calcForm type=com.abhi.CalcForm / The application is working fine. Except that when I leave the fields operator1 or operator2 empty then no error is reported. Is there some step which I have missed out? Please help me out. Regards, Abhishek. - 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]