[Stripes-users] How to set default action (not a jsp) in web.xml?
Hi! I've set in web.xml the welcome file: welcome-file-list welcome-fileDefault.action/welcome-file /welcome-file-list So, i have a Default class in default package that has a @defaulthandler which forwards to my .jsp, but something goes wrong an server gives me 404 error code. How actually is correct to set the welcome action? -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] How to set default action (not a jsp) in web.xml?
If you are using Tomcat, you need to put a file named Default.action in every folder that you want your default action to be served. Hope it helps. -Mensaje original- De: Vadim [mailto:vadb...@gmail.com] Enviado el: martes, 10 de marzo de 2009 10:05 Para: stripes-users@lists.sourceforge.net Asunto: [Stripes-users] How to set default action (not a jsp) in web.xml? Hi! I've set in web.xml the welcome file: welcome-file-list welcome-fileDefault.action/welcome-file /welcome-file-list So, i have a Default class in default package that has a @defaulthandler which forwards to my .jsp, but something goes wrong an server gives me 404 error code. How actually is correct to set the welcome action? -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
[Stripes-users] welcome page
Hi everybody! How could i set the welcome page to be not a .jsp, but an action, dispatched by the stripes dispatcher. I tried to do this: welcome-file-list welcome-file/Default.action/welcome-file /welcome-file-list so, i have in default package a Default class that implements ActionBean and has a default handler method, but it does not work :( -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] welcome page
Hi Vadim, I don't really understand why thous should not work, apart froom : 1/ your action isn't resolved from the classpath (default package might not be a good idea : you have to declare your action packages in the stripes filter config...) 2/ the request doesn't reach your action bean : maybe you have not mapped Stripes dispatcher to *.action in web.xml ? HTH Remi 2009/3/10 Vadim Vararu vadb...@gmail.com: Hi everybody! How could i set the welcome page to be not a .jsp, but an action, dispatched by the stripes dispatcher. I tried to do this: welcome-file-list welcome-file/Default.action/welcome-file /welcome-file-list so, i have in default package a Default class that implements ActionBean and has a default handler method, but it does not work :( -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
[Stripes-users] Stripes Book Example Issue
On page 317 there is an example of adding role checkboxes to a list of users. Next to each user, the JSP adds a User and Administrator checkbox where you can select roles for the user. Then, at the bottom of the screen, there's a submit button to update all of the user roles in the list. * UserListActionBean.java:* public class UserListActionBean extends BaseActionBean { private ListUser users = userDao.read(); private ListUser getUsers() { return users; } public ListRole getRoles() { return roleDao.read(); } public Resolution save() { for( User user : users ) { userDao.save(user); } userDao.commit(); } } * user_list.jsp:* c:set var=index value=0/ s:form displaytag:table name=${actionBean.users} id=user / ... displaytag:column c:forEach var=role items=${actionBean.roles} s:checkbox name=users[${index}].roles value=${role} checked=${user.roles} /c:forEach c:set var=index value=${index+1}/ /displaytag:column ... /displaytag:table s:submit name=save/ /s:form Now, the issue I have with this is what happens if the user list changes before the user presses submit? The indexes assigined in users[${index}].roles might no longer refer to the correct user. How would you go about actually building something like this? The best solution I can think of would be to define a MapString,ListRoles userRolesMap in the action bean. Then, in the table I would set the checkbox name to: userRolesMap['${user.id}'] Finally, to update the roles when the user presses save, loop through the users, and check to see if the userRolesMap contains the user's id - if it does assign the user roles and update the user. Does anyone else have any better solutions to solve this? Thanks! -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Book Example Issue
On 10-03-2009 at 11:02, Seth Duda wrote: Now, the issue I have with this is what happens if the user list changes before the user presses submit? The indexes assigined in users[${index}].roles might no longer refer to the correct user. How would you go about actually building something like this? I usually build such a page around a table that changes the least, i.e. I'd assign roles to users instead of users to roles. As the roles table hardly ever changes, this will work better. Although still not foolproof. Oscar -- ,-_ /() ) Oscar Westra van holthe - Kind http://www.xs4all.nl/~kindop/ (__ ( =/ () Don't let your boss fuck you; that's anti-capitalist. -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] Stripes Book Example Issue
When I have a form to edit multiple entities at once, I use indexed properties in a similar manner to this example. What I do not do is allow the list that I'm indexing into to be initialized before binding takes place, for exactly the reason you have pointed out. Instead, I always have a TypeConverter in place for the entity type that I'm editing, and in my iterator I place a hidden input that allows Stripes to get the entity from the TypeConverter and insert it into the list. Something like this: == JSP == s:form ... c:forEach var=entity varStatus=loop items=${actionBean.entities} s:hidden name=entities[${loop.index}] / s:text name=entities[${loop.index}].foo / ... /c:forEach /s:form == ActionBean == @ValidateNestedProperties({ ... }) private ListFoo entities; // plus getter setter @DontBind public Resolution view() { entities = getContext().getFooDao().list(); return new ForwardResolution(...); } public Resolution update() { if (entities != null) { for (Foo entity : entities) { if (entity != null) { getContext().getFooDao().save(entity); } } } return new RedirectResolution(...); } In my ActionBean, I only initialize the list when I'm forwarding to the form, not when handling the form submission. And just to be safe, I disable binding altogether for the view() method. In my JSP, I include a hidden input for each iteration in the loop so that Stripes will bind the correct entity into the list on form submission. -Ben On Tue, Mar 10, 2009 at 11:02 AM, Seth Duda sethd...@gmail.com wrote: On page 317 there is an example of adding role checkboxes to a list of users. Next to each user, the JSP adds a User and Administrator checkbox where you can select roles for the user. Then, at the bottom of the screen, there's a submit button to update all of the user roles in the list. * UserListActionBean.java:* public class UserListActionBean extends BaseActionBean { private ListUser users = userDao.read(); private ListUser getUsers() { return users; } public ListRole getRoles() { return roleDao.read(); } public Resolution save() { for( User user : users ) { userDao.save(user); } userDao.commit(); } } * user_list.jsp:* c:set var=index value=0/ s:form displaytag:table name=${actionBean.users} id=user / ... displaytag:column c:forEach var=role items=${actionBean.roles} s:checkbox name=users[${index}].roles value=${role} checked=${user.roles} /c:forEach c:set var=index value=${index+1}/ /displaytag:column ... /displaytag:table s:submit name=save/ /s:form Now, the issue I have with this is what happens if the user list changes before the user presses submit? The indexes assigined in users[${index}].roles might no longer refer to the correct user. How would you go about actually building something like this? The best solution I can think of would be to define a MapString,ListRoles userRolesMap in the action bean. Then, in the table I would set the checkbox name to: userRolesMap['${user.id}'] Finally, to update the roles when the user presses save, loop through the users, and check to see if the userRolesMap contains the user's id - if it does assign the user roles and update the user. Does anyone else have any better solutions to solve this? Thanks! -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users
Re: [Stripes-users] welcome page
I agree with Remi. On Tue, Mar 10, 2009 at 6:50 PM, VANKEISBELCK Remi r...@rvkb.com wrote: Hi Vadim, I don't really understand why thous should not work, apart froom : 1/ your action isn't resolved from the classpath (default package might not be a good idea : you have to declare your action packages in the stripes filter config...) 2/ the request doesn't reach your action bean : maybe you have not mapped Stripes dispatcher to *.action in web.xml ? HTH Remi 2009/3/10 Vadim Vararu vadb...@gmail.com: Hi everybody! How could i set the welcome page to be not a .jsp, but an action, dispatched by the stripes dispatcher. I tried to do this: welcome-file-list welcome-file/Default.action/welcome-file /welcome-file-list so, i have in default package a Default class that implements ActionBean and has a default handler method, but it does not work :( -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- ___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___ Stripes-users mailing list Stripes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stripes-users