Tile controller class
I am using a tile controller class to render the tile on the page. Say if my main action rendering the page is called myAction.do and when I send the request like https://.../myWeb/myAction.do, myAction.do will do something and then forward to the page containing the tile.(then the tile controller comes to the picture). My tile controller have the following method: public class MyTileController implements Controller { public void execute(ComponentContext arg0, HttpServletRequest request, HttpServletResponse arg2, ServletContext arg3) throws Exception { // how to the the path myAction.do?? // process business logic } } My question is that how to get the path info like myAction.do in the above method? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action form in session scope
Hello, which is a prefered way to add actionform into session scope or in the request scope? Is that true that putting actionForm into the session is a bad idea? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles questions
I have a mainLayout which has a header, body and footer.(and thus I have 4 jsps, mainLayout.jsp, header.jsp, body.jsp, and footer.jsp, and notice that body.jsp will be different for each different screen page). One setting can be of: Then I have a further requirement: Manager pages's body has left, middle and right. All manager pages will have common left and right, but middle will be different. So I define the managerBody like Then if I have managerPage1, I can define as: "/> Unfortunately, this doesn't work. Can somebody help? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles questions
I have a mainLayout which has a header, body and footer.(and thus I have 4 jsps, mainLayout.jsp, header.jsp, body.jsp, and footer.jsp, and notice that body.jsp will be different for each different screen page). One setting can be of: Then I have a further requirement: Manager pages's body has left, middle and right. All manager pages will have common left and right, but middle will be different. So I define the managerBody like Then if I have managerPage1, I can define as: "/> Unfortunately, this doesn't work. Can somebody help? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts validator framework
Say if I have two text fields, one label is Please enter name:, and the other label is Please enter SSN:. In struts validator framework, if I need to validate these two fields using required validator, is there any way to relate the field label to the message? Or does struts validator support displaying the validation message right next to the field (so that the user easily know which fields are invalid)? Thank you very much. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts global-exception and web.xml's error-page
Can anyone let me know the differences between (1) and (2): Thanks (1) In struts-config.xml (2) In web.xml Exception /MyError.jsp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Business object in the action form?
Thanks, but it didn't say that whether it is appropriate to put the bo inside action form. Any more relevant website? -Original Message- From: Randy Burgess [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2008 5:20 PM To: Struts Users Mailing List Subject: Re: Business object in the action form? I wouldn't put a DAO or a business object there. Here is a good example. http://struts.apache.org/1.x/faqs/actionForm.html Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications > From: "Zhang, Larry (L.)" <[EMAIL PROTECTED]> > Reply-To: Struts Users Mailing List > Date: Tue, 11 Mar 2008 11:33:28 -0400 > To: Struts Users Mailing List > Subject: Business object in the action form? > > I have a question regarding ActionForm... Is it a good idea to place the > Business Object in the action form? In my project, I do put the Data > transfer object into the action form, but I am not certain if this is a > good idea to put the business object as well into the action form. See > the following link to understand what the business object is. > > Thanks a lot. > > > http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObjec > t.html > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - 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]
Business object in the action form?
I have a question regarding ActionForm... Is it a good idea to place the Business Object in the action form? In my project, I do put the Data transfer object into the action form, but I am not certain if this is a good idea to put the business object as well into the action form. See the following link to understand what the business object is. Thanks a lot. http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObjec t.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Database resources
In struts-fonfig.xml I configured as following to get the messages from DB instead of MessageResource.properties. I have wrote a method to getMessage(Locale loc, String key) to get the message from db. This works for en_US locale, Now my question is how can I pass the locale so that I get the locale specific messages? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DAO pattern
Sorry if this is not too on topic. I have a user object whose data is from three resources: Db2, LDAP, and other flat file. Per dao pattern, do you think I should have three daos or one dao to encapsulate the data access implications? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts validator
Struts valdiator developers, Doesn't struts support this requirment? -Original Message- From: Zhang, Larry (L.) Sent: Friday, February 01, 2008 10:55 AM To: 'Struts Users Mailing List' Subject: RE: Struts validator No, I am using struts 1.1, I would like to implement the following case: In valiation.xml: I don't want to validate both fields at the same time when just one submit button is clicked. Your helps are appreciated! -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Friday, February 01, 2008 10:45 AM To: Struts Users Mailing List Subject: RE: Struts validator --- "Zhang, Larry (L.)" <[EMAIL PROTECTED]> wrote: > We are not using Struts 2 tag and thus I can't use s:submit tag. Are you using Struts 2 at all? You can still use the generated HTML as a template to create your own HTML, although... not sure why you wouldn't just use the tag in this case. Dave - 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: Struts validator
No, I am using struts 1.1, I would like to implement the following case: In valiation.xml:
RE: Struts validator
We are not using Struts 2 tag and thus I can't use s:submit tag. -Original Message- From: David Harland [mailto:[EMAIL PROTECTED] Sent: Friday, February 01, 2008 10:01 AM To: Struts Users Mailing List Subject: RE: Struts validator You can do it by having 3 different methods such as method1() method2() method3() and then have validateMethod1() validateMethod2() validateMethod3() then in your form or you can do by using action aliases and have three validation xml files. http://struts.apache.org/2.0.11/docs/validation.html -Original Message- From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] Sent: 01 February 2008 14:45 To: Struts Users Mailing List Subject: RE: Struts validator Can some Struts guru answer the following questions? -Original Message- From: Zhang, Larry (L.) Sent: Thursday, January 31, 2008 3:27 PM To: 'Struts Users Mailing List' Subject: Struts validator Hello coworkers, I have a questions regarding the struts validation..., say I have three text fields to be validated in struts validation, and three submit buttons as well. When I submit one buttion, I only need to validate one field, and when I click on the other submit button, I need to validate the other field. Currently, all three fields are validated even though I don't need to. Is there any way to overcome this issue? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - -- ML {UFI} __ Ufi Limited Registered in England No. 3980770 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP learndirect Solutions Ltd Registered in England No. 5081669 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP UFI Charitable Trust Registered in England No. 3658378 Registered Charity No. 1081028 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP This email has been scanned by the MessageLabs Email Security System. __ - 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: Struts validator
Can some Struts guru answer the following questions? -Original Message- From: Zhang, Larry (L.) Sent: Thursday, January 31, 2008 3:27 PM To: 'Struts Users Mailing List' Subject: Struts validator Hello coworkers, I have a questions regarding the struts validation..., say I have three text fields to be validated in struts validation, and three submit buttons as well. When I submit one buttion, I only need to validate one field, and when I click on the other submit button, I need to validate the other field. Currently, all three fields are validated even though I don't need to. Is there any way to overcome this issue? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts validator
Hello coworkers, I have a questions regarding the struts validation..., say I have three text fields to be validated in struts validation, and three submit buttons as well. When I submit one buttion, I only need to validate one field, and when I click on the other submit button, I need to validate the other field. Currently, all three fields are validated even though I don't need to. Is there any way to overcome this issue? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can I use one action for displaying and submission (with struts validation)
I am intested in knowing how to turn automatic validation off? How? Using javascript to set the flag is not accepted by us. Also all my submission is also get (for some reasons in our project) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Benedict Sent: Friday, January 25, 2008 12:15 PM To: Struts Users Mailing List Subject: Re: Can I use one action for displaying and submission (with struts validation) You can use this pattern: * Turn automatic validation off. * If your action was executed as a GET, branch to viewing logic. * If your action was executed as a POST, branch to validation logic and submission logic. Paul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Can I use one action for displaying and submission (with struts validation)
I was noticing an issue if I use one action for both displaying and submission purposes: Say MyAction.java is for displaying page and also for submission. If on the page there is text field needing the struts validator validation, then if failing validation, I forward to MyAction.java and comes to the validation again, and fail again and forward to the MyAction again. This is an infinite loop, any suggestions to overcome this and still use one action? Or we have to use two actions(one display and one for submission) the serve the purposes. Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Exception handling
Since Struts offers an exception Handler (org.apache.struts.action.ExceptionHandler ), then I got a question: in my action, should I try and catch the exception (in the execute's method) that may be throwed in business layer and forward to an ActionForward? Or don't do any try and cath in the action's execute method just throws to the Exception handler? Your suggestions are appreciated! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Get the message from DB instead of from the default MessageResources.properties
Do we still need to create MessageResourcesFactory And MessageResources to facilate the requirment. Do we have an easier way to achieve the requirement? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Naming convention
I knew my question may not be very related to this list, but let me just ask anyway: I have many DB2 stored procedures, for each procedure I correspondingly have a Java parser to parser the result set. I currently name these classes the same name as stored procedure. Example, Csm5RRP (this is the stored procedure name), then my Java class name is Csm5RRPParser.java. Then 2 days ago, they have to change the names for all the stored procedure, to makes things meaningful, I have to rename all my java classes. -- this is really a pain. Do you guys have an argument on this? Is this a good naming practice? If not, what will be the naming convention in this situation? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Passing data from one form to another form using hyper link
Say I have page1 (form1) and page2 (form2), on page1 I have a hyper link. When I click on the hyperlink, it will call another action (let's say action2) which is associated to form2 in the struts-config.xml. My question is that how to make form1 data available in action2? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles-def.xml
That approach works except in your following note it should be c:out value="${item}" /> Thanks a lot. -Original Message- From: Antonio Petrelli [mailto:[EMAIL PROTECTED] Sent: Monday, November 12, 2007 11:07 AM To: Struts Users Mailing List Subject: Re: Tiles-def.xml 2007/11/12, Zhang, Larry (L.) <[EMAIL PROTECTED]>: > > > > > > > > > > > I think that you could use the list attribute: And in your JSP: HTH Antonio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles-def.xml
My problem is: I have 10 (or more ) css files, some pages use 2 of those, some of those uses 5 of those, some pages use 6 of those, and this combination is totally random. Then we I create tiles template, I can't put all these css in the template, instead I thought I can do the following: My template: http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en-us"> <tiles:getAsString name="myCss1" ignore="true"/> <tiles:getAsString name="myCss2" ignore="true"/> <tiles:getAsString name="myCss3" ignore="true"/> <tiles:getAsString name="myCss4" ignore="true"/> <tiles:getAsString name="myCss5" ignore="true"/> <tiles:getAsString name="myCss6" ignore="true"/> <tiles:getAsString name="myCss7" ignore="true"/> <tiles:getAsString name="myCss8" ignore="true"/> <tiles:getAsString name="myCss9" ignore="true"/> <tiles:getAsString name="myCss10" ignore="true"/> Then I need to define myCss1 and etc in the tiles-def.xml, I don't know what is the good one to define this, I don't want to define them like the following : put name="myCss1" value="the path to the Css1" Since that will make my tiles-def.xml too massy. So the original issue is how to put the dynamic css files in the template between . I would think this is a common issue for tiles community. Do you have any better way to resolve this issue? -Original Message- From: Antonio Petrelli [mailto:[EMAIL PROTECTED] Sent: Monday, November 12, 2007 10:30 AM To: Struts Users Mailing List Subject: Re: Tiles-def.xml 2007/11/12, Zhang, Larry (L.) <[EMAIL PROTECTED]>: > > Can I define a constant in tiles-def.xml so that I can used it in all > places inside this file? No, but probably you can do it in another way. What do you want to do exactly? Antonio P.S.: If you are using Tiles 2, please ask this question to Tiles Users Mailing List: http://tiles.apache.org/mail.html If you are using Struts/Tiles, go on here and ignore this P.S. :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles-def.xml
Can I define a constant in tiles-def.xml so that I can used it in all places inside this file? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tiles usage
Consider that each page can have different .css and .js files and these files will be put between and in the layout, then the question is that how to pass the specific .css and .js to the tiles layout? I definitely don't want to put all the .css and .js to the layout just for suite to use tile. Thanks in advance - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Jstl and struts
This might be an old topic, but should we completely rule out using struts tag and move to jstl tag? If not, does struts have a tag that will do anything if the filed is equal (1 or 2 or 3 or 4)? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Where to code getting user principal in struts based project
In my Struts based J2EE application, I need to get user's login information (user principal), and based on the login id, I will create the user object and then put it into the session. I am wondering where is the best place to put this code in. I read some info and it sounds like I should put this code in CustomRequestProcessor (which extends TilesRequestProcessor)'s processValidate method, please let me know if this is something correct. Thanks. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A try catch and return question
I have a method having the following structure: public Object myMethod() { try { // some code return theReturnedObject, }catch{ // some code } finally { // some code } } Please let me know if the following version of code better than the above? public Object myMethod() { try { // some code }catch{ // some code } finally { // some code } return theReturnedObject, } The only difference is that the bottom one put the return down to the bottom of the method and take the return out of the try. Please let me know. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action instances
Say I have two version design: (1) Some other things go here... onePeople one Employee (2) Some other things go here... one People on Employee The verion 1 has three actions to render three pages, while version 2 use one action to render three pages. The arguments for version 1 is that three instances of the action class (one is myAction - which is relatively big, others are smaller) is betther than three instnaces of a bigger action classes (myAction). Does this make sense? Does the number of action intances matters? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
value attribute in the tag
On myForm, I have a collection (an array of Analyst objects), analystList, when I iterate through it, I want to render a check box for each row, and I specifically want to put the analyst id to value attribute of the checkbox tag, do you know how to do it? And also how to get the value of the check box? Many Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Dao subclass
I have a question, is it a good practice to subclass dao? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Outlook like notification window
(small window on the right bottom corner of the computer screen) - not in the browser. -Original Message- From: Musachy Barroso [mailto:[EMAIL PROTECTED] Sent: Monday, June 04, 2007 2:07 PM To: Struts Users Mailing List Subject: Re: Outlook like notification window Do you mean a popup window in the browser? musachy On 6/4/07, Zhang, Larry (L.) <[EMAIL PROTECTED]> wrote: > > I am looking for a J2EE or AJAX solution for Outlook like notification > (small window on the right bottom corner of the computer screen), can > some one point out a tutorial like information? > > Thanks. > > Larry > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Outlook like notification window
I am looking for a J2EE or AJAX solution for Outlook like notification (small window on the right bottom corner of the computer screen), can some one point out a tutorial like information? Thanks. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Init methods in Struts
Then I have no clue other than newton.dave's approach ... -Original Message- From: newtostruts struts [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 2:46 PM To: Struts Users Mailing List Subject: RE: Init methods in Struts Larry thanks for the reply. I'm in Struts2 mode and I don't see a PlugIn interface anywhere. Also, I read this on apache site ' Struts 1 provides a plugin class that provides listener-like capabilities. The Struts 2 plugins are like Eclipse or FireFox plugins, and not at all like Struts 1 "plugins". ' Any other alternatives ? "Zhang, Larry (L.)" <[EMAIL PROTECTED]> wrote: Try this: in struts-config.xml put this And then define YourPlugin as: ... import org.apache.struts.action.PlugIn; public class YourPlugin implements PlugIn { public void destroy() { // holder for things to do } public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { // init your torque } } When you start the server, Torque should be initialized. Let me know if this works. -Original Message- From: newtostruts struts [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 2:09 PM To: Struts Users Mailing List Subject: Re: Init methods in Struts Anyone please... newtostruts struts wrote: I want to initialize torque in Struts2. I've got the code to initialize torque and it works fine. The problem is where do I put that code. Is there a place like an init method which is called just once? Thx all for your help. Vinod - Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search. - Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Food fight? Enjoy some healthy debate in the Yahoo! Answers Food & Drink Q&A. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Init methods in Struts
Try this: in struts-config.xml put this And then define YourPlugin as: ... import org.apache.struts.action.PlugIn; public class YourPlugin implements PlugIn { public void destroy() { // holder for things to do } public void init(ActionServlet servlet, ModuleConfig config) throws ServletException { // init your torque } } When you start the server, Torque should be initialized. Let me know if this works. -Original Message- From: newtostruts struts [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 2:09 PM To: Struts Users Mailing List Subject: Re: Init methods in Struts Anyone please... newtostruts struts <[EMAIL PROTECTED]> wrote: I want to initialize torque in Struts2. I've got the code to initialize torque and it works fine. The problem is where do I put that code. Is there a place like an init method which is called just once? Thx all for your help. Vinod - Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search. - Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: The design of bread crumb trail
Thanks for the answers, but I would like a direct answer to my questions (1)... (2)... . Any thoughts? -Original Message- From: Ray Clough [mailto:[EMAIL PROTECTED] Sent: Thursday, May 10, 2007 1:41 PM To: Struts Users Mailing List Subject: Re: The design of bread crumb trail Are you using S1 or S2? I once implemented a S1 bread-crumbs facility using a custom RequestProcessor to put a stack of page url's into the user's session. This worked well, and allowed a page to return to any of the last 3 pages. I used it to go from the catalog page, where the user made a purchase selection, to a page showing details of the order item, and then back to the catalog page. Since the catalog page could be any of a number of pages, returning to the correct one required some special work. The lack of this feature is why on most e-purchase sites they have a link "continue shopping", which does NOT take you back to where you were. I've been wanting to implement a Struts-2 "BreadCrumbsInterceptor", or maybe a Filter, but have not gotten around to it. I'd be interested if anyone has done this. - Ray Clough Zhang, Larry (L.) wrote: > Say I have two Jsp pages, Page 1, Page 2. > > On page 1 I have some text fields such as Name, SSN for example, and the > user types in Name and SSN and then submit the form and the navigation > goes to page 2. On page 2 I have the bread crumb trail saying Page 1>> > Page 2. Notice that Page 1 is a clickable link, and when you click on > the link, Page 1 is shown. (Page 2, on the bread crumb trail, is not > clickable since the current page is Page 2) > > My question is: (1) in current J2EE/Struts industry standard, does it > make sense to display the data that the user entered on Page 1 for Name > and SSN when coming from the bread crumb trail on Page 2? (2) what > technique I need to use to see the data that the user typed in for Name > and SSN on Page 1, when coming from the bread crumb trail on Page 2? > > My application is a Struts and J2EE based application. > > Thanks. > > > - > 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]
The design of bread crumb trail
Say I have two Jsp pages, Page 1, Page 2. On page 1 I have some text fields such as Name, SSN for example, and the user types in Name and SSN and then submit the form and the navigation goes to page 2. On page 2 I have the bread crumb trail saying Page 1>> Page 2. Notice that Page 1 is a clickable link, and when you click on the link, Page 1 is shown. (Page 2, on the bread crumb trail, is not clickable since the current page is Page 2) My question is: (1) in current J2EE/Struts industry standard, does it make sense to display the data that the user entered on Page 1 for Name and SSN when coming from the bread crumb trail on Page 2? (2) what technique I need to use to see the data that the user typed in for Name and SSN on Page 1, when coming from the bread crumb trail on Page 2? My application is a Struts and J2EE based application. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Load an .xml file when server start up
Can you make it more detail? Do you have sample code on this? FYI, I have already configured in web.xml to load the ActionServlet when server starts up. -Original Message- From: zhangfan [mailto:[EMAIL PROTECTED] Sent: Thursday, April 19, 2007 6:11 AM To: user@struts.apache.org Subject: RE: Load an .xml file when server start up > On 4/18/07, Zhang, Larry (L.) <[EMAIL PROTECTED]> wrote: > > I need to load an .xml file when Websphere server starts up. I am > > using Struts ActionServlet as the only servlet in the app and I do > > have a CustomProcessor extending TilesRequestProcessor. I am trying to > > load the .xml file when the server starts up. I configured to load > > ActionServlet when server starts up in web.xml. Where should I put my > > code to load the .xml file during the server starts up. > > > > Thanks. Maybe the PlugIn interface can provide what you want. It's notified just before and after the application life cycle. http://struts.apache.org/1.3.8/apidocs/index.html Also, you should configure to load ActionServlet when server starts up in web.xml, so that the your plugin will be invoked before that. Good luck. - 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]
Load an .xml file when server start up
I need to load an .xml file when Websphere server starts up. I am using Struts ActionServlet as the only servlet in the app and I do have a CustomProcessor extending TilesRequestProcessor. I am trying to load the .xml file when the server starts up. I configured to load ActionServlet when server starts up in web.xml. Where should I put my code to load the .xml file during the server starts up. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts CustomProcessor
For my app specific security checking, is it a good idea to put the checking logic in processValidate() method from Struts processor or using J2EE filter? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Class path basic question and FileInputStream
I have a program.xml file phycially located in a directory in my web project class path in WSAD,then in my jsp I am trying to read this file, I got an error saying the file is not found. Why? When creating File file = new File("program.xml"); on earth, which directory does JVM tries to find out the file? Thanks. P.S. JSP: <[EMAIL PROTECTED] language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <[EMAIL PROTECTED] import="java.io.File,java.io.FileInputStream"%> Hello world. <% File file = new File("program.xml"); // JVM will fine out the file in the build directory instead of from the class path FileInputStream fis=new FileInputStream(file); byte b[]=new byte[fis.available()]; fis.read(b); String s = new String(b); StringBuffer data = new StringBuffer(s); System.out.println("Data:\n " + data.toString() + "\n"); %> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Xml utilities
What your suggesting is close to what I am trying to do. Do you have some sample code or internet link discussing this? Another interesting question -- when you talk about the schema --, is there a way to define generic schema? -Original Message- From: Andrew Pliszka [mailto:[EMAIL PROTECTED] Sent: Thursday, February 22, 2007 4:48 PM To: Struts Users Mailing List Subject: Re: Xml utilities I think what you have to do is create your own generic XML utility class that is specific to your XML schema, that uses dom4j, or digester or XMLBeans as XML engine. You will have to create your a commons schema base for all your developers, that they will have to follow. Andrew Pliszka Zhang, Larry (L.) wrote: >I know that DOM and SAX but what I am looking for is some sort of >wrapper or single point class so that all team members will use my class >instead of calling DOM or SAX directly. > >-Original Message- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] >Sent: Thursday, February 22, 2007 4:47 PM >To: Struts Users Mailing List >Subject: Re: Xml utilities > >Hi Zhang, > >I am not sure if i got your question correct. But, if you want some >already existing XML parsers then DOM and SAX Parsers are the ones which > >are used extensively. Again, i might be missing more efficient ones. > >- >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: Xml utilities
I know that DOM and SAX but what I am looking for is some sort of wrapper or single point class so that all team members will use my class instead of calling DOM or SAX directly. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, February 22, 2007 4:47 PM To: Struts Users Mailing List Subject: Re: Xml utilities Hi Zhang, I am not sure if i got your question correct. But, if you want some already existing XML parsers then DOM and SAX Parsers are the ones which are used extensively. Again, i might be missing more efficient ones. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Xml utilities
I am trying to develop some classes used for XML parsing or generating purposes. But I think it is difficult to abstract to write a common utility since each XML document is different, and to parse that document, we should have a different parser. So the question is what utility class will look like so that it abstract some common methods/usage so that all the team members can use the utility class. If you can point me some example, that should be great. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts best practice
What logic should be typically added into the CustomRequestProcessor? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Design issue
Jsp tag is supposed to be reusable, if you put the database logic in the tag, then not only the tag is not reusable, but also your view tier contacted with DB directly aross tiers. -Original Message- From: Strachan, Paul [mailto:[EMAIL PROTECTED] Sent: Friday, February 02, 2007 10:50 PM To: Struts Users Mailing List Subject: RE: Design issue Hi, I usually access my cached droplist data directly from the jsp - eg have placed a bean called "ReferenceDataCache" on application scope with getter methods. In jsp I can simply call: I also try to keep my struts forms only containing properties for the http posted data. The controllers responsibility is dealing with http requests (flow control, forwarding to the correct action etc) so I'm not quite sure what you mean by saying "the jsp tag actually by pass the controller to get the data from Datasource" Additionally, specialized data can be added as request attributes, either via your action/helper class or some sort of page controller (tiles has this feature) - the idea behind a page controller (view tier) is your page knows what data it needs, and your jsps are not tied to your actions - in an ideal world you could reuse your jsps without having to change much (or if any) backend java code. Sometimes action classes/methods contain far to much business logic which including supplying data necessary for the view - even if you decide to forward to a different page your action is still preparing data for a page that no longer needs it! Just my 2c Regards, Paul ____________ From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] Sent: Sat 2/3/2007 9:39 AM To: Struts Users Mailing List Subject: Design issue Think about a typical struts app, and on the jsp there are text field and drop downs. There are two approaches: (1) the action populates all the text fields and drop downs from the Database, and then set the value into the actionform, then the JSP will get the values from the actionform (2) the action populates some fields (text field for example), and leave other fields (drop down for example) to JSP to populate, on which a jsp tag can go to the datasource to get the values. I personally prefer (1) since in (2) the jsp tag actually by pass the controller to get the data from Datasource. What do you think? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ** - 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: Design issue
I didn't see a case where (2) is better. Ideas from other folks? Thanks. -Original Message- From: Information Guzzler [mailto:[EMAIL PROTECTED] Sent: Friday, February 02, 2007 6:32 PM To: Struts Users Mailing List Subject: Re: Design issue Definitely (1) if you are strictly following MVC. Is there any specific scenario wherein (2) seems good to you? If there is then explore ways to force it thro' controller On 2/2/07, Zhang, Larry (L.) <[EMAIL PROTECTED]> wrote: > > > Think about a typical struts app, and on the jsp there are text field > and drop downs. There are two approaches: > > (1) the action populates all the text fields and drop downs from the > Database, and then set the value into the actionform, then the JSP will > get the values from the actionform > (2) the action populates some fields (text field for example), and leave > other fields (drop down for example) to JSP to populate, on which a jsp > tag can go to the datasource to get the values. > > I personally prefer (1) since in (2) the jsp tag actually by pass the > controller to get the data from Datasource. > > What do you think? Thanks. > > - > 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]
Design issue
Think about a typical struts app, and on the jsp there are text field and drop downs. There are two approaches: (1) the action populates all the text fields and drop downs from the Database, and then set the value into the actionform, then the JSP will get the values from the actionform (2) the action populates some fields (text field for example), and leave other fields (drop down for example) to JSP to populate, on which a jsp tag can go to the datasource to get the values. I personally prefer (1) since in (2) the jsp tag actually by pass the controller to get the data from Datasource. What do you think? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts vs JSF
Can some one say something about the direction of Struts? Can we say it will be replaced by JSF eventually? Is it easy to migrate struts to JSF? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to get the property value in action
I have the following action mapping, how to get the property value of myProperty in action? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Synchrozertoken in Struts
I have difficulty implementing synchronizer token design pattern in one of me page, on which I have two link (href=...). I understand that it would be easier if the link is a submit button. So my question is that does Struts support synchronizer token for links? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Actionform 's property
Thanks, this works. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, December 20, 2004 11:36 AM To: Struts Users Mailing List Subject: RE: Actionform 's property He doesn't: http://struts.apache.org/userGuide/struts-bean.html#define "McDonnell, Colm (MLIM)" <[EMAIL PROTECTED]> 12/20/2004 11:17 AM Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]> To "Struts Users Mailing List" <[EMAIL PROTECTED]> cc Subject RE: Actionform 's property Why do you want to do this? <% List iWantToGetThisList = (List) pageContext.getAttribute("employeeList"); %> -Original Message- From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] Sent: 20 December 2004 15:58 To: Struts Users Mailing List Subject: Actionform 's property Say I have an action form MyForm extends ActionForm { List employeeList; //set/getter follows... } Suppose in my action class's execute method, I populated employeeList from database, and do myForm.setEmployeeList(List someData); Now in my Jsp, how to get this value and assign this value to a java script variable? Such as: In my jsp: <% List iWantToGetThisList = ??? %> I know one way is that in the action's execute method, I put the employeeList in the request using request.setAttribute("employeeList", employeeList); but I don't want to do this way... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ - 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: Actionform 's property
Thanks. This works. -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Monday, December 20, 2004 11:42 AM To: Struts Users Mailing List Subject: RE: Actionform 's property Well the way you dont wish to use would be the normal way to do it :) The form will be available in the request or session (depending on where you put the form) scope from the jsp under the form's name. So ${formName.employeeList} is the list from a JSTL perspective. From scriptlet, either: =((full.package.name.MyForm)request.getAttribute("formName")).getElmploy eeLi st(); or =((full.package.name.MyForm)session.getAttribute("formName")).getElmploy eeLi st(); Daniel. > -----Original Message- > From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] > Sent: 20 December 2004 15:58 > To: Struts Users Mailing List > Subject: Actionform 's property > > > Say I have an action form > > MyForm extends ActionForm { > List employeeList; > //set/getter follows... > } > > Suppose in my action class's execute method, > I populated employeeList from database, and do > myForm.setEmployeeList(List someData); > > Now in my Jsp, how to get this value and assign this value to a java > script variable? > > Such as: > > In my jsp: > > <% List iWantToGetThisList = ??? %> > > I know one way is that in the action's execute method, I put the > employeeList in the request using request.setAttribute("employeeList", > employeeList); but I don't want to do this way... > - 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]
Actionform 's property
Say I have an action form MyForm extends ActionForm { List employeeList; //set/getter follows... } Suppose in my action class's execute method, I populated employeeList from database, and do myForm.setEmployeeList(List someData); Now in my Jsp, how to get this value and assign this value to a java script variable? Such as: In my jsp: <% List iWantToGetThisList = ??? %> I know one way is that in the action's execute method, I put the employeeList in the request using request.setAttribute("employeeList", employeeList); but I don't want to do this way... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Best Practices
Then can you give me an example of dynamic view? -Original Message- From: Nishant [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 8:26 AM To: Struts Users Mailing List Subject: Re: Struts Best Practices Once you've been using Struts for a while, you'll begin to notice that you spend a lot of time creating ActionForm classes. While these classes are critical to the MVC architecture of Struts (as they implement the view portion), they are usually simply a collection of bean properties and a validate method (also sometimes a reset method.) With the Struts 1.1 release, developers have a new set of options to create their view objects, based around DynaBeans. DynaBeans are dynamically configured Java Beans, which means that they take their properties from some variety of external configuration (usually XML) rather than by explicit methods defined in the class. Thus they give improved performance over ActionForm.It doesnot means that you should always use Dynaform .When Static view is required use ActioForm and when Dynamic view is use DynaForm. regards Nishant Patil Software Engineer Cybage Software Pvt. Ltd. (A CMM Level 3 Company) West Avenue , Kalyani Nagar, Pune - 411 006 Tel: 91-20-4041700 -355 Email: [EMAIL PROTECTED] Website: www.cybage.com There's a difference between knowing the path, and walking the path - Original Message - From: "Y, Rajagopal" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Thursday, November 04, 2004 6:48 PM Subject: RE: Struts Best Practices Can any one let me know what's the advantage of using DynaForm rather than ActionForm or FormBean. -Original Message- From: Gabriel França Campolina [mailto:[EMAIL PROTECTED] Sent: Thursday, November 04, 2004 6:47 PM To: Struts Users Mailing List Subject: Re: Struts Best Practices I sugest some pratice: Use plugin validador Extends TilesRequestProcessor Use DynaForm Use Tiles Use ExceptionHandler Use Designer Partnner I think that this, If any folk has more comments, please go shared. Sory my english, I'm braziliam Gabriel F Campolina SCJP On Thu, 04 Nov 2004 11:05:56 +, Duncan Mills <[EMAIL PROTECTED]> wrote: > Ted Husted has a good set of resources and hints > (http://www.husted.com/struts/) though these may be too specific? You > should also check out the StrutsCatalog in the Wiki > (http://wiki.apache.org/struts/StrutsCatalog) > > Regards > > Duncan Mills > www.groundside.com/blog > > > > > Tushar Agrawal wrote: > > >Hi Folks, > > > >I am handling a web project and using struts framework. Can any one > >tell me where to find stuff on "Struts Best Practices" or "Desgin and Coding Standards for a struts Application". > > > >I request to please share your experinces on "Struts Application > >Design Guidelines". > > > >Million Thanks in Advance > > > >Tushar Agrawal > > > > > > > >// > > Tushar Agrawal > > Software Engineer > > Seclore Technology Pvt Ltd. > >IIT Powai, Bombay (Mah) > > Cell : +919819804870 > > website:www.seclore.com > >/*/ > > > >- > >Do you Yahoo!? > > Check out the new Yahoo! Front Page. www.yahoo.com/a > > > > > > - > 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] - 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]
Object size/memory usage
Let's say I have two object public calss Object1{ private name; private id; private depetId; } public calss Object2{ private name; private id; private depetId; private country; private jobFamily; private isActive; . (there are another 100 attributes) } Then I create Object1 obj1= new Object1(); and set all attributes (name, id, depetId) of this object. Object2 obj2 = new Object2(); and then set the first three attributes(name, id, depetId). My question is that is obj1 and obj2 of the same size or usage of memory? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: My IsValidToken() cannot trap duplicated submission.
In my application, there will be no validation error in the FINAL submission stage; the validation error would be called earlier. If however there are other types of error (like database error, we just stop processing, but the second submission will be identified. Your question is valid, however, one of the synchronizer token usages is to prevent the duplicate submission. If you put the resetToken to the last and you have a long logic before resetToken, here is what will happen (1) you did a first submission (2) then submit again, at this point, the resetToken is not invoked yet, (since there is a long logic before it), the action just thinks this is the same token and it just allows it -which did actually prevent the duplicate submission, right? Thanks. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 11:10 AM To: Struts Users Mailing List Subject: Re: My IsValidToken() cannot trap duplicated submission. Larry, what if an error occurs after form validation, but during processing of the submit, which requires you to forward back to the input page? Erik Zhang, Larry (L.) wrote: >I think the resetToken should be placed as the first place in your action that >processes your submitted form, instead of when you are done processing the submitted >form. > >-Original Message- >From: Erik Weber [mailto:[EMAIL PROTECTED] >Sent: Friday, August 27, 2004 10:57 AM >To: Struts Users Mailing List >Subject: Re: My IsValidToken() cannot trap duplicated submission. > > >When you are done processing the submitted form, invoke "resetToken". > >Erik > > > >PC Leung wrote: > > > >>After clicking submit button and then go back previous page, >>data is still there, click the submit button again. record will be >>saved once more time. The IsValidToken cannot trap the duplicated >>submission. >> >>Initial page: >>http://localhost:8080/erp/AddUserProfile.jsp >>if clicking submit button, goes to >>http://localhost:8080/erp/addUserProfile.do?method=create >> >>struts-config.xml like this. >> > type="com.erp.quotation.AddUserProfileAction" >> name="addUserProfileForm" >> scope="request" >> validate="false"> >> >> >> > type="com.erp.quotation.AddUserProfileDispatchAction" >> name="addUserProfileForm" >> scope="request" >> validate="true" >> parameter="method" >> input="/AddUserProfile.jsp"> >> >> >> >> >> >>Initial page already shows with a token. >> >>Why the following DispatchAction cannot trap duplicated submission? >> >>public final class AddUserProfileDispatchAction extends DispatchAction { >> public ActionForward create (ActionMapping mapping, >> ActionForm form, >> HttpServletRequest request, >> HttpServletResponse response) >> throws Exception { >>HttpSession session = request.getSession(); >>ActionErrors errors = new ActionErrors(); >> if (!isTokenValid(request, true)) { >> errors.add(ActionErrors.GLOBAL_ERROR, >>new ActionError("error.transaction.token")); >> } >> >>- >>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] > > > > - 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: My IsValidToken() cannot trap duplicated submission.
There maybe a same question in the archive, but I can simply state here again: if(!isTokenValid(request){ return mapping.findForward("error_page"); }else{ // good token so prepare for your processing, // but the first thing is to reset the token resetToken(request); // put your logic here to process your action form return mapping.findForward("goodForwardPage"); } -Original Message- From: PC Leung [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 11:08 AM To: Struts Users Mailing List Subject: Re: My IsValidToken() cannot trap duplicated submission. I have resetted token like this in the beginning. if (!isTokenValid(request, true)) { What next to check? On Fri, 27 Aug 2004 11:03:00 -0400, Zhang, Larry (L.) <[EMAIL PROTECTED]> wrote: > I think the resetToken should be placed as the first place in your action that > processes your submitted form, instead of when you are done processing the submitted > form. > > -Original Message- > From: Erik Weber [mailto:[EMAIL PROTECTED] > Sent: Friday, August 27, 2004 10:57 AM > To: Struts Users Mailing List > Subject: Re: My IsValidToken() cannot trap duplicated submission. > > > When you are done processing the submitted form, invoke "resetToken". > > Erik > > > > > PC Leung wrote: > > >After clicking submit button and then go back previous page, > >data is still there, click the submit button again. record will be > >saved once more time. The IsValidToken cannot trap the duplicated > >submission. > > > >Initial page: > >http://localhost:8080/erp/AddUserProfile.jsp > >if clicking submit button, goes to > >http://localhost:8080/erp/addUserProfile.do?method=create > > > >struts-config.xml like this. > > > type="com.erp.quotation.AddUserProfileAction" > > name="addUserProfileForm" > > scope="request" > > validate="false"> > > > > > > > type="com.erp.quotation.AddUserProfileDispatchAction" > > name="addUserProfileForm" > > scope="request" > > validate="true" > >parameter="method" > > input="/AddUserProfile.jsp"> > > > > > > > > > > > >Initial page already shows with a token. > > > >Why the following DispatchAction cannot trap duplicated submission? > > > >public final class AddUserProfileDispatchAction extends DispatchAction { > >public ActionForward create (ActionMapping mapping, > > ActionForm form, > > HttpServletRequest request, > > HttpServletResponse response) > > throws Exception { > > HttpSession session = request.getSession(); > > ActionErrors errors = new ActionErrors(); > > if (!isTokenValid(request, true)) { > > errors.add(ActionErrors.GLOBAL_ERROR, > > new ActionError("error.transaction.token")); > > } > > > >- > >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] > > - 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: My IsValidToken() cannot trap duplicated submission.
I think the resetToken should be placed as the first place in your action that processes your submitted form, instead of when you are done processing the submitted form. -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Friday, August 27, 2004 10:57 AM To: Struts Users Mailing List Subject: Re: My IsValidToken() cannot trap duplicated submission. When you are done processing the submitted form, invoke "resetToken". Erik PC Leung wrote: >After clicking submit button and then go back previous page, >data is still there, click the submit button again. record will be >saved once more time. The IsValidToken cannot trap the duplicated >submission. > >Initial page: >http://localhost:8080/erp/AddUserProfile.jsp >if clicking submit button, goes to >http://localhost:8080/erp/addUserProfile.do?method=create > >struts-config.xml like this. > type="com.erp.quotation.AddUserProfileAction" > name="addUserProfileForm" > scope="request" > validate="false"> > > > type="com.erp.quotation.AddUserProfileDispatchAction" > name="addUserProfileForm" > scope="request" > validate="true" >parameter="method" > input="/AddUserProfile.jsp"> > > > > > >Initial page already shows with a token. > >Why the following DispatchAction cannot trap duplicated submission? > >public final class AddUserProfileDispatchAction extends DispatchAction { >public ActionForward create (ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response) > throws Exception { > HttpSession session = request.getSession(); > ActionErrors errors = new ActionErrors(); > if (!isTokenValid(request, true)) { > errors.add(ActionErrors.GLOBAL_ERROR, > new ActionError("error.transaction.token")); > } > >- >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]
Instance variable is not recommended to be used in Action class
Can some one tell me why the above is correct? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts security/validation
Oracle sql insert needs to escape apostrophes so that you can insert apostrophes. So in your case you may need a utility method to convert all your text containing apostrophes to some thing like ''. Example: If your user enters "I like he's idea", when inserting to data base you need to convert it to be "l like he''s idea". Hope this helps. -Original Message- From: Wiebe de Jong [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 1:32 PM To: 'Struts Users Mailing List' Subject: RE: Struts security/validation I had a similar problem, which I discovered when one of my users tried to enter a street address containing an apostrophe. Since I use apostrophes to delineate my text strings in my SQL statements, this caused a database error. I fixed it by not allowing apostrophes to be entered into any of the test fields. I admit this is overly restrictive, but I don't know how to get the apostrophe into my database otherwise. How would you do it Craig? For SQL destined test, I disallow \ and '. For XML destined text, I disallow <, >, &, \, and ". Wiebe de Jong -Original Message- From: Craig McClanahan [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 10:21 AM To: Struts Users Mailing List Subject: Re: Struts security/validation On Wed, 11 Aug 2004 14:45:05 +0100, James Adams <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm in the process of trying to secure my struts application against "Cross site scripting", "SQL injection" style attacks. > > One of the things I'm doing to prevent this is trying to restrict special characters (;.<>(){}...etc) getting beyond the validator. > Just thinking out loud for a moment ... Cross site scripting attacks don't happen when sensitive characters are inside an *input* field. The problem comes if you *output* the data without filtering for them. That's why the Struts tag, for example, filters "<", ">", "&", and ";" for you unless you explicitly tell it not to, so if you are diligent about how you copy your database data to output pages, you can safely accept these kinds of character in input. I notice that Kishore Senji (one of the other respondents in this thread) is using Google's Gmail, just as I am at the moment. Since this is a web application, it's a good thing that Googe isn't disallowing the magic characters on input into a textarea, or else we would not be able to participate in this conversation :-). Is filtering input really the appropriate strategy for dealing with this problem? If successful it will certainly help, but the approach strikes me as overly restrictive for most application needs. Craig - 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: [OT] Session facade
Thanks all. I especially like " Firstly, just in case that EJBs will be introduced in subsequent phases." However, before the discussion goes far from what I initially wanted, let me ask you this: is your Facade the same as my Session Facade? I am reading http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html, and I think Session Facade itself should be a session EJB, right? -Original Message- From: klute [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 07, 2004 4:34 PM To: Struts Users Mailing List Subject: Re: [OT] Session facade Agree with Bill here. Also... the Constants file is (or can be) quite 'C' as well. There is a temptation to put all of your constants in one place and before you know you end up putting all of your constants encountered within your app there. So totally unrelated stuff gets piled up into one place :-) --- [EMAIL PROTECTED] wrote: > :) > > Perhaps I could have used Exceptions but well at > least I use a Constant > file a little better! > The more I think about the better it seems to > get damn I have some > code rewriting to do... > > Thanks Bill. > > > > > > > Bill Siggelkow <[EMAIL PROTECTED]> > Sent by: news <[EMAIL PROTECTED]> > 07/07/2004 04:10 PM > Please respond to "Struts Users Mailing List" > > > > > > To: [EMAIL PROTECTED] > cc: > > Subject:Re: [OT] Session facade > Classification: > > > Glenn, I was with you until the part about the > "return code" ... I think > it would be better to translate the DAOException to > some > BusinessServiceException or something similar > instead of a "return code". > Generally, I try and avoid the "method returns a -1 > to indicate that the > operation failed" kind of thing -- it is so 'C' like > :) > > [EMAIL PROTECTED] wrote: > > > my 2 cents... > > > > I am using the Facade in my current project. > > > > Firstly, just in case that EJBs will be introduced > in subsequent phases. > > > > Secondly, the DAO throws exceptions of > DAOException & a FatalException. > > Say that a Stored Procedure returns an application > error (invalid > > parameter in a SP); this is treated as a > DAOException. > > Say that the DB is not there this is treated as a > FatalException. > > > > The Facade catches and interprets the DAOException > with a Return Code. > > Say that the DB is used to authenticate a User Id > and Password. > > The Facade is where the DAOException to translated > into a simple Return > > Code that the Action will check for. > > > > This a way the Action classes are nice a clean! > > - Glenn > > > > > > > > > > > > "Ricardo Cortes" <[EMAIL PROTECTED]> > > 07/07/2004 03:28 PM > > Please respond to "Struts Users Mailing List" > > > > > > > > > > > > To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > > cc: > > > > Subject: RE: Session facade > > Classification: > > > > > > I would assert you don't need the Session Facade > as one of the > advantages > > of the Session Facade is it's ability to abstract > the low level > operations > > of the Session EJBs from upper layers of your > architecture. You could > > probably have your actions talking to a Business > Delegate layer or your > > DAO layer directly. Of course, this is just one > viewpoint. > > > > -Original Message- > > From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, July 07, 2004 2:59 PM > > To: Struts Users Mailing List > > Subject: Session facade > > > > > > > > It seems session facade design pattern is > becoming ubiquitous. My > > question is that > > if we are not going to use EJB(but we do have > DAO-data access object), > > does it still make sense to use session facade? > > > > Thanks. > > > > > > > > > - > > 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] > > > > __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail - 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]
Session facade
It seems session facade design pattern is becoming ubiquitous. My question is that if we are not going to use EJB(but we do have DAO-data access object), does it still make sense to use session facade? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: security roles
Thanks Pedro. I am not using Tomcat, instead I am using IBM WSAD , so if I define the following lines in web.xml, A normal employee user Employee a manager user can do PR Manager can I access Employee and/or Manager role in struts-config.xml? (2)also say a manager logon our sites, I can obtain the info for this user such as "managerFlag", and then where should I put the logic to decide whether the user is a manager or an employee, and how to map this user to a security-role defined above? -Original Message- From: Pedro Salgado [mailto:[EMAIL PROTECTED] Sent: Monday, June 14, 2004 3:38 PM To: Struts Users Mailing List Subject: Re: security roles In struts-config.xml, define the actions this way: Only manager can execute the action Only employee can execute the action Manager or employee can execute the action Everyone can execute the action You can define the roles on your TOMCAT_HOME/conf/tomcat-users.xml (for Tomcat 4.1.30). Pedro Salgado On 04/06/14 20:24, "Zhang, Larry (L.)" <[EMAIL PROTECTED]> wrote: > I want to define two security roles, one of which is employee and another is > manager. Employee is not able to see some resources belonging to manager. > Under J2EE standard, we can define these in web.xml, it also seems to me that > this can be done in struts. > > Can you point out how to perform this task? Detailed instruction is > appreciated. > > Thanks. > > > - > 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]
security roles
I want to define two security roles, one of which is employee and another is manager. Employee is not able to see some resources belonging to manager. Under J2EE standard, we can define these in web.xml, it also seems to me that this can be done in struts. Can you point out how to perform this task? Detailed instruction is appreciated. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: design security issue
Thank you Frank and Yuanbo, for the points. Our application is set up in SSL and password encryption. I guess my question is pretty detail oriented. See I want a design solution so that if the person coming to a page without visiting previous page, I want to display the error page. Also since one manage has a lot of employees so I want to make sure the data is not somehow messed up. Thanks. -Original Message- From: Frank Zammetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 08, 2004 5:41 PM To: [EMAIL PROTECTED] Subject: RE: design security issue Excellent point, thanks for adding it! Frank >From: "Wang, Yuanbo" <[EMAIL PROTECTED]> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >Subject: RE: design security issue >Date: Tue, 8 Jun 2004 15:32:16 -0500 > >One comment. Make sure your ActionServlet intercepts all URL patterns so >any HTTP request need to get session validated first. > >Yuanbo > >-Original Message- >From: Frank Zammetti [mailto:[EMAIL PROTECTED] >Sent: Tuesday, June 08, 2004 3:34 PM >To: [EMAIL PROTECTED] >Subject: RE: design security issue > > >To really do security properly, you really should externalize it using a > >product like Netegrity's SiteMinder. That would be my first suggestion, >but >there is considerable cost in something like that, so it's not right for > >everyone or every situation. > >So, you can do some more minor things within your aop that should give >you >decent results: > >(1) Don't do anything within any action unless a valid session is found. > >This will keep quite a few people out of your app on it's own since they > >won't be able to just hack together a URL with a query string. I >accomplish >this in one app I did by having an ActionHelpers class, and the first >thing >any of my Actions do is call a validateSession() static method. If no >session is present, forward right then and there to the logon page. You > >must be careful also that there is one and only one place in your code >that >creates a session, your logon Action most likely. > >(2) Make sure your running through SSL. Takes care of packet sniffing, >more >or less. > >(3) Encrypt the passwords in your database with a one-way hash >encryption. >Makes administration a little bit of a pain (no way to read the >password), >but it also makes hacking the system a little tougher. > >(4) Have good policies with regard to session timeouts and password >structure. A 5-minute timeout might be too short depeneding on the app, >but >it's good security-wise. Make sure you have solid rules for what a >password >must look like (i.e., 6-10 characters in length, at least one >non-alphabetic >character and one non-alphanumeric character, must be chaged once a >month, >etc.). > >These are all easy to implement, and will lead to a fairly secure >system. >Not perfect, but reasonably secure. Depending on your environment, it >might >be plenty. > >Frank > > >From: "Zhang, Larry (L.)" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Subject: design security issue > >Date: Tue, 8 Jun 2004 15:14:36 -0400 > > > >I have an web application on which the manager can view his manage tree > > >and > >select his employee for transactions (such as Perfromance Rating, >putting > >on Leave of absence). Definitely it is very vital in this case to keep >the > >security or make sure one data for one employee is submitted not for > >another employee. Another thinking is that if the user come to a page >via a > >bookmark or come to the page without visiting the previous page, we >should > >catch this event and disallow the further action. I need to come up >some > >design solutions so that this security is handled elegantly. Any ideas? >If > >you know some sites discussing this, please let me know. > > > >Thanks. > > > >Larry Zhang > > > >- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > >_ >Watch the online reality show Mixed Messages with a friend and enter to >win >a trip to NY >http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/ >01/ > > >- >To unsubscribe, e-mail: [EMAIL P
RE: Struts 1.1 J2EE level?
My answer is nothing theoretical but is practical: We are using Struts 1.1 with J2EE 1.2 ( servlet 2.2 and JSP 1.1), they are running just fine. -Original Message- From: Yulin Zhao [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 08, 2004 4:35 PM To: Struts Users Mailing List Subject: Struts 1.1 J2EE level? Our app server only supports J2EE1.2. Does struts1.1 have any requirement that we need use what level of J2ee? (e.g.: do struts framework jars use any New features from Servlet 2.3 or JSP1.2 or above?) I searched a few websites and asked a few more experienced friends but didn't find a sure answer. Struts1.1 seems to work with JSTL1.0 but implementations of JSTL1.0 (Jakarta or WebSphere) are both based on J2EE1.3 (I don't need JSTL). Thanks much Yulin. - 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]
design security issue
I have an web application on which the manager can view his manage tree and select his employee for transactions (such as Perfromance Rating, putting on Leave of absence). Definitely it is very vital in this case to keep the security or make sure one data for one employee is submitted not for another employee. Another thinking is that if the user come to a page via a bookmark or come to the page without visiting the previous page, we should catch this event and disallow the further action. I need to come up some design solutions so that this security is handled elegantly. Any ideas? If you know some sites discussing this, please let me know. Thanks. Larry Zhang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: caching data in application server and EJB usage
If you cache in the oracle you still need a connection to it to get the data when running Java. Please remember that I want to ask if we can use EJB replacing the pure Java object caching... -Original Message- From: Jose Ramon Diaz [mailto:[EMAIL PROTECTED] Sent: Monday, June 07, 2004 10:12 AM To: 'Struts Users Mailing List' Subject: RE: caching data in application server and EJB usage And why don´t you cache it in Oracle? Isn´t it enough? > -Mensaje original- > De: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] > Enviado el: lunes, 07 de junio de 2004 15:54 > Para: Struts Users Mailing List > Asunto: caching data in application server and EJB usage > > > I have a Oracle table that contains more than 1 rows and > this table is almost a read-only table -- meaning that our > web application uses this table just for read purposes. Since > accessing the data in this table is frequent, so we decided > to do some sort of caching so that the performance is meet. > We cache the data from this table to application server's > memory. My question is that in this case can we use EJB > somehow to achieve the same goal? We select this because > caching the data in the memory is memory expensive and our > system has some memory constraints. > > Can you also discuss the pros and cons of using EJB and pure > Java object caching (of data to application server). > > Thanks for your answers. > > Larry Zhang > > - > 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]
caching data in application server and EJB usage
I have a Oracle table that contains more than 1 rows and this table is almost a read-only table -- meaning that our web application uses this table just for read purposes. Since accessing the data in this table is frequent, so we decided to do some sort of caching so that the performance is meet. We cache the data from this table to application server's memory. My question is that in this case can we use EJB somehow to achieve the same goal? We select this because caching the data in the memory is memory expensive and our system has some memory constraints. Can you also discuss the pros and cons of using EJB and pure Java object caching (of data to application server). Thanks for your answers. Larry Zhang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
People Soft Component Interface
Sorry for this off topic question, but I don't know which group I should post this question. I posted this on People Soft company discussion group, but no one answered my question. EJB in Java as a technology has become more and more widely used to perform transaction (update, delete, insert) against database. When using Java to perform a People Soft 8 transaction, we need to communicate to People Soft 8 tables via Component Interface(a People Soft 8 Java term). My question is that does using Component Interface prevent we employee EJB? Do you or you know of some one using EJB to perform People Soft 8 transaction via Component Interface? Thanks folks. Larry Zhang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
When to use EJB?
Our web application uses Web sphere application server. The main transaction is to update People Soft database tables. We are using component interface (a People Soft term) to update the underline tables in People Soft. Associated to a transaction ( a People Soft database update for example), there will be another Oracle table insert. (The Oracle and People Soft databases are in different Unix boxes). Sounds like a good candidate to use 2 phase commit, and also a good candidate for EJB. I want to gather some pros and cons as whether or not we should use EJB in this case. And also if it is possible to employee 2 phase commit protocol. I appreciate your insights. Thanks. Larry Zhang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: validator.xml usage
You can define you own validator if you like: Say you define this in validation.xml (meaning you want to validate attributeA by myRequried() method) In your validator-rules.xml you define: Now you should in your Validator.java define/code validateMyRequried() method and pass in (java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest), Hope this helps. Larry Zhang -Original Message- From: gads zooks [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 01, 2004 4:32 PM To: Struts Users Mailing List Subject: Re: validator.xml usage that is trueif u want to use server side validation you can specify that in the struts-config.html something like this if you want to use javascript toowith the same setup (validation.xml, validator-rules.xml) u can add the tag to your jsp and it will show u the errorsthere are also , u can check out the info at husted.com/struts site hope this helps amit Rodrigo Oliveira <[EMAIL PROTECTED]> wrote: The validation.xml you put the rules for client and server validation. The struts validator validate your forms based on same validation rules. []´s Rodrigo Oliveira [EMAIL PROTECTED] - Original Message - From: To: Sent: Tuesday, June 01, 2004 5:15 PM Subject: validator.xml usage > Is the validator.xml just for client-side validation? Or also for > server-side validation > > > --- > > Thanks... > > Mick Knutson > > > > 525 Market Street, SF, CA 94103 > > (415) 222-1020 > > [EMAIL PROTECTED] > > MAC A0103-223 > --- > > > > - > 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] - Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: validator.xml usage
validation.xml and validator-rules.xml in Struts validation framework are used for both client and server side validation. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 01, 2004 4:15 PM To: [EMAIL PROTECTED] Subject: validator.xml usage Is the validator.xml just for client-side validation? Or also for server-side validation --- > Thanks... > Mick Knutson > > 525 Market Street, SF, CA 94103 > (415) 222-1020 > [EMAIL PROTECTED] > MAC A0103-223 --- - 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: Session size
It sounds like very promising to me. The only consideration is that caching those objects may cause another issue of usage of the memory. And also when the tree is changed (by deleting/transferred one employee from the tree) we need to somehow validate/rebuild the cached list of objects. Is this approach sometimes called object pool? Thanks. -Original Message- From: Riyad Kalla [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 12:25 PM To: Struts Users Mailing List Subject: Re: Session size Hmm, I should clarify what I meant: The DAO will be at the application scope, so if you cache say the last 50 queries, the cache is held at application scope. In your case, this will still help. Lets say you have 20 users all working on the site, they all hit their "Show employement Tree" page, and you hit the UserDAO.getEmploymentTreeForUserID(int userID) method for all 20 people with different ID's. That will perform 20 separate queries, cache the result, and return it. Now when all those users hit the refresh button on their web page, it hits your DAO again, the same method, with all 20 separate ID's again. But this time, all 20 of them are successful cache hits and are returned immediately. Now say users 1-5 log out and come back 2 hours later and check your employement tree page, IF their list had been stored in their sessions, that would require you to hit the DB again to reload the lists, but because your caching the results in your DAO itself, all of those 5 users that came back and check their employement tree, are getting all their results from the DAO's cache again since it was stored at the application level (the cache is still valid). The other sexy thing is that if someone calls UserDAO.removeUserByID(4) or something liek that, your DAO knows to either (a) aggressively invalid all the cache and have all caches rebuilt, OR (b) you could take some time to intelligently remove that user from all cached values if it was import to you to keep your caches full. It just gives you more options since all your cache building/invalidating occurs in the same DAO class, instead of needing to worry about synchronizing multiple resources and classes with eachother. Did that make sense? Best, Riyad On Thursday 27 May 2004 09:13 am, Zhang, Larry (L.) wrote: > In my case I have to keep the List in the session level instead of > application level since different user will have different list of > employees. > > -Original Message- > From: Riyad Kalla [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 27, 2004 11:53 AM > To: Struts Users Mailing List > Subject: Re: Session size > > > Mike, > Good suggestions. I was dealing with something like this recently and > decided that for me, adding caching at the DAO level: > > e.g. List userList = UserDAO.getAllUsers(); > > would offer the biggest performance benefit since it would be: > > (a) application wide, instead of per session > (b) returned Lists are 4-byte pointers to the actual list object cached in > the DAO > (c) The DAO itself handles all manipulation of those types, so it knows > when to invalid its own cache (on inserts/updates/removes) > > > What do people think about this strategy? (Before I spend a week > implementing it :) > > Best, > Riyad > > On Thursday 27 May 2004 08:49 am, Mike Zatko wrote: > > I personally think its too big. Large amounts of data like that should > > be put in request scope so that it gets flushed out of memory right > > away. If you need the data to be persistent through the user's session > > lifetime, mabye try serializing it to a database. Of course, different > > situations call for different solutions. Also, I would try and replace > > your Vector with a non-synchronized Collection like an ArrayList or > > LinkedList unless you have some sort of mutlithreaded access to this > > collection. > > > > Riyad Kalla wrote: > > >Larry, > > >Good question. I am curious what others think about this situation as > > > well. > > > > > >On Thursday 27 May 2004 08:24 am, Zhang, Larry (L.) wrote: > > >>It is apparent true that if the session size is big, the performance > > >> will be negatively affected. The question is that how to actively > > >> control the size of session. > > >> > > >>Let's discuss this question: > > >> > > >>I have a page which displays all the subordinates of a manager, for > > >> some reasons I want to create a List or a Vector containing all the > > >> subordinates and put this List or Vector to the session. Each element > > >> in the List or Vector is a Java object, Employee( each Employee object &g
RE: Session size
Sounds a good explanation, Riyad. I will be loading the DisplayObject directly from the DB with a query, and thus it seems that you agree on going with the smaller object. Thanks. -Original Message- From: Riyad Kalla [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 12:16 PM To: Struts Users Mailing List Subject: Re: Session size Larry, It depends on how you load the elements. If you are creating the smaller objects by first loading the full objects, then just save the time and use the full ones. If however you are loading the DisplayObjects directly via a Hibernate query of course that will be magnitudes smaller. Also you may consider what the average size of your 200 Strings are. If its around 24 characters each (maybe a name, or name of something) that's say roughly 30 (object overhead is probably more) x 200 = 6000 bytes (6k) and maybe as high as 8k for overhead (I'm pulling numbers out of air here, I don't know the VM details on this). Where as your 5-string object is going to be considerably smaller (30 x 5 = 150 bytes, ~0.15K). I'd say if you can load the DisplayObject directly from the DB with a query, definately do that, especially if your employement trees can get large (100s or 1000s). Best, Riyad On Thursday 27 May 2004 09:06 am, Zhang, Larry (L.) wrote: > I would be more interested to know if we change the big elements in the > list to much smaller ones in the list, does it reduce the session (my > second part of question) at all? - 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: Session size
In my case I have to keep the List in the session level instead of application level since different user will have different list of employees. -Original Message- From: Riyad Kalla [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 11:53 AM To: Struts Users Mailing List Subject: Re: Session size Mike, Good suggestions. I was dealing with something like this recently and decided that for me, adding caching at the DAO level: e.g. List userList = UserDAO.getAllUsers(); would offer the biggest performance benefit since it would be: (a) application wide, instead of per session (b) returned Lists are 4-byte pointers to the actual list object cached in the DAO (c) The DAO itself handles all manipulation of those types, so it knows when to invalid its own cache (on inserts/updates/removes) What do people think about this strategy? (Before I spend a week implementing it :) Best, Riyad On Thursday 27 May 2004 08:49 am, Mike Zatko wrote: > I personally think its too big. Large amounts of data like that should > be put in request scope so that it gets flushed out of memory right > away. If you need the data to be persistent through the user's session > lifetime, mabye try serializing it to a database. Of course, different > situations call for different solutions. Also, I would try and replace > your Vector with a non-synchronized Collection like an ArrayList or > LinkedList unless you have some sort of mutlithreaded access to this > collection. > > Riyad Kalla wrote: > >Larry, > >Good question. I am curious what others think about this situation as > > well. > > > >On Thursday 27 May 2004 08:24 am, Zhang, Larry (L.) wrote: > >>It is apparent true that if the session size is big, the performance will > >>be negatively affected. The question is that how to actively control the > >>size of session. > >> > >>Let's discuss this question: > >> > >>I have a page which displays all the subordinates of a manager, for some > >>reasons I want to create a List or a Vector containing all the > >> subordinates and put this List or Vector to the session. Each element in > >> the List or Vector is a Java object, Employee( each Employee object has > >> 200 String attributes, among which 5 are needed to be displayed on the > >> screen) > >> > >>A picture of this situation is: > >> > >>Vector allSubordinates = new Vector(); > >>allSubordinates.add(Employee1); > >>allSubordinates.add(Employee2); > >>... > >> > >>allSubordinates.add(Employee1000); > >> > >> > >>session.setAttribute("allSubordinates",allSubordinates); > >> > >>Do you think this actually makes the session very big? > >> > >> > >>Then what will be the improvement of the following? Instead of add all > >> the employee objects, we create a very small object called > >> DisplayObject, which just contains the 5 attributes required on the > >> screen. > >> > >>Vector allSubordinates = new Vector(); > >>allSubordinates.add(DisplayObject1); > >>allSubordinates.add(DisplayObject2); > >>... > >> > >>allSubordinates.add(DisplayObject1000); > >> > >> > >>session.setAttribute("allSubordinates",allSubordinates); > >> > >>Your sharing of opinion is appreciated! > >> > >>Thanks. > >> > >>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] - 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: Session size
Thanks for the opinion. Changing to use a LinkedList is of course no problem. And we have to store the list to session per application requirements. I would be more interested to know if we change the big elements in the list to much smaller ones in the list, does it reduce the session (my second part of question) at all? Thanks. Larry -Original Message- From: Mike Zatko [mailto:[EMAIL PROTECTED] Sent: Thursday, May 27, 2004 11:50 AM To: Struts Users Mailing List Subject: Re: Session size I personally think its too big. Large amounts of data like that should be put in request scope so that it gets flushed out of memory right away. If you need the data to be persistent through the user's session lifetime, mabye try serializing it to a database. Of course, different situations call for different solutions. Also, I would try and replace your Vector with a non-synchronized Collection like an ArrayList or LinkedList unless you have some sort of mutlithreaded access to this collection. Riyad Kalla wrote: >Larry, >Good question. I am curious what others think about this situation as well. > >On Thursday 27 May 2004 08:24 am, Zhang, Larry (L.) wrote: > > >>It is apparent true that if the session size is big, the performance will >>be negatively affected. The question is that how to actively control the >>size of session. >> >>Let's discuss this question: >> >>I have a page which displays all the subordinates of a manager, for some >>reasons I want to create a List or a Vector containing all the subordinates >>and put this List or Vector to the session. Each element in the List or >>Vector is a Java object, Employee( each Employee object has 200 String >>attributes, among which 5 are needed to be displayed on the screen) >> >>A picture of this situation is: >> >> Vector allSubordinates = new Vector(); >> allSubordinates.add(Employee1); >> allSubordinates.add(Employee2); >> ... >> >> allSubordinates.add(Employee1000); >> >> >>session.setAttribute("allSubordinates",allSubordinates); >> >>Do you think this actually makes the session very big? >> >> >>Then what will be the improvement of the following? Instead of add all the >>employee objects, we create a very small object called DisplayObject, which >>just contains the 5 attributes required on the screen. >> >> Vector allSubordinates = new Vector(); >> allSubordinates.add(DisplayObject1); >> allSubordinates.add(DisplayObject2); >> ... >> >> allSubordinates.add(DisplayObject1000); >> >> >>session.setAttribute("allSubordinates",allSubordinates); >> >>Your sharing of opinion is appreciated! >> >>Thanks. >> >>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] > > > > -- Michael H. Zatko WebSphere Developer Boscov's Information Services Work: 610-929-7317 Home: 610-562-2407 - 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]
Session size
It is apparent true that if the session size is big, the performance will be negatively affected. The question is that how to actively control the size of session. Let's discuss this question: I have a page which displays all the subordinates of a manager, for some reasons I want to create a List or a Vector containing all the subordinates and put this List or Vector to the session. Each element in the List or Vector is a Java object, Employee( each Employee object has 200 String attributes, among which 5 are needed to be displayed on the screen) A picture of this situation is: Vector allSubordinates = new Vector(); allSubordinates.add(Employee1); allSubordinates.add(Employee2); ... allSubordinates.add(Employee1000); session.setAttribute("allSubordinates",allSubordinates); Do you think this actually makes the session very big? Then what will be the improvement of the following? Instead of add all the employee objects, we create a very small object called DisplayObject, which just contains the 5 attributes required on the screen. Vector allSubordinates = new Vector(); allSubordinates.add(DisplayObject1); allSubordinates.add(DisplayObject2); ... allSubordinates.add(DisplayObject1000); session.setAttribute("allSubordinates",allSubordinates); Your sharing of opinion is appreciated! Thanks. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts error message
Struts has an internal tag to show the action errors on the current jsp page, which is OK. However, our business requirement is that in case there is an error, we display the error on an error jsp, then it is not advisable or easily to use since this tag is normally placed on the current jsp page. My questions are (1) is there any way to do in struts to display the error on an error jsp? (2)What is your opinion on pros and cons of these two approaches: Display the error on the current page and display the error on a separate error page? Please answer questions in order if possible. Thanks. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Sharing what I've learned: locale switching
Additionally, if you want other key(other than org.apache.struts.action.LOCALE =Globals.LOCALE_KEY) to store your locale, you can do this: session.setAttribute("myNewMeaningfulKey",myLocaleObject), then in your JSP you would use this: . This is the way the locale attribute in message tag is used in struts. Thanks. Larry Zhang -Original Message- From: Wang, Yuanbo [mailto:[EMAIL PROTECTED] Sent: Friday, May 14, 2004 2:40 PM To: Struts Users Mailing List Subject: RE: Sharing what I've learned: locale switching Thanks for sharing the information. Basically struts using the following method to decide which Locale is in the session, then load the corresponding resource bundle: protected Locale getLocale(HttpServletRequest request) { HttpSession session = request.getSession(); Locale locale = (Locale)session.getAttribute("org.apache.struts.action.LOCALE"); if(locale == null) locale = defaultLocale; return locale; } So to switch the Locale dynamically, update the Locale object saved in the session. Thanks, Yuanbo -Original Message- From: None None [mailto:[EMAIL PROTECTED] Sent: Friday, May 14, 2004 2:16 PM To: [EMAIL PROTECTED] Subject: Sharing what I've learned: locale switching Because this might be helpful to others, and because I probably would have spent another couple of hours figuring it out on my own without the help of some people on this lsit, I wanted to give back as much as I could. So, here's a consolidated bit of info I've learned about switching language in your Struts apps... What I have is a file manager application, more or less just for me to learn Struts. I wanted to have the ability to switch languages on-the-fly. To do this, I've done the following: (1) I created two files and placed them in WEB-INF/classes. They are ofmResources_en.properties and ofmResources_de.properties (en for English, de for German). These files contain various text strings in both language. For instance, there is a lable on the screen for file uploads which is defined as follows: labels.uploadFile=Upload a file: and for the German version: labels.uploadFile=hochladen Sie eine Datei: (2) I added the following entry to web.xml, as an init parameter of the ActionServlet: application ofmResources As near as I can tell, NO entries are required in struts-config.xml. You also do NOT need to do anything for each version of the resource file. As long as they are named x_ll.properties, where x is the value of the application parameter above, and ll is a valid country code, that's all there is to it. (3) Next, I added some flag graphics to my web pages, one an American flag, one a German flag. Here is the HTML for them: Pretty trivial stuff there. (4) Next, I created an ActionForm called ChangeLocaleActionForm as follows: package com.mycompany.ofm.actionforms; import org.apache.struts.action.*; public class ChangeLocaleActionForm extends ActionForm { private String languageCode = null; public ChangeLocaleActionForm() { languageCode = null; } public void setLanguageCode(String inLanguageCode) { languageCode = inLanguageCode; } public String getLsnguageCode() { return languageCode; } } (5) Next, I created an accompanying Action: package com.mycompany.ofm.actions; import java.util.*; import javax.servlet.http.*; import com.omnytex.ofm.actionforms.*; import org.apache.struts.*; import org.apache.struts.action.*; public class ChangeLocaleAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ChangeLocaleActionForm claf = (ChangeLocaleActionForm)form; String languageCode = claf.getLsnguageCode(); request.getSession().setAttribute(Globals.LOCALE_KEY, new Locale(languageCode)); return mapping.findForward("showPathContents"); } } As it turns out as someone here informed me, there is "automagically" a Locale in session, created based on what is sent by the browser. So, by default on my system the value en_US is stored in session under the name Globals.LOCALE_KEY. By the way, as near as I can tell, the _US portion of the language code doesn't matter (I'm sure it MATTERS, but for what I'm describing it doesn't). So, this allows one to switch the locale (read: language) of the app by clicking a flag. No big deal. (6) To make use of this all, there are two concerns... One is messages in a JSP rendered with the tag, the other is messages returned from an Action that you want to display to the user. For the JSP side of things, it's simple... you just do this... Struts uses the
RE: How to access a variable message resource bundle from JSP
Suppose you have <% String countryCode = "en"; %> I think will do your work. Another way is that you save your Locale object to session in jsp something like session.setAttribute(Globals.LOCALE_KEY, yourLocaleObject); then Struts can just find out the correct resource for different locale when you use the following in the jsp Hope this helps. Larry Zhang -Original Message- From: None None [mailto:[EMAIL PROTECTED] Sent: Friday, May 14, 2004 11:40 AM To: [EMAIL PROTECTED] Subject: How to access a variable message resource bundle from JSP Hi again everyone... yesterday, with assistance from some of you folks, I was able to get multiple message resource bundles working to return a Locale-specific error message from one of my Action classes. Very cool. Now I'm trying to do the same thing in a JSP. Here's my question... in my JSP's, when using , I know that I can specify bundle="en" or bundle="de" and that works, since I have a properties file set up for English and German. But how can I set the bundle attribute to a variable value? In other words, at present I have String in session called countryCode, and it's literally the value EN, DE, or whatever else. So, is there a way I can plug that string into the tag's bundle attribute? Or, is there another method of specifying which of a number of message resource bundle to look in for a specific key that can be varied programmatically? Or further still, is there specifically a special method to get locale-specific string in a JSP tag, as I am now able to do in my Action classes? Thanks all! _ MSN Toolbar provides one-click access to Hotmail from any Web page - FREE download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/ - 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]
Struts internationalization using
This sounds easy, but I couldn't figure out how? Suppose I have two resource files for two locales: OnlineResource.properties (for default locale) OnlineResource_it.properties (for locale Italian) In my jsp, I can use to retrieve the default locale value for myKey, then how to retrieve the property for Italian locale. The struts doc says we can use , the thing is what should I pass to locale parameter? Thanks. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DynaValidatorForm in struts
When using DynaValidatorForm, you just put the fields in the struts configuration xml file, and you don't need a formbean to set all the fields manually, which in turn saves your developing time. I am asking in struts community, is there any reason/encouragement for not using DynaValidatorForm? Thanks. Larry Zhang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts.jar and struts source code
Niall, I am not sure if src/share contains all the .java files corresponding to classes in struts.jar. What happens is that I deleted struts.jar and put all the source files under src/share and then compile all the files in WSAD trying to generate all the classes in struts.jar, and I found one file ActionServlet.java doesn't compile since this class import org.xml.sax.InputSource, but there is no InputSource in the class path. And I also didn't find org.xml.sax.InputSource in struts.jar. So did anyone has chance to include the struts source file to your project instead of just include a strus.jar? Thanks. Larry -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 05, 2004 6:51 PM To: Struts Users Mailing List Subject: Re: struts.jar and struts source code The source download includes alot more than just whats in struts.jar (documentation, for automated testing stuff, examples etc etc) but all the stuff in struts.jar is in the src/share directory. Niall - Original Message - From: "Zhang, Larry (L.)" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, May 05, 2004 11:38 PM Subject: struts.jar and struts source code When using Struts, it is easy to download struts.jar and put it in your class path and then you are done. What if you want to use source code instead of binary download. How can we identify those classes included in struts.jar from the source download? This seems not to be easy since source download bundle seems to be very messy. Thanks. Larry Zhang Ford Motor Company - 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]
struts.jar and struts source code
When using Struts, it is easy to download struts.jar and put it in your class path and then you are done. What if you want to use source code instead of binary download. How can we identify those classes included in struts.jar from the source download? This seems not to be easy since source download bundle seems to be very messy. Thanks. Larry Zhang Ford Motor Company - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tlib-version and tlibversion;jsp-version and jspversion
When you write your own tablibrary descriptor file, you need to supply several mandatory elements. While a lot of articles saying they use tlib-version and jsp-version, our application uses tlibversion and jspversion. And also struts taglibrary also uses tlibversion and jspversion(example struts-bean.tld). I am asking why it seems both are working, on the earth, which ones are correct? Thanks in advance. Larry Zhang - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]