newbie question

I want to tie a control in java server faces to some data. The way I've typically seen it done is you create a java class to store some data and create a property in the session bean that you can bind the control to.

The problem with this is that then the bean you are using has to be serializable... is there a way to store things that can be bound to a control that are not serializable?

I realize this is probably a very stupid question but I'm on a crazy tight schedule and have to get some things working very fast. I do have a non-serializable object being stored in the session now and it seems the only side effect is when I restart my server (tomcat5.5) I occasionally get a non-serializable error - apparently it's trying to restore a persisted session.

[787 byte] By [kregan77a] at [2007-10-3 1:25:32]
# 1

this is really a tomcat problem (kinda) - there is a setting that disables session persistence during shutdown of tomcat so it can't try to reinitialize the sessions on restart - I seem to remember that doing this has some affect over session sharing acros farms - but alas the whole topic eludes the brain - doing something like below will disable the feature -

<Manager class="org.apache.catalina.session.StandardManager "

path="/some invalid path"/>

maybe that would be the way to go if you don't require sessions to be restored during a restart - what you have described in terms of the session bean sounds correct though.

paroconsulta at 2007-7-14 18:22:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Thanks for the response... I'll look into turning off that feature...

However, in the greater context of things I'm finding that any time I want to have a component on a page chagne values the only way to get it to work is by binding the component to some data in a session... e.g.

if I have an image component and

image1.setURL(someURL); in the page code liek when a button is pressed or on the init function it doesn't work... I get nothing in the image.... it only works if I tie it to a property in the session bean that i set...

This seems to imply that a lot of **** will end up in the session bean which when you think about scalability may be an issue.

I'm assuming the application bean persists across sessions so that would not really be a logical place to put things either.

What am I missing here? (if anything)

kregan77a at 2007-7-14 18:22:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

you aren't missing a thing- this is the way you maintain state in jsf. alternatively though if its only changes are required i.e. a button gets pressed - change the url or an image and maintaining state is not the requirement - you could deploy an valueChangeListener to trigger off of the button and change the url - or use a bean method (using request as scope meaning the bean will disappear across requests) that looks at the request parameters and then makes the decision about what url is to be set for the image - and of course you could just write some javascript ;-)

paroconsulta at 2007-7-14 18:22:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...