|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Bean Properties are lostI have a User Object that I am using as a Bean in an Action.
User Object has following properties – firstName lastName username password collection roles<Role> projects<Project> Roles data is no where displayed on the JSP page. Project data is displayed but I am using the plain ids to render the select tag. In the jsp the firstName, lastName, username, password properties are mapped to user.firstName….and likewise. I have separate List<Long>projectIds variable defined in the action class to get the selected projects ids. After editing the user information when the form is submitted, I am getting the firstName, lastName, username, password back in the user object but I am loosing the roles and projects data populated in the User object before rendering the page. What is going wrong? Or is this the correct behavior? In order to retain the collection values, what logic do I need to add? Thanks! P.S. A non struts related issue - whenever I am trying to send out an email to the user group, my email is bouncing back and the error is - Your message did not reach some or all of the intended recipients. Subject: Bean Properties are lost Sent: 12/19/2008 5:12 PM The following recipient(s) cannot be reached: Struts Users Mailing List on 12/19/2008 5:13 PM There was a SMTP communication problem with the recipient's email server. Please contact your system administrator. <(my company's email server) #5.5.0 smtp;552 spam score (7.5) exceeded threshold> |
|
|
RE: Bean Properties are lostMake sure you're putting everything in your jsp. If the field doesn't need to be displayed, use the <s:hidden.../> tag. The problem is with your internal mail server. Your company's spam filter is viewing your email as spam; whether it be the destination or content in your message, I don't know. See if they can add the destination to the whitelist (acceptable list). Beez ( 4961 -----Original Message----- From: Richa Pandharikar [mailto:richa31@...] Sent: Friday, December 19, 2008 6:20 PM To: user@... Subject: Bean Properties are lost I have a User Object that I am using as a Bean in an Action. User Object has following properties - firstName lastName username password collection roles<Role> projects<Project> Roles data is no where displayed on the JSP page. Project data is displayed but I am using the plain ids to render the select tag. In the jsp the firstName, lastName, username, password properties are mapped to user.firstName....and likewise. I have separate List<Long>projectIds variable defined in the action class to get the selected projects ids. After editing the user information when the form is submitted, I am getting the firstName, lastName, username, password back in the user object but I am loosing the roles and projects data populated in the User object before rendering the page. What is going wrong? Or is this the correct behavior? In order to retain the collection values, what logic do I need to add? Thanks! P.S. A non struts related issue - whenever I am trying to send out an email to the user group, my email is bouncing back and the error is - Your message did not reach some or all of the intended recipients. Subject: Bean Properties are lost Sent: 12/19/2008 5:12 PM The following recipient(s) cannot be reached: Struts Users Mailing List on 12/19/2008 5:13 PM There was a SMTP communication problem with the recipient's email server. Please contact your system administrator. <(my company's email server) #5.5.0 smtp;552 spam score (7.5) exceeded threshold> -- View this message in context: http://www.nabble.com/Bean-Properties-are-lost-tp21099202p21099202.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: Bean Properties are lostKevin- if your scope is local that is the problem..the default scope is page *(so as soon as you switch page the variable is lost)* try a more comprehensive scope such as application instead Take a look at ScopeInterceptor to access the scoped atrributes http://struts.apache.org/2.x/docs/scope-interceptor.html Anyone ? Martin ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Subject: RE: Bean Properties are lost > Date: Mon, 22 Dec 2008 08:33:42 -0500 > From: Biesbrock.Kevin@... > To: user@... > CC: richa31@... > > > Make sure you're putting everything in your jsp. If the field doesn't > need to be displayed, use the <s:hidden.../> tag. > > The problem is with your internal mail server. Your company's spam > filter is viewing your email as spam; whether it be the destination or > content in your message, I don't know. See if they can add the > destination to the whitelist (acceptable list). > > Beez > ( 4961 > > -----Original Message----- > From: Richa Pandharikar [mailto:richa31@...] > Sent: Friday, December 19, 2008 6:20 PM > To: user@... > Subject: Bean Properties are lost > > > I have a User Object that I am using as a Bean in an Action. > > User Object has following properties - > > firstName > lastName > username > password > collection roles<Role> > projects<Project> > > > Roles data is no where displayed on the JSP page. Project data is > displayed but I am using the plain ids to render the select tag. In the > jsp the firstName, lastName, username, password properties are mapped to > user.firstName....and likewise. I have separate List<Long>projectIds > variable defined in the action class to get the selected projects ids. > > After editing the user information when the form is submitted, I am > getting the firstName, lastName, username, password back in the user > object but I am loosing the roles and projects data populated in the > User object before rendering the page. > > What is going wrong? Or is this the correct behavior? In order to retain > the collection values, what logic do I need to add? > > Thanks! > > P.S. A non struts related issue - whenever I am trying to send out an > email to the user group, my email is bouncing back and the error is - > > Your message did not reach some or all of the intended recipients. > > Subject: Bean Properties are lost > Sent: 12/19/2008 5:12 PM > > The following recipient(s) cannot be reached: > > Struts Users Mailing List on 12/19/2008 5:13 PM > There was a SMTP communication problem with the recipient's > email server. Please contact your system administrator. > <(my company's email server) #5.5.0 smtp;552 spam score > (7.5) exceeded threshold> > > > > -- > View this message in context: > http://www.nabble.com/Bean-Properties-are-lost-tp21099202p21099202.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > _________________________________________________________________ It’s the same Hotmail®. If by “same” you mean up to 70% faster. http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_122008 |
|
|
RE: Bean Properties are lostI had tried to set the collection as a hidden property, but then I was
getting "invalid value" error when I submit the form. Please not I do not have any validation rules configured for the hidden properties. - Richa -----Original Message----- From: Biesbrock, Kevin [mailto:Biesbrock.Kevin@...] Sent: Monday, December 22, 2008 7:34 AM To: Struts Users Mailing List Cc: Richa Pandharikar Subject: RE: Bean Properties are lost Make sure you're putting everything in your jsp. If the field doesn't need to be displayed, use the <s:hidden.../> tag. The problem is with your internal mail server. Your company's spam filter is viewing your email as spam; whether it be the destination or content in your message, I don't know. See if they can add the destination to the whitelist (acceptable list). Beez ( 4961 -----Original Message----- From: Richa Pandharikar [mailto:richa31@...] Sent: Friday, December 19, 2008 6:20 PM To: user@... Subject: Bean Properties are lost I have a User Object that I am using as a Bean in an Action. User Object has following properties - firstName lastName username password collection roles<Role> projects<Project> Roles data is no where displayed on the JSP page. Project data is displayed but I am using the plain ids to render the select tag. In the jsp the firstName, lastName, username, password properties are mapped to user.firstName....and likewise. I have separate List<Long>projectIds variable defined in the action class to get the selected projects ids. After editing the user information when the form is submitted, I am getting the firstName, lastName, username, password back in the user object but I am loosing the roles and projects data populated in the User object before rendering the page. What is going wrong? Or is this the correct behavior? In order to retain the collection values, what logic do I need to add? Thanks! P.S. A non struts related issue - whenever I am trying to send out an email to the user group, my email is bouncing back and the error is - Your message did not reach some or all of the intended recipients. Subject: Bean Properties are lost Sent: 12/19/2008 5:12 PM The following recipient(s) cannot be reached: Struts Users Mailing List on 12/19/2008 5:13 PM There was a SMTP communication problem with the recipient's email server. Please contact your system administrator. <(my company's email server) #5.5.0 smtp;552 spam score (7.5) exceeded threshold> -- View this message in context: http://www.nabble.com/Bean-Properties-are-lost-tp21099202p21099202.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: Bean Properties are lostI would guess, then, maybe chaining the actions or storing the
collections in a session variable. Another idea would be to make the collection a character delimited string and store that in a hidden input. Don't know what the best way is, though. I'm interested to know the most efficient way as well. Beez ( 4961 -----Original Message----- From: Richa Pandharikar [mailto:richa.pandharikar@...] Sent: Monday, December 22, 2008 12:21 PM To: 'Struts Users Mailing List' Subject: RE: Bean Properties are lost I had tried to set the collection as a hidden property, but then I was getting "invalid value" error when I submit the form. Please not I do not have any validation rules configured for the hidden properties. - Richa -----Original Message----- From: Biesbrock, Kevin [mailto:Biesbrock.Kevin@...] Sent: Monday, December 22, 2008 7:34 AM To: Struts Users Mailing List Cc: Richa Pandharikar Subject: RE: Bean Properties are lost Make sure you're putting everything in your jsp. If the field doesn't need to be displayed, use the <s:hidden.../> tag. The problem is with your internal mail server. Your company's spam filter is viewing your email as spam; whether it be the destination or content in your message, I don't know. See if they can add the destination to the whitelist (acceptable list). Beez ( 4961 -----Original Message----- From: Richa Pandharikar [mailto:richa31@...] Sent: Friday, December 19, 2008 6:20 PM To: user@... Subject: Bean Properties are lost I have a User Object that I am using as a Bean in an Action. User Object has following properties - firstName lastName username password collection roles<Role> projects<Project> Roles data is no where displayed on the JSP page. Project data is displayed but I am using the plain ids to render the select tag. In the jsp the firstName, lastName, username, password properties are mapped to user.firstName....and likewise. I have separate List<Long>projectIds variable defined in the action class to get the selected projects ids. After editing the user information when the form is submitted, I am getting the firstName, lastName, username, password back in the user object but I am loosing the roles and projects data populated in the User object before rendering the page. What is going wrong? Or is this the correct behavior? In order to retain the collection values, what logic do I need to add? Thanks! P.S. A non struts related issue - whenever I am trying to send out an email to the user group, my email is bouncing back and the error is - Your message did not reach some or all of the intended recipients. Subject: Bean Properties are lost Sent: 12/19/2008 5:12 PM The following recipient(s) cannot be reached: Struts Users Mailing List on 12/19/2008 5:13 PM There was a SMTP communication problem with the recipient's email server. Please contact your system administrator. <(my company's email server) #5.5.0 smtp;552 spam score (7.5) exceeded threshold> -- View this message in context: http://www.nabble.com/Bean-Properties-are-lost-tp21099202p21099202.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: Bean Properties are lostDave,
No inputs ??? -----Original Message----- From: Biesbrock, Kevin [mailto:Biesbrock.Kevin@...] Sent: Monday, December 22, 2008 12:23 PM To: Struts Users Mailing List Subject: RE: Bean Properties are lost I would guess, then, maybe chaining the actions or storing the collections in a session variable. Another idea would be to make the collection a character delimited string and store that in a hidden input. Don't know what the best way is, though. I'm interested to know the most efficient way as well. Beez ( 4961 -----Original Message----- From: Richa Pandharikar [mailto:richa.pandharikar@...] Sent: Monday, December 22, 2008 12:21 PM To: 'Struts Users Mailing List' Subject: RE: Bean Properties are lost I had tried to set the collection as a hidden property, but then I was getting "invalid value" error when I submit the form. Please not I do not have any validation rules configured for the hidden properties. - Richa -----Original Message----- From: Biesbrock, Kevin [mailto:Biesbrock.Kevin@...] Sent: Monday, December 22, 2008 7:34 AM To: Struts Users Mailing List Cc: Richa Pandharikar Subject: RE: Bean Properties are lost Make sure you're putting everything in your jsp. If the field doesn't need to be displayed, use the <s:hidden.../> tag. The problem is with your internal mail server. Your company's spam filter is viewing your email as spam; whether it be the destination or content in your message, I don't know. See if they can add the destination to the whitelist (acceptable list). Beez ( 4961 -----Original Message----- From: Richa Pandharikar [mailto:richa31@...] Sent: Friday, December 19, 2008 6:20 PM To: user@... Subject: Bean Properties are lost I have a User Object that I am using as a Bean in an Action. User Object has following properties - firstName lastName username password collection roles<Role> projects<Project> Roles data is no where displayed on the JSP page. Project data is displayed but I am using the plain ids to render the select tag. In the jsp the firstName, lastName, username, password properties are mapped to user.firstName....and likewise. I have separate List<Long>projectIds variable defined in the action class to get the selected projects ids. After editing the user information when the form is submitted, I am getting the firstName, lastName, username, password back in the user object but I am loosing the roles and projects data populated in the User object before rendering the page. What is going wrong? Or is this the correct behavior? In order to retain the collection values, what logic do I need to add? Thanks! P.S. A non struts related issue - whenever I am trying to send out an email to the user group, my email is bouncing back and the error is - Your message did not reach some or all of the intended recipients. Subject: Bean Properties are lost Sent: 12/19/2008 5:12 PM The following recipient(s) cannot be reached: Struts Users Mailing List on 12/19/2008 5:13 PM There was a SMTP communication problem with the recipient's email server. Please contact your system administrator. <(my company's email server) #5.5.0 smtp;552 spam score (7.5) exceeded threshold> -- View this message in context: http://www.nabble.com/Bean-Properties-are-lost-tp21099202p21099202.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: Bean Properties are lostThis is a fairly common issue. I don't have time right now but if no one shows you I can show you tonight. It is a combination of type conversion and the prepare filter depending on your requirements. If you want to try to figure it out on your own in the meantime, look at the type conversion docs for collections.
|
|
|
RE: Bean Properties are lostIf you do not need to edit the collections as part of the "post" transaction then you can use the ParamsPrepareParams interceptor pattern. Basically, this lets you edit part of a model object without having to recreate the whole thing in your form. The basic pattern is to put the id in a hidden field and then to implement Preparable in your Action. You use the prepare() or the prepareXXX() to pre-populate your action's model from the database, including collections and other relationships that are hard to duplicate in the form. Then when Struts2 applys the parameters from your post it will only update the fields you submitted and leave the original values in place for when you save.
If you want to edit the list, that is a different if not as frequent pattern. In this case, you want to be able to add/remove relationships to your model without having to save the model each time. You want all of your changes to post when the user clicks Save. This allows the user to click Cancel or leave the page (even accidentally) without getting your models in a weird state. To do this you need to create the text fields that represent the bean's properties. The fields don't have to be hidden, but hopefully they are just scalar values and not additional relationships or else things get complicated, but not impossible. You need to name your fields with a convention similar to model.collection[%{row.index}].propertyname, where row is the status of your iterator. You can use index or count, index is 0 based and count is 1 based. If this bean in the collection has already been persisted then you want to include its ID as well. Finally, you need to make an entry in your -conversion.properties file for the action that tells Struts2 what kind of beans are in your collection so it knows what to create. You can look that up under Type Conversion docs. These are all for where your model has a one to many relationships. When there is a one-to-one or many-to-one in your interface, and the end result is selecting a single bean for the relationship, you can use Type Conversion. The string representation of your bean is its id and then you can use that in the type converter to look it up from the database and put the actual full bean in the model's property.
|
| Free embeddable forum powered by Nabble | Forum Help |