We have a struts application where we use struts-menu (just upgraded from 2.3 to 2.4.1—went pretty seamless once I got the right collections jar). 

 

The repository for each user is generated dynamically.  The menu is used in a form to allow the user to select preferences—the menu items are checkboxes.  Works very nicely.

 

Currently, I place the repository in a request attribute (‘reqRepository’) and then set the ‘repository=”reqRepository”’ parameter in the useMenuRepository taglib.  That also has been working.

 

Here’s the problem.  I am moving from a homegrown form validation mechanism to the standard struts validator.  The problem is that if there is an error on the form, then the form is redisplayed.  However, since the repository is in the request context, it is gone if the form needs to be redisplayed with form validation error messages (and hence the taglib throws an exception since it can’t find the repository and the jsp page generation terminates prematurely).  I’d prefer not putting the repository in the session context as then I have to worry about getting rid of it.

 

I thought the solution might be to make the repository another field in the struts ActionForm since the validator seems to keep the form intact even though it’s a request object.  But, I if I write ‘repository=”{myForm.myRepository}”, then it doesn’t work (presumably, because the taglib is looking for an attribute name).  

 

Is there a way to accomplish what I want without putting the repository in the session context?

 

Scott

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
struts-menu-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/struts-menu-user

Reply via email to