If you do use Java serialization, use XMLEncoder -- there are a lot of headaches involved in serializing to the binary format if your classes' APIs change -- or rather, in deserializing, since without your efforts, beans serialized with one version of a class will not deserialize with a revised version of that class.I was thinking to deserialize the java bean on login and I will have to in order to build the sub menu. I felt I shouldn't keep the bean around as it may be large containing several pages of content and too heavy for the session. So I would have to retrieve the bean on each content request, might not be that slow... have to test?
If XMLEncoder doesn't work for you, there are a few automated XML binding tools, like jakarta-commons-betwixt, Castor, and Enhydra Zeus. All should dodge that problem with deserializing beans as long as you only extend your API and don't remove anything.
How dynamic is your content? If it's just a matter of hiding and showing various values, then you could just use logic tags to control that based on data in your user profile bean. That would minimize some of the management issues.
If users basically get to create bookmarks (arbitrary links and link titles) in your app, I guess you don't have much choice than to create one or more files. You'd have to weigh the benefits of reading in the file each time and storing it in request scope vs. reading it in once and storing it in your session. I'd avoid bloating the session myself. I don't know how fast all that file access would be, but it's probably not much slower than the common alternative of making a network call to a database.
Is the flat file requirement for readability/manual editing? Or just to save money on a database? If it's the latter, you might be able to use RandomAccessFile to manage all this user data. You'd probably want to be careful about opening a file handle and sticking that in the session, though, just because you'd never really know when to clean it up...
You may also want to consider portal-oriented software systems which may provide a better framework for the degree of user customization you need. There's Jakarta Jetspeed, <http://jakarta.apache.org/jetspeed/> which is pretty well developed, but based on Turbine instead of Struts, and Vic C. has been leading a Struts portal project on sourceforge. <http://basicportal.sourceforge.net/ > Just to keep your options open...
Joe
Greg-----Original Message----- From: David Graham [mailto:dgraham1980@;hotmail.com] Sent: Wednesday, October 23, 2002 11:00 AM To: [EMAIL PROTECTED] Subject: Re: Managing User defined Web Content design advice? The java bean idea sounds good. The problem you might have with using message resources is that you can't reload it when the users change their settings. Also, I wouldn't want that kind of churn on the file. You could deserialize the java bean when the user logs in and then use that in the menu display jsp to generate the links. DavidFrom: "Greg Hess" <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Mail List" <[EMAIL PROTECTED]> Subject: Managing User defined Web Content design advice? Date: Wed, 23 Oct 2002 10:54:00 -0400 Hi All, I am developing a hosted ecommerce app. One of the requirements is that the client's have the ability to customize sub menu navigation providing the link name and link content. I am considering several possibilities of persistency and tags that might help me do this. I would like to take advantage of Struts features if it would benefit the app i.e.: MessageResources to hold the custom content. One of my main concerns is speed and not overloading the session with loads of content. I know I have to store the content somewhere and the requirements state that I use a flat file or multiple flat files. Some of my ideas are>below and I would greatly appreciate any advice that you all might have.1) Serialize some java bean containing all the custom content and store in a file(maybe using XMLEncoder and Decoder, I like it :-) ) or properties file(why not use MessageResources?) and have an Action load the requested content and place the content String in the request and for ward to a reusable contentDisplay.jsp. 2) Create new files for each body of content and simply <jsp:include> or <bean:include> the page into the template. The problem here is that as the number of links and content is user defined and I only know how to use the include tags with static resources. Sure I could include an action but how would I dynamically add parameters to inform the include resource as to witch content to retrieve? I see that page param of bean:include is labeled (RT EXPR) does this mean that I can use an expression the provide that attribute, I have never been able to do this??? If I could do it in this manner I think it would be cleaner but obviously not sure how. Well those are my ideas, if anyone has done this before or could provide some advise on how this should be done it would be greatly appreciated. Many thanks, Greg_________________________________________________________________ Internet access plans that fit your lifestyle -- join MSN. http://resourcecenter.msn.com/access/plans/default.asp -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>
--
--
* Joe Germuska { [EMAIL PROTECTED] }
"It's pitiful, sometimes, if they've got it bad. Their eyes get glazed, they go white, their hands tremble.... As I watch them I often feel that a dope peddler is a gentleman compared with the man who sells records."
--Sam Goody, 1956
--
To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>