Re: Autocomplete attribute in Struts tags
Thanks, I will add that to my cheat sheet on html. Al Asthana, Rahul wrote: "I think the original question was how to *avoid *displaying previous information that was entered by a previous user, I believe." Thats what I meant.Extend the tag to support autocomplete attribute and set it to "off". -Original Message- From: Albert L Sapp [mailto:[EMAIL PROTECTED] Sent: Monday, December 04, 2006 4:12 PM To: Struts Users Mailing List Subject: Re: Autocomplete attribute in Struts tags I think the original question was how to *avoid *displaying previous information that was entered by a previous user, I believe. Firefox does retain form field information to "help" the user enter information in the field the next time they use the form. If, however, more than one user makes use of the browser there is a possibility of the next user gaining access to that previously entered information. Short of disabling the feature in the browser options, I am not sure of any way to keep this from happening. But then, I am very much a novice at forms and browsers. Al Asthana, Rahul wrote: Extend html:text to support "autocomplete"? -Original Message- From: grifoxx [mailto:[EMAIL PROTECTED] Sent: Monday, December 04, 2006 3:43 PM To: user@struts.apache.org Subject: Autocomplete attribute in Struts tags Hi I am developing a web application that allow the user to make online payments, so my question is: How can avoid the browser to redisplay or autocomplete an input when a user type in. For instance in firefox the user can see what other users typed before. I know that the html:text or any other struts tag does not use this attribute but there must be a way to do this because this kind of information is very important to show it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Autocomplete attribute in Struts tags
I think the original question was how to *avoid *displaying previous information that was entered by a previous user, I believe. Firefox does retain form field information to "help" the user enter information in the field the next time they use the form. If, however, more than one user makes use of the browser there is a possibility of the next user gaining access to that previously entered information. Short of disabling the feature in the browser options, I am not sure of any way to keep this from happening. But then, I am very much a novice at forms and browsers. Al Asthana, Rahul wrote: Extend html:text to support "autocomplete"? -Original Message- From: grifoxx [mailto:[EMAIL PROTECTED] Sent: Monday, December 04, 2006 3:43 PM To: user@struts.apache.org Subject: Autocomplete attribute in Struts tags Hi I am developing a web application that allow the user to make online payments, so my question is: How can avoid the browser to redisplay or autocomplete an input when a user type in. For instance in firefox the user can see what other users typed before. I know that the html:text or any other struts tag does not use this attribute but there must be a way to do this because this kind of information is very important to show it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Very basic question on formbeans
Jim, Basically, that is how our application is set up. There are transfer object beans that handle the movement between our controller layer and model and form beans for moving data between the view and controller layer. Sometimes, the TO and form bean may be exact matches and other times I may have additional fields of computed data that is needed in the form bean. Just my 2 cents. Al Gallagher, Jim (RBoS ITD&S Dublin) wrote: Hi, I've designed & written a couple of struts applications up to now, and recently the solution to a problem has caused me to wonder if I'm making a fundamental error in the way I've been doing it. Up to now, when designing a jsp I've only used the formbean to collect the information entered, rather than to pass it to the jsp in the first place. I'm wondering whether it's a better idea to create the formbean, populate it and use that to pass the information to the jsp? I can see there might be some MVC benefits, but I'd be interested in other peoples' opinions. Apologies if this is blindingly obvious, but I'm keen to determine the best way of utilising struts. Regards, Jim Jim Gallagher, New BACS Team, Domestic Payments, Payments, Security & Fraud, Royal Bank of Scotland, Parkgate Business Park, Parkgate Street, Dublin 8. RBS Depot Code: DUB ITS:7-4171-7167 External: +353-1-648 7167 Internet mail: [EMAIL PROTECTED] The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB Authorised and regulated by the Financial Services Authority. This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FRIDAY #1 JavaBeans/Model
+1 Al Larry Meadors wrote: On 10/6/06, Ivo Limmen <[EMAIL PROTECTED]> wrote: iBATIS is only a small helper tool that will help you to map objects to the database. This requires a lot of code to write. If you use Hibernate you can write the mapping and generate your beans. Hibernate does however require some practice, it has a steep learning curve. I have to disagree. :-) Remember, iBATIS is *not* an ORM tool. It does not map your database to your object model. IMO, this is a good thing: Database design and object model design have different goals, so a tool that makes it possible to more flexibly map data to objects adds a great deal of value. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FRIDAY #1 JavaBeans/Model
Wesley Wannemacher wrote: Hello, I am not really a Java Guru, but have made the experience that in effect the name "Bean" is - in the context of Struts-based Webapps - really nothing more than a POJO following the naming conventions of JavaBeans for getters/setters. Awesome, thanks! I figured as much, but I hate to assume. With respect to the "middle layer", it really pays off to separate "model", "view", and "controller" and possibly separate the persistency layer from the model as well. So far, I have figured that much... It might help if I explain how I am currently planning to build my application and you can all tell me whether I am way off or if it is pretty close... First, I am going to design a database, then build a bunch of beans that more or less represent the data in the database by going mostly one bean for each table. There will likely be a few cases where one bean will represent two tables (1:n relationship, where the attributes in the 'many' table come as an array of objects when the getter is called). The persistence will happen as a method of each bean. Then, I'll build forms around the navigation of the site, and have a separate layer or objects that will build and persist the beans from above. This seems to be similar to the way we did ours. Each table has a POJO for passing data from the model layer to the controller layer. Then, a seperate set of POJOs (our action forms) for passing data from the controller to the jsp and back. These transfer objects do nothing but that. All they do is move data between the layers. Am I on the right track? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FRIDAY #1 JavaBeans/Model
Wesley, From personal experience, I know where you are coming from. I started out knowing even less about this than you. I will say though that it was fairly easy and quick to pick up both Struts and iBatis. The design standards were handed down from a project leader long gone before we even rolled out even the first basic modules, so I hope you have a little more flexibility to set your own. We use plain old java objects for our transfer objects between all 3 parts of the MVC for our application. JSP for our view, Struts for our controller and iBatis for our model. Our current design could probably benefit from a rethink, but we have not rolled out all of version 1 yet. We don't do much more beyond standard getters/setters in the POJOs. Some validation is done in the Struts validate and some in the actions before everything is turned over to our module managers which turn things over to the appropriate DAO and sql maps. Like I said, this is what I was handed and I don't know if we went overboard in abstraction or not. Just my 2 cents. Enjoy the ride. Al Wesley Wannemacher wrote: Hello, I'm exercising the 'Casual Friday' rule here to ask some general questions. I apologize in advance if I break any list etiquette, but I subscribed on Monday and have been waiting patiently for Friday so that I can get these questions off my chest. Thanks! I've been working on Java/JSP for a few years now and I recently decided to try out struts (better late than never). In the past, I would typically write a JDBC wrapper library to help me get to the database, then write all of my code with little abstraction from SQL code. Being a database guy as well, this made sense to me, and I could do quick easy things like a 'QueryToTables' tag that would allow me to paste SQL code right into a JSP and have the results of that query pasted nicely into the output. For updates, I would build the form I needed (using my own custom tags for input fields) and call into my JDBC wrapper to hit stored procedures. I picked up a copy of 'Struts Design and Programming: A Tutorial' and I am learning the details of the libraries, but I've never written a JavaBean (EJB or regular Bean). It seems that EJB isn't necessary, but that regular JavaBeans are used heavily elsewhere. So, I figured I would start trying to figure out smart JavaBean Design (I don't really want to have to refactor/redesign all of my core classes later when I'm more experienced). The problem I have though is that all the books I have laying around seem only to refer to plain ol' JavaBeans as GUI components. If I understand correctly, to make an object a JB, I really only have to have getters/setters for the properties I want to expose, but can I have other methods that do other stuff? What suggestions would you give someone who has never written a JavaBean before that is going to begin working from the ground up on a new project? I figured I would use iBATIS for database persistence, so I've been reading about that as well. I guess I'm just a bit paranoid about writing the 'middle layer' between struts and the SQL code/server, so any advice on gotchas and/or suggestions for struts-friendly 'middle layer' design would be much appreciated. -Wes -- Wes Wannemacher Double A Trailer Sales, Inc. [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forward to action without jsp
Andy, Following what you want to do. This may not be exact as I don't use a dispatcher, I don't think. jsp with edit button (In our case, we use a link with image (user.jsp). action="/user/preUpdateUser?userID=${userForm.userID}">pageKey="images.updateIcon" border="0"/> dispatcher? (struts-user-config.xml) type="*scs.reaction.struts.user.actions.user.PreUpdateUserAction*" name="userForm" input="/user/preUpdateUser" scope="request" validate="false" > path="/user/user/preUpdateUser.jsp"/> loadObject scs.reaction.struts.user.actions.user.PreUpdateUserAction editObject /user/user/preUpdateUser.jsp In jsp store in db type="scs.reaction.struts.user.actions.user.UpdateUserAction" name="userForm" input="/user/preUpdateUser" scope="request" validate="true" > path="/user/user/updateUser.jsp"/> redirect="yes"/> re-display updatedObject /user/user/updateUser.jsp Hth, Al Andy.de wrote: Hi Eric, your point 2. in my application is a button on a previous page (i have several buttons) The button is evaluated by an EventActionDispatcher and the according execute() forwards to the action to fill the bean. public ActionForward editObject(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { return mapping.findForward("loadObject"); } the loadObject action loads data from database and forwards to 'displayObject' action with jsp to show the object. But i found now way to configure struts-config for 'loadObject' jsp page -> button 'edit' pressed -> dispatcher -> editObject() -> ok up to this step -> forward to 'loadObject' how to do this? -> forward to jsp page to display object is ok and works I hope my problem is clear now. I can not understand why no sample with this daily problem exists, every application needs it. Regards, Andy Givler, Eric wrote: I'm not sure I understand what's wrong with this: 1. The load object from database is in the action's execute. 2. The menu choice is: Edit My Profile (for example), which invokes the action from #1 public ActionForward execute( ) throws ... { String userId = request.getParameter("userId"); UserProfile up = service.getProfile( userId ); BeanUtils.copyProperties( form, up ); return "success"; } 3. The user ends up on the profileEdit.jsp page with the data filled into the form bean. -Original Message- From: Andy.de [mailto:[EMAIL PROTECTED] Sent: Thursday, September 28, 2006 10:07 AM To: user@struts.apache.org Subject: Re: Forward to action without jsp Wendy Smoak-3 wrote: On 9/28/06, Andy.de <[EMAIL PROTECTED]> wrote: how can i forward to an action without input (jsp) ? I'm not sure what you're asking. What do you want the user to be able to do? In general, any URL that maps to an Action will execute the action, whether or not there is any 'input' (request parameters from the form having been submitted, or in the URL itself.) -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Hi Wendy, i have an action 'load object from database', on execute() the form bean is filled with values from database. On success i want to forward to the jsp to display the object. The user can change the values and submit the jsp, the according 'save action' stores the changed object to database. This is the typicall way to populate and fill a form bean before the according jsp is shown. But i don't find a way to forward to my 'load object from database' action because this action has no input (no jsp) and the forward attribute of wants a jsp. What i need is instead of Regards Andy -- View this message in context: http://www.nabble.com/Forward-to-action-without-jsp-tf2350751.html#a6547071 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Out of topic, Oracle SEQUENCE
Daniel, If you are by chance using iBatis, look at their selectKey command. It is the one that seems to be referred to most for this type of need on the iBatis list. If not, sorry. Al Brett Connor wrote: (In case my reply to completely the wrong post didn't get read!...) selecting max... isn't a viable solution, because of other sessions as you say. Assuming you're at least using Java, you might want to look at java.sql.Statement.getGeneratedKeys() Oracle database returns generated keys in the 'C' i/f, my memory's rusty for JDBC but I know there is a way somewhere to get the key values in the same statement, rather than have to execute another statement for 'curval'. getGeneratedKeys() may be it. HTH Brett Quoting Daniel Chacón Sánchez <[EMAIL PROTECTED]>: Thanks so, first: insert into users_values (user_seq .nextval, 'userName'); and then: select user_seq.curval from dual There is not a way to make only one sentence to do that? Like in SQL 2000: SET NOCOUNT ON INSERT INTO USER_VALUES (USER_NAME) VALUES ('DANIEL') *SELECT @@IDENTITY* as userCode SET NOCOUNT OFF - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamically Initializing Checkbox Value
Anthony, See my comments below. Hope this clears things up a little and I see Laurie has made a worthwhile comment about looking at the examples available. HTH, Al Anthony N. Frasso wrote: My head hurts. :) Thanks for everyone's help. I've gotten a number of responses, it's just that I'm still confused. It's obvious I have something drastically wrong with my understanding of the workflow of Struts, so I'd like to clear that up now. Let's take my list page, ListRoles.jsp: Name Description Edit Delete This form lists all roles in the system. Next to each role, there are two links: one to edit the role, and the other to delete it. These links simply execute some javascript that populate the hidden form fields and then submit the form. Uh, do you do a lot in the javascript besides set the hidden fields? Here is an example of how I pass similar information. Of course, I don't have a action to pass as each possible operation has it's own action. Actual 2. One to prepare the form data to be displayed to the user to update and then one to process the data after the user submits the form. "> When the form is submitted, the form bean is populated. Here is the form bean (EditRolesForm.java): public class EditRolesForm extends ActionForm { private static final long serialVersionUID = 0; public static final String ADD_ACTION_CODE = "add"; public static final String DELETE_ACTION_CODE = "delete"; public static final String EDIT_ACTION_CODE = "edit"; private String actionCode; private int roleId; public String getActionCode() { return actionCode; } public int getRoleId() { return roleId; } public void setActionCode(String actionCode) // some validation done here, and the action // code is then set } public void setRoleId(int roleId) { this.roleId = roleId; } } Nice and simple. :) Now, when the form is submitted, and as I understand it, *after* the form bean is populated, the execute method is called for the Action class. Here is my the Action class I created for this action (EditRolesAction.java): public class EditRolesAction extends TransactionAction { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { EditRolesForm editRolesForm = (EditRolesForm) form; // at this point, I believe the form is // *already* populated. // do some computation, place the correct // role in the request scope, and determine // the correct forward request.setAttribute("role", role); Ok, instead of request.setAttribute("role", role); try this. EditRoleForm editRoleForm = new EditRoleForm(); editRoleForm.setID(role.getID); . . Set the rest of your form fields. . request.setAttribute("role", editRoleForm); Your jsp, then, has the information it needs to set the initial value of all your fields and checkboxes. This is the way I do it for my edit and delete confirmation jsps. return mapping.findForward(...); } } So now, assuming the user has asked to do an edit, the EditRole.jsp is generated: Name: Description: blah Here is the EditRoleForm form bean: public class EditRoleForm { private int id; private String name; private String description; private boolean permissionA; private boolean permissionB; ... private boolean permissionN; } So the question is... I *don't* have access to the EditRoleForm form bean in the EditRolesAction Action class; there, it's the EditRolesForm form bean (sorry about the confusing terminology; just node that EditRoles refers to modifying the roles in some aspect, and EditRole refers to editing a specific role). Albert Sapp Wrote: "I am puzzled by your comment that you don't have a form bean before you get to the jsp. We do this all the time. Say I want to display a list of inventory items for a user. I retrieve a list of inventory items matching the query data the user gave me and create an array of inventory item forms to pass to the jsp. I convert information from the list inventory item beans and place each one into the array. Then just set the array as a parameter in request scope and then use that parameter to build my jsp. I do the same if I am providing a means for a user to update infor
Re: Dynamically Initializing Checkbox Value
Anthony, I am puzzled by your comment that you don't have a form bean before you get to the jsp. We do this all the time. Say I want to display a list of inventory items for a user. I retrieve a list of inventory items matching the query data the user gave me and create an array of inventory item forms to pass to the jsp. I convert information from the list inventory item beans and place each one into the array. Then just set the array as a parameter in request scope and then use that parameter to build my jsp. I do the same if I am providing a means for a user to update information on an item. I initialize the form in the prep action, display the jsp and read the form in the processing action. So I read/write to the same inventory item form bean and read/write to my DAO inventory item bean for the backend. The only reason I use 2 different beans is it was mandated to separate the view from the model and I need to convert some data say the unit of issue ID to a actual unit of issue for the user. I hope this helps. Al Anthony N. Frasso wrote: Actually, that's incorrect. I want to *read* from the Role bean. I want to *write* to the form bean. I just don't know how to go about it yet. :) It seems like I have to read/write to the same form bean, which doesn't make sense, because I don't have the form bean until I get to the JSP page, so there's no way to initialize it. Thanks for the help, Anthony Frasso --- Puneet Lakhina <[EMAIL PROTECTED]> wrote: On 8/30/06, Anthony N. Frasso <[EMAIL PROTECTED]> wrote: Hello all, public class Role { private int id; private String name; private String description; private boolean permissionA; private boolean permissionB; ... private boolean permissionN; } Each of those properties has getter and setter methods. By the way, in the *actual* Role class, the permission booleans are named such things as "canAccessProjects" and "canEditCustomers" and other such actual permissions, which is why I am not using an array of booleans in this case. I want to refer to them by name. Now I wanted to create a JSP that contained a form, that allowed a user to edit a role. Here is the definition of my form bean (called EditRoleForm): public class EditRoleForm extends ActionForm { private boolean roleId; private boolean roleName; private boolean roleDescription; private boolean rolePermissionA; private boolean rolePermissionB; ... private boolean rolePermissionN; } I kinda dont understand why do you need 2 beans as long as u only care about reading from them. you could have somehting like this in your form bean public class EditRoleForm extends ActionForm { Role role = new Role(); /*getter method*/ } and then in your jsp you have Permission A: you dont need to specify a value explicitly, it loads the field with whatever value the property has. In this instance, the form bean looks quite similar to the role bean. In my JSP, I have the following: Name: Description: property="roleDescription" value="${role.description}" /> Permission A: property="rolePermissionA" value="true" /> Permission B: property="rolePermissionB" value="true" /> ... Permission N: property="rolePermissionN" value="true" /> As you can see, all of the checkboxes are going to be initialized blank. I would instead prefer them to be initialized with the value in the role within the request scope. I was able to do this using the "value" parameter in the text and textarea tags, but the value parameter is used differently for the checkbox tag. I hope this clears it up. One final note: After reading everyone's responses, and also reading around on the web, I seem to be getting an idea that the name of the property in the Role bean and the Form bean should be identical, and this is the way it is able to initialize the value in the checkbox, and also set the correct value in the form bean when it is submitted. This seems like a bad idea. For one, how do we know that there is a one-to-one mapping of beans to form beans? If I'm modifying a few beans all on the same JSP page, I certainly don't want there to be confusion. I hope I've made myself clear, and I look forward to everyone's response. I really appreciate the time and effort everyone has taken in helping me out thus far. Regards, Anthony Frasso __
Re: set request parameter
Vidya Mahavadi wrote: Hi guys, I have a jsp where I have a table with few records and for each record I have a Remove button, which actually should delete the record from database. How do I pass the record id to the action.. Any ideas? Regards, Vidya This message and any attachments are confidential and intended solely for the addressee. If you have received this message in error, please notify Discovery immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration or dissemination of the contents of this email is strictly prohibited. In no event will Discovery or the sender be liable in any manner whatsoever to any person for any loss or any direct, indirect, special or consequential damages arising from use of this email or any linked website, including, without limitation, from any lost profits, business interruption, loss of programmes or other data that may be stored on any information handling system or otherwise from any assurance that this email is virus free even if Discovery is expressly advised of the possibility of such damages. Discovery is an Authorised Financial Services Provider. Vidya, Why not do something like this? In this case, the jsp called lists inventory items from a query. Each row in the table has buttons for update and delete. "> "> We do the same sort of thing in all of our jsps that return results from user queries. If you need it, I can send you the code in the jsp that surrounds this. HTH, Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page does not refresh after action
Rizwan Merchant wrote: Hi Manoj, Thanks for the response. This happens with both FF and IE. I am not sure I understand your question "Also where are u persisting the order (session db ..where)that you change in the action that is not reflected in the forwarded page". When I click on the cancel button, the page reloads but the column with the status text does change to "Canceled" as it is supposed to. If I query the mysql db on the command line I can see that the status has been changed (its just not reflected on the screen after the reload). When I hit "refresh" or navigate back to the page the status text changes. So basically the change is not reflected the first time after returning back from the cancel action. Please help! Thanks, -Riz. [EMAIL PROTECTED] wrote: What browsers are you working on... Try it on firefox as well Also where are u persisting the order (session db ..where)that you change in the action that is not reflected in the forwarded page Cheers -Original Message- From: Rizwan Merchant [mailto:[EMAIL PROTECTED] Sent: Sat 10/06/2006 01:18 To: Struts Users Mailing List Cc: Subject: Page does not refresh after action Hi, I have a page with a bunch of orders, and each order has a "Cancel" button next to it and the status text of that order. When I cancel a particular order, the appropriate action is called, the order is canceled and the action then returns to the same page. I can see the page being reloaded (thru the status bar on the browser), but the status text (which should now say "Canceled") for the order remains the same until I hit "Refresh" again (or come back to the page by navigating to it). Is it possible that the browser is caching the status text and how can I overcome this problem? Thanks, -Riz. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Riz, You are, if I understand your response, persisting your orders in the db. To show the new status of an order, you are going to have to repeat your query. Either do this in your cancel action, since you appear to be going back to the jsp directly, or redirect back to the original query action and let it go to your jsp from there. You will need to persist you query parameters to do either of these. In our application, the way it is set up, we persist the query parameters in session scope and redirect back to the query action. We do this so that we can do updates and deletes on a list item and not duplicate the query in each of those actions. Don't know if this is best practice, it is just the way we do it. HTH, Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Thank you to the list.
Guys, I want to thank everyone on the list for all the new ideas and technologies that have floated up as answers to many of the questions posed here. I have learned that I need to get a good book on Struts, because I am sure we are missing a lot of stuff that would make our current project a lot easier. Struts was one of 5 new technologies I had never dealt with before when we start this project, but this forum has and continues to be a great help in getting what I need to move forward. Thanks, again to all off you who take time to help out a newbie. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: best way to send parameters through more requests
Michael Jouravlev wrote: On 6/9/06, Samere, Adam J <[EMAIL PROTECTED]> wrote: Emilia Ipate wrote: > Is there a solution besides using session, to send some request > parameters from one request to another? > I would like to implement something like a shopping cart (a > functionality which needs about4-5 steps) and I do not want to store > the objects in the session (it is alread too big)! > > So, do you have any ideas? You also may be able to store state in hidden fields in the rendered markup, or by encoding the raw binary data in a single hidden field. This goes a bit beyond the scope of this list though. Using hidden fields incurs the following restrictions: * All pages must contain HTML FORMs. * All pages must be executed in strict order, so they are tightly interconnected in one flow, as well as server actions. * You cannot use redirection. * Going back and forth without redirection causes POSTDATA messages. With either hidden fields or request parameters used to store the state: * Going back may result in rolling back your cart * Going forward may result in rolling forward your cart * It is impossible to navigate directly to a certain URL because in this state info will be lost Bottom line: storing stuff like shopping cart in hidden fields sucks. It makes system very unflexible where "usability" is an unknown term. Store it on server, whether in the session or in database. On 6/9/06, Emilia Ipate <[EMAIL PROTECTED]> wrote: I was more thinking of something like: - store the complex object in the session and remove it when it becomes useless! Right. Now the question comes: when does the object come useless? It is useless when users gets to step 5 and also when from a middle step (like 3) decides to get out of the this 5 step request-chain. In both cases, the object should be removed from session. I would say to have a configuration file that says for which url-patterns request should the object be kept in the session. So, when another request (which is not part of the url-patterns) comes in, the filter will remove the object from session! Nope. Clean the cart when a user bails out or finishes checkout process. Cleaning should be corresponded to user/cart state, not to URLs. On 6/9/06, Emilia Ipate <[EMAIL PROTECTED]> wrote: So I cannot just hold these objects in session forever Session expires automatically. You can set a shorter timeout interval if you need. My bank has 10 minute timeout. On 6/9/06, Albert L. Sapp <[EMAIL PROTECTED]> wrote: Wanted so what everyone had to say before I dropped in my 2 cents. The only thing we keep in session is the userID and the unitID for where they are shopping. This happens in step 1. In step 2, we query the db to see if they already have shopping cart items from a previous trip to the storeroom. This step is repeated over and over again as they add items to their cart. They can add, delete or update an item from this jsp and are always returned to it. Finally in step 3, they say ok check me out and we collect the account information we need, create the accounting transactions, update stock levels, remove the shopping cart items and give them a chance to print out a listing of their purchases. So, do you keep an open db transaction related to a shopping cart, or you commit each and every cart event. Then, if a user bails out, you run a correcting transaction, removing all stuff related to shopping cart? I like database for it robustness and for time-proven clustering solutions, but considering these transaction-related issues I would rather use the session. I guess your case is different. It is not like "I want to buy this, this and this", it is "I already have taken this, this and this", so the cart reflects events that a user already did to the stock, and you must not lose them. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Right, Michael. Each individual item is stored by userID and unitID. Therefore, a user can have multiple carts depending on storeroom they are shopping in. The user can clear a cart any time prior to a successful checkout. Honor system on the user's part. The storekeeper can process, correct or clear a cart for his storeroom after speaking to the user by phone or email to determine where the stock is. Once a successful checkout has occured, the storekeeper is the only one who can "return" a stock item. Returns might be due to an incorrect quantity being entered by the user or they took the wrong stock to begin with. He will look up the invoice for the user in his storeroom, select the items from the invoi ce to insure he is crediting it at the price it was sold and give the user a copy of the completed storekeeper invoice showing the item was credited. We very c
Re: best way to send parameters through more requests
Emilia Ipate wrote: Al, your solution is good, except for one thing: what do you do if the user leaves the application at step2? You will have in DB all the items the user checked, but they are no longer necessary Emilia -Original Message- From: Albert L. Sapp [mailto:[EMAIL PROTECTED] Sent: vrijdag 9 juni 2006 16:20 To: Struts Users Mailing List Subject: Re: best way to send parameters through more requests Emilia Ipate wrote: Hello, all! Is there a solution besides using session, to send some request parameters from one request to another? I would like to implement something like a shopping cart (a functionality which needs about4-5 steps) and I do not want to store the objects in the session (it is alread too big)! So, do you have any ideas? Kind regards, Emilia --- - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Emilia, Wanted so what everyone had to say before I dropped in my 2 cents. The only thing we keep in session is the userID and the unitID for where they are shopping. This happens in step 1. In step 2, we query the db to see if they already have shopping cart items from a previous trip to the storeroom. This step is repeated over and over again as they add items to their cart. They can add, delete or update an item from this jsp and are always returned to it. Finally in step 3, they say ok check me out and we collect the account information we need, create the accounting transactions, update stock levels, remove the shopping cart items and give them a chance to print out a listing of their purchases. The 2 session attributes are cleared and we go back to the jsp where the next person enters their userID. 3 steps with one of them being repeated. We went with the db approach because we had to try and capture the items a person said they were taking in case they give a invalid account or simply get too rushed and leave without completing the shopping process. Believe me, that happens more than we like. I hope this was helpful. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Emilia, That is the point for us. This application is used in the storeroom to allow a user to enter the stock they are taking out of the storeroom. Granted we could have people walk out with stock and not even enter it, but, if they do enter it, we want to be able to contact them and ask what they did with the stock. Did they put it back? Did they take and forget to checkout? Did they take it and the account they used come back as invalid? Then, the storekeeper can either complete the checkout or clear the shopping cart for the user. We have some indication available to our storekeepers that some activity has taken place and contact information to use to follow up with. I mean we are relieve them of the data entry they were doing. They just have a new job of following up on checkouts not performed. Our next step is to allow for ordering of items for delivery or pickup and using the shopping cart to build the pick list for the storekeepers. If this were a shopping cart for a web site, I can see where they would like it in session because then it is cleared when the session teminates and they don't have all this unneeded information in their db. For us the situation is different and we really need that information to make sure all information needed for a final transaction is captured. This is even more important when our pricing might change the next minute because a storekeeper is adding new stock received and price averaging is occuring. Hope this clarifies how we look at things. By the way, I work for a university and these storerooms are supplying student labs and researchers and we have some really strict stock control issues with chemicals and such. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: best way to send parameters through more requests
Emilia Ipate wrote: Hello, all! Is there a solution besides using session, to send some request parameters from one request to another? I would like to implement something like a shopping cart (a functionality which needs about4-5 steps) and I do not want to store the objects in the session (it is alread too big)! So, do you have any ideas? Kind regards, Emilia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Emilia, Wanted so what everyone had to say before I dropped in my 2 cents. The only thing we keep in session is the userID and the unitID for where they are shopping. This happens in step 1. In step 2, we query the db to see if they already have shopping cart items from a previous trip to the storeroom. This step is repeated over and over again as they add items to their cart. They can add, delete or update an item from this jsp and are always returned to it. Finally in step 3, they say ok check me out and we collect the account information we need, create the accounting transactions, update stock levels, remove the shopping cart items and give them a chance to print out a listing of their purchases. The 2 session attributes are cleared and we go back to the jsp where the next person enters their userID. 3 steps with one of them being repeated. We went with the db approach because we had to try and capture the items a person said they were taking in case they give a invalid account or simply get too rushed and leave without completing the shopping process. Believe me, that happens more than we like. I hope this was helpful. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Variable 'input' attribute in struts-config.xml
Scott Van Wart wrote: Michael Jouravlev wrote: I suggest to look at your issue from another perspective. Do you really need the functionality you are asking for? First, a small clarification. There is no input page for an action, "input" attribute is poorly named, it should be called "error" or "errorTarget", because Struts forwards to that location if input data does not validate. Your request is always sent to action/actionform. That might be it then... it might just be a matter of having to separate things out a little more. So let's say I had a page that edits an entity. I might call this edit_entity.jsp, with an EntityForm, and a SaveEntityAction. I found things got a little cumbersome in the .jsp, so I separated it out into a create_entity.jsp and edit_entity.jsp. These two forms submit to the same action. Obviously, they have a lot of code in common, but I thought of factoring that out into tags. Perhaps I should do the same thing to the action class (CreateEntityAction and UpdateEntityAction rather than all-encompassing SaveEntityAction; any code duplication can go into base classes or utility classes). The other side of this is that I also have a ShowEntityForm and ShowEntityAction. The action is mapped to /showEntity, and there are three forward mappings from there. Two are "success"-like forwards called "create" and "edit", which forward to create_entity.jsp and edit_entity.jsp. The 3rd one, the "failure" forward's destination would depend on who called /showEntity in the first place. The ShowEntityForm has validation, to ensure the given entityId is a number, and the "failure" forward gets hit when the entityId can't be found in the database table. While I can break the "failure" out into multiple forwards, I can't do the same with input. So the question is, then, do I break up my ShowEntityX classes into things like NewEntityAction->create_entity.jsp->CreateEntityAction and EditEntityAction->edit_entity.jsp->UpdateEntityAction? It's starting to sound like a lot more classes, but if I'm on the right track, and if that's how Struts is designed, then perhaps that's the point. Or I could be completely off my rocker. :) - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Scott, I think your approach, if I understand it right, should be fine. In our application, we start with a query page that allows entry of data for a query or has a link to create a new object. If they enter query information we go to a query action which generates a results jsp or returns them to the query jsp if no matchs are found. On the results page on each line displaying a item, we have 3 links that either show them the details for the item, allow them to update the item or delete the item. Links are displayed based on the role that the user might have. HTH, Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reload the same page
Maya menon wrote: All, I have a page, results.jsp with a link < ahref="deleteAction.do?/> In deleteAction, the record will be deleted by calling the helper classes and on succesful delete the request should be forwarded again to the results.jsp. How can I achieve this ? In strts-config, i have it properly pointed. But the page doesnot refresh. Am I missing anything ? Thanks __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com In our application, we place the parameters that created the results in session scope bean. Then, you can rebuild your results for the result page in the delete action or redirect on a successful delete back to the action that normally does the query and builds the results. HTH, Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I set this up to give me a better display in jsp?
Miguel Galves wrote: Albert, I wrote the following code to do what you want: property="tableOffset" id="offset"> In the inner loop, I use the parameters offset and lenght to define the initial array position to get the information to be displayed and the number of iterations. The only thing I had to do and I really dont like was to create a tableOffset array in my form, which is an array with all the offsets I use to build the table, in the outer loop. Its not very elegant, but it works fine. []s Miguel On 5/26/06, Albert L. Sapp <[EMAIL PROTECTED]> wrote: Hi, everyone. This code is working. ${unit.unitID} ${unit.formattedName} By adding a after the formatted name, I can get each checkbox on a new line. Not too bad, as we don't have a lot of banner units right now. I don't like the normal output without the , because the checkboxs run one right after the other and at the line wrap a box gets seperated from its label. What I would like to have is something like this: [] Unit1 [] Unit2 [] Unit3 ... . . . [] UnitX [] UnitX+1 ... I am thinking table, but everything I have tried fails. I can't find the example I saw on the web from some presentation a person gave and they didn't give the jsp code anyway. I looked in the mailing archive and wiki, but either I was not searching right or I am looking for something not possible. Can someone give me a yes or no? If yes, can you point me to an example or drop me the code? Also, is this something that might be in another tag library? I keep seeing the html-el and struts-el libraries popping up. Thanks, Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Thanks for the reply, Miguel. I am hoping that I can stay with the multibox tab, but this should work if I need to just create each checkbox individually from an array. I just like the simplicity of processing the returned array from multibox versus having to find and process each checkbox. I am assuming that I would need to check for each possible checkbox name to see if it exists and process the value returned with it. I may misunderstand the concept of processing checkboxes in the following action. I will certainly take a look at this possible solution. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do I set this up to give me a better display in jsp?
Hi, everyone. This code is working. ${unit.unitID} ${unit.formattedName} By adding a after the formatted name, I can get each checkbox on a new line. Not too bad, as we don't have a lot of banner units right now. I don't like the normal output without the , because the checkboxs run one right after the other and at the line wrap a box gets seperated from its label. What I would like to have is something like this: [] Unit1 [] Unit2 [] Unit3 ... . . . [] UnitX [] UnitX+1 ... I am thinking table, but everything I have tried fails. I can't find the example I saw on the web from some presentation a person gave and they didn't give the jsp code anyway. I looked in the mailing archive and wiki, but either I was not searching right or I am looking for something not possible. Can someone give me a yes or no? If yes, can you point me to an example or drop me the code? Also, is this something that might be in another tag library? I keep seeing the html-el and struts-el libraries popping up. Thanks, Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple checkboxs in jsp using struts tags.
[EMAIL PROTECTED] wrote: Albert L. Sapp asked: This is my first post so I will try to make it short. I am trying to use the logic:iterate and html:multibox. I found what I thought was a good example through a google search, but I just can't get it to work. Here is the exception I get: javax.servlet.ServletException: Cannot find bean unit in any scopeI understand the error, but don't know how to fix it. The example I am following said to setup the tags as follows: [snip] I think you may need a tag after the to make the value available. See http://struts.apache.org/struts-action/struts-taglib/tlddoc/bean/define. html I've blocked out much of this from my memory because JSTL is so much easier. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Thanks, George. We are using JSTL in other JSP. I will try that in place of the iterate tag. Al
Multiple checkboxs in jsp using struts tags.
Hi, everyone. This is my first post so I will try to make it short. I am trying to use the logic:iterate and html:multibox. I found what I thought was a good example through a google search, but I just can't get it to work. Here is the exception I get: javax.servlet.ServletException: Cannot find bean unit in any scopeI understand the error, but don't know how to fix it. The example I am following said to setup the tags as follows: My form for the jsp in the struts-config.xml is bannerFeedForm. bannerFeedForm has a bannerUnits array of the type Unit and a selectedUnits array of the type String. I populate the bannerUnits array from a db query in the action. If you need the form code or the relevant action code, let me know. I believe my problem is that the id attribute of iterate is looking for a Unit bean in the page scope. However, the only bean in scope at the time is the bannerFeedForm. I figure I am missing something here, but am not sure what. I tried the following changes with the same results, of course. Should id be set to something else? If not, how do i get the needed bean in scope? In all the programming up to now we use request.setAttribute to pass information to the jsp. I am really a newbie at this and can't spend much more time trying to get it to work. Another programmer suggested just hardcoding all the checkboxs, but I hate hardcoding something when I know I should be able to do it dynamically. Any help to avoid this would be appreciated. Al - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]