Re: Handling Exceptions
You should probably create a global exception handler in your Struts configuration file. Something like this: global-exceptions exception key=global.error.internal path=/ErrorPage.jsp scope=request type=java.lang.Exception/ /global-exceptions hope this helps --Alen - Original Message - From: Syed Kazim Hussain [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 7:52 AM Subject: Handling Exceptions I have been using Struts as the MVC framework and Sitemesh as templates. It is working smoothly. Only problem is I want to forward the page to an error page whenever there is an exception. So in Tomcat, I have specified the option for forwarding the request to ErrorPage.jsp whenever we encounter a 500 Internal Server Error. But the page is not being forwarded. Instead an exception is thrown on the Error Page: java.lang.IllegalStateException: getOutputStream() has already been called for this response Any comments ! - 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: DispatchAction?
Bjorn T Johansen wrote: I am starting to use DispatchAction instead of some of my actions to simplify CRUD operations, but I have a question. How do I integrate which method to call in a html:form tag? I.e. if I could write http://localhost/app/order?method=create then it wouldn't be a problem, but how do I write the same thing using html:form? Just create another global forward for submitting the form. forward name=order_submit path=/do/order?method=create/ Then use html:form action=order_submit/ (html:form action=/order focus=date where should I put the method parameter? ) Regards, BTJ --- Bjørn T Johansen (BSc,MNIF) Executive Manager [EMAIL PROTECTED] Havleik Consulting Phone : +47 67 54 15 17 Conradisvei 4 Fax : +47 67 54 13 91 N-1338 Sandvika Cellular : +47 926 93 298 http://www.havleik.no --- The stickers on the side of the box said Supported Platforms: Windows 98, Windows NT 4.0, Windows 2000 or better, so clearly Linux was a supported platform. --- - 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]
AW: Validator problem with integers
How about using a regexp? field property=phone depends=required, mask arg0 key=Daytime Phone box 3 resource=false/ var var-namemask/var-name var-value^\d{4}$/var-value /var /field HTH Robert -Ursprüngliche Nachricht- Von: David Graham [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 18. Juni 2003 23:13 An: [EMAIL PROTECTED] Betreff: Re: Validator problem with integers An integer validation is not the same as a are all characters numeric validation. I don't think the validator currently has a numeric check but patches are welcome. David Hi folks, Using struts-RC2, when using Validator with a dependency on integer validation, I have a problem with the validator assuming that any integer starting with zero 0 is necessarily octal. In one example, I have a form where people enter phone numbers. Which is split up into 3 text boxes. Area code, 3 digits, last 4 digits. A fairly common way to break it up. Here is the validation.xml entry for one such field: field property=dayPhone3 depends=required, integer, minlength, maxlength arg0 key=Daytime Phone box 3 resource=false/ arg1 name=minlength key=${var:minlength} resource=false/ arg2 name=maxlength key=${var:maxlength} resource=false/ var var-namemaxlength/var-name var-value4/var-value /var var var-nameminlength/var-name var-value4/var-value /var /field Numbers like 0897 will cause the ... must be an integer message. Obviously it is not a valid octal number, and I know that the format of these numbers would appear as an attempt at an octal number. How do you prevent octal interpretation but still ensure that the field is numeric? I'm being a tad lazy here, because I know I could always write my own pluggable validator, but I'd like to use what already exists if possible. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - 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: Problems with an inherited getter in a derived bean
My friend, I must admit that I have never applied inheritance on static nested classes in my life. (Not at least that I can remember :) ) I'm not to sure what the minimal access control level for static nested classes is from point of nested inheritance and Struts system. Maybe it has to do something with like reflection process that it needs that nested class public access. :) No idea, maybe someone else can comment on this issue? Quite interested myself to know the answer to this one. --Alen - Original Message - From: Paul Harrison [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 1:49 AM Subject: Re: Problems with an inherited getter in a derived bean thanks for confirming that this should work - one fact that I omitted in my original mailing was that the classes were inner classes i.e. it was the PostCode.Area class that is in the collection public class PostCode { protected static class Pbase { protected String name; public String getName() { return name; } } public static class Area extends Pbase { } } I works it I change the access on the Pbase class to public, but do I have to ? I thought that it was legal to have derived classes increase the accessibility - I do not want to expose the Pbase class - however this is pushing the limits of my knowledge about what should be happening. Alen Ribic wrote: I'm doing the same thing in my current project successfully. No problems in my specializes class. e.g. public abstract class BaseBusinessBean implements java.io.Serializable { protected int id; protected String description; // getters/setters here } e.g. public class Category extends BaseBusinessBean { // Category specific getters/setters } Now I use Category class with no problem in my options for select box. You have code snippet? --Alen - Original Message - From: Paul Harrison [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 4:55 PM Subject: Problems with an inherited getter in a derived bean In my struts application, I have a base bean with a set of basic properties (e.g. name) and then I create various derived beans with their own extra properties. I have a problem with the html:options tag in that if I try to read a property that is inherited from the base bean from a collection of the derived beans i.e. I have a tag like this html:options collection=CountyList property=name / - I get an error saying No getter method available for property name for bean under name CountyList and if I implement the getter in the derived bean the error goes away. Is this known behaviour in struts - is seems like a bug to me (or perhaps a bug in commons-beanutils?) Can anyone comment -- Paul Harrison [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] -- Paul Harrison [EMAIL PROTECTED] tel: 0161 428 2794 mob: 07904025192 - 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: WAP/WML support to existing application
The simplist way would be just to have WML copies of your JSP's Something like this at the top of you jsp.. (i'll have to check but i think its correct. JSP's default to contentType=text/html) %@ page language=java contentType=text/wml % If you want to minimize repetitive markup between html and wml versions then some cunning use of tiles and a WML layout could do the job... But this would really be up to you. Having stuff too rationalized can make applications harder to maintain.. I'd add new views but use the same actions. The other option would be the parse the HTML version into a WML versions, personally I think that this is a little more elegant but would confuse maintainers more. . Youu could go for best of both worlds and do an XSL transformation at build time to generate the additional jsp's, but unless your site is huge this could take more time than this would warrant. 1 issue affecting WML from JSP. The only problem with WML versions and JSP is that a few of the original nokia wap phones (7110) have trouble with white space at the top of WML pages. I worked for an agency where the contact for one of their clients had one of these phones and it was a pain in the arse. I ended up doing all my WML as servlets because of the control over white space. You can replicate this bug with the original version of the nokia wap kit, the emulator has the same issue. Cheers mark On Thursday, Jun 19, 2003, at 06:40 Europe/London, Mike Landis wrote: Hello, How or is is possible to add WAP/WML support to existing Struts application? I would like keep Web based (html) application as untouchable as possible. Are there any possibilities to configure Struts so, that WAP and Browser requests will be handled in their own actions? If yes, how or is it wrong approach? In my case there is no need/want to XML/XSLT generation so I can 'replicate' JSP pages depending on their content type (wml and html). Can anyone give me some tips how to add WAP support to existing Web application? Thanks, mike _ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - 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: Validator with LookupDispatchAction and Tiles
If I use multiple mappings, then I end up having something like this (only the input tag for validator is included): For Updates: action path=/FooActionUpdate type=com.myco.editors.FooAction name=FooForm scope=request input=.editor.fooUpdate parameter=dispatchAction forward name=edit path=.editor.fooUpdate/ forward name=top path=.editor. fooTop/ /action For Creates: action path=/FooActionCreate type=com.myco.editors.FooAction name=FooForm scope=request input=.editor.fooCreate parameter=dispatchAction forward name=edit path=.editor. fooCreate/ forward name=top path=.editor. fooTop/ /action For Selection: action path=/FooActionTop type=com.myco.editors.FooAction name=FooForm scope=request input=.editor.fooTop parameter=dispatchAction forward name=top path=.editor. fooTop/ /action For Non-Editting: action path=/FooActionNoEdit type=com.myco.editors.FooAction name=FooForm scope=request parameter=dispatchAction forward name=view path=.editor. fooView/ forward name=confirmDelete path=.editor. fooConfirm/ forward name=top path=.editor. fooTop/ /action The only thing that differs between the mapping definitions is the path and the forwards that are available to the definition. Having the repetitive definition blocks just doesn't seem right. If I (or another developer) go in to make any changes to the mapping, then I have three or more sets of mapping to analyze and possibly change. That just seems messy and prone to error. Nick -Original Message- From: Jing Zhou [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 11:00 PM To: Struts Users Mailing List Subject: Re: Validator with LookupDispatchAction and Tiles - Original Message - From: Brandon Goodin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 9:33 PM Subject: RE: Validator with LookupDispatchAction and Tiles IMO. Consolidating Actions and avoiding mulitple action mappings is cleaner and easier to identify functionality. Inevitably you have to come back to the app to make updates. When you do come back it's a whole lot easier to indentify an action according to it's operative functionality. The added advantage of LookupDispatchAction is also the i18n button naming, easier management of mulitple buttons in the same form and the translation of button names to appropriate method names. Agree with you. I am a little bit suspicious if someone still *complains* too many action mappings after being consolidated by the dispatch action for some reasons. Jing Brandon Goodin -Original Message- From: Jing Zhou [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 8:09 PM To: Struts Users Mailing List Subject: Re: Validator with LookupDispatchAction and Tiles - Original Message - From: Dee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 7:58 PM Subject: Validator with LookupDispatchAction and Tiles Hi, My teammate and I have looked through the message archives (and different web sites) and not been able to find a thread/site that discusses how to handle this situation. We are developing a web-app with multiple editors, each of which has a Selection page where the user decides to Create, Read, Update, or View the object supported by that editor. Each Action Class handles the CRUD functions for one object type and sub-classes LookupDispatchAction. We are constructing the pages using the Tiles framework. Now the fun part: We are implementing Validator. The client-side validation (javascript) works fine, but we have an issue with the server-side validation. When the validation fails, we should return to the page that had the error. I.E. When the user is creating and has a server-side validation error, we need to return to the create page, which is a tiles definition.similarly with the Update function, we need to return to the update tiles definition. The input tag in the action-mapping seems to be the answer, but it would require multiple action mappings to have an input tag for each of the tiles-mappings that used validator. My question: Is the input tag and multiple-action mappings the right way to accomplish our goals? The use of multiple action-mappings seems messy; is there a better way? Could you elaborate why you think the use of multiple action mappings seems messy? I am asking the question from a research point of view. Jing Thanks for any advice or thoughts. Nick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
URGENT GREEK CHARACTER SUPPORT
Dear Jakarta users, I use Jboss 3.0.7 which has Tomcat 4.1.12 built-in,used as web server. My problem is that in my JSP's, I cannot see Greek characters , forwarded by Oracle 9 to Jboss and Tomcat accordingly. I have used as page encoding ISO-8859-7 and UTF-8, both as META tags and page directives [EMAIL PROTECTED]. Any solutions??? My best regards, Dimitrios Karapiperis Software Engineer Metropolis Informatics SA tel: +30 2310 225815 fax +30 2310 256259
Re: Validator problem with integers
Hi Brad, use mask instead of integer. That should do the job. Error message states, that the entry is invalid. BTW, arg1 has to be used both for minlength and maxlength since {1} is the argument in the error message. I found that mask can solve nearly all validation problems if they are constrained to one field. If you have interdependent fields you still have to go back and implement ActionForm::validate. field property=dayPhone3 depends=required,mask,minlength,maxlength arg0 key=Daytime Phone box 3 resource=false/ arg1 name=minlength key=${var:minlength} resource=false / arg1 name=maxlength key=${var:maxlength} resource=false / var var-namemask/var-name var-value^[0-9]*$/var-value /var var var-nameminlength/var-name var-value4/var-value /var var var-namemaxlength/var-name var-value4/var-value /var /field Markus Brad Plies wrote: Hi folks, Using struts-RC2, when using Validator with a dependency on integer validation, I have a problem with the validator assuming that any integer starting with zero 0 is necessarily octal. In one example, I have a form where people enter phone numbers. Which is split up into 3 text boxes. Area code, 3 digits, last 4 digits. A fairly common way to break it up. Here is the validation.xml entry for one such field: field property=dayPhone3 depends=required, integer, minlength, maxlength arg0 key=Daytime Phone box 3 resource=false/ arg1 name=minlength key=${var:minlength} resource=false/ arg2 name=maxlength key=${var:maxlength} resource=false/ var var-namemaxlength/var-name var-value4/var-value /var var var-nameminlength/var-name var-value4/var-value /var /field Numbers like 0897 will cause the ... must be an integer message. Obviously it is not a valid octal number, and I know that the format of these numbers would appear as an attempt at an octal number. How do you prevent octal interpretation but still ensure that the field is numeric? I'm being a tad lazy here, because I know I could always write my own pluggable validator, but I'd like to use what already exists if possible. - 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]
Form conception problem !!!
Hello all, What I have to do is something like this: table logic:iterate id=object collection=myCol tr tdhtml:multibox property=ids value=%=object.getId()%//td tdbean:write name=object property=name//td tdhtml:text property=editableValues//td /tr /logic:iterate /table That means I have a check box that when it is checked, it returns me an ID and I have the html:text.. that return me a string. Actually, in my form, I have: public class myForm extends ActionForm{ String[] ids; String[] editableValues; } Problem is to do the relation between the ids selected and the values edited... Actually it is done by the position is the String[]... I don't like that and I would like to know if there is another way to edit this. Hope you'll understand what I mean... Thanks Valéry *** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager to [EMAIL PROTECTED] *** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perform() of action class is not called
Hi!!! I am trying to invoke an EJB from the Action class thru the perform() method. However, the perform method is not called - the println's do not show up on the server console nor is any error thrown. -!-- == Form Bean Definitions = -- form-beans form-bean name=submitForm type=hansen.playground.SubmitForm/ /form-beans !-- == Action Mapping Definitions -- action-mappings action path=/submit type=hansen.playground.SubmitAction name=submitForm input=/submit.jsp scope=request forward name=success path=/submit.jsp/ forward name=failure path=/submit.jsp/ /action /action-mappings --- ---Action class's perform method--- public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException { System.out.println(perform called !!!); SubmitForm f = (SubmitForm) form; // get the form bean // and take the last name value String lastName = f.getLastName(); // Translate the name to upper case //and save it in the request object request.setAttribute(lastName, lastName.toUpperCase()); /* Calling EJB ***/ String op=; try { System.out.println(getting initial context); Context ctx = getInitialContext(); System.out.println(initial context got !!); DemoHome home = (DemoHome) ctx.lookup(Demo); System.out.println(home got !!); Demo ac = null; try { ac = (Demo) home.create(); System.out.println(create called!!); if (ac==null) System.out.println(ac is null!); } catch (Exception ee) { System.out.print(exception 1); } System.out.println(going to call method!); if (ac!= null) op = ac.demoSelect(); else System.out.println(ac is null-error!!); //out.println(ac.demoSelect()); //out.println(string got!!); System.out.println(String=+op); } catch (Exception e) { e.printStackTrace(); System.out.println(error 2); } /*/ // Forward control to the specified success target return (mapping.findForward(success)); } --- What is wrong??? __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to downloaded files from server using Struts
On Thursday 19 June 2003 01:58, Kamalakar Thota wrote: Hi All, How can we download files from server using struts? As of now, I am using applet to do this using third party certificate. Please let me know, That depends on what you are doing. Are these files dynamically generated? Do you require a secure connection? Need more details Thank You, Kamal. - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to instantiate a DynaActionForm?
The validator actually goes by the ActionMapping attribute name, which by default is the formbean name. So you can have a base formbean, defined as an DynaActionForm, and then give it different attributes in each mapping. action name=baseForm attribute=loginForm action name=baseForm attribute=profileForm Then in the validator, you have have a form for loginForm and another for profileForm (if you need it). -T. Joseph Yang wrote: Thanks for all the answers! I used Carl's example, and it works But I do like Ted's idea, so I tried it out, combined the two forms together, then the validator is not working, because when I define the validation, there are no firstName or lastName on the login page... Any suggestions on this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iterating thru a collection
I need to iterate thru a collection and put it in an html-el:select field. How do I go about doing this My collection type looks like this ArrayList options int selectedOption The ArrayList of options is the following type: String label int id Can anyone help me??? Thanks in advance... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best Book on Struts
Another good choice would be Web Development with JavaServerPages by Fields, Kolb, and Bayern. I always thought of SIA as the second volume to this book (WebDev 201, if you will). Or, even just the Web Services tutorial http://java.sun.com/webservices/docs/1.0/tutorial/index.html, which is really quite good. -T. Nathan Anderson wrote: I also liked Struts in Action. And I agree that some background knowledge of JSP/Servlet/Taglibs is helpful. I'd recommend Core Servlets and JavaServer Pages by Marty Hall for that background. It was published in 2000, but it is basically all still relevant. Nathan Anderson -Original Message- From: Sloan Bowman [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 11:02 PM To: Struts Users Mailing List Subject: Re: Best Book on Struts I read Struts in Action and found it to be pretty good but didn't go into as much detail as would like on some subjects but all around its pretty good. I would recommend having a strong background in JSP/Servlet/Taglibs before reading this book though. Hope this helps. Also if you read the Java Blueprints on Web Teir patterns you will learn a lot. Link: java.sun.com/j2ee/blueprints/ Hope this helps, Sloan Hi all, I am a struts newbie and am happy with the struts-documentaion.war Can anyone suggest a good book on struts. I feel that all the books mentioned in the documentation - resources would definately be good, but out of all those 6 shown, which one would be the best buy ! PS : I have to buy the book from my own expenses and my company is not gonna buy it for me. Thankyou in advance, Vijay Pawar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Image cache problem
Hi all I have been using struts for some time now but a new problem has come up: I use a form to select some options needed retrieve some data required to generate a graph. For the sake of clarity, I'll call this retrieveDataAction. retrieveDataAction gets the data and places it into session scope under key 'GRAPHDATA' the user is then forwarded to displaydata.jsp. displaydata.jsp contains the following (simplfied): logic:present name=GRAPHDATA scope=session phtml:img page=/createimage.do //p /logic:present The createimageAction retrieves the GRAPHDATA from session scope, generates a gif image and writes it to response.OutputStream(), closes the stream and returns null. The problem I have is that at least one client (using IE 5) finds that the same image is always presented even though he has requested some different data. I have not been able to reproduce the problem using an IE 6 client - does anyone know if this is an IE 5 'feature' and - is there a solution? David Bolsover - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Image cache problem
Hi David, I think it has nothing to do with browser versions, I think this is only caused by caching settings. You must realize that caching can occur both in browser cache (configure this using Tools-Internet Options-General-Temporary Internet Files-Settings) and in proxy server cache. You should force your createimage.do to be non cachable. (Instruct proxy servers and browsers to always retrieve a fresh version) You can achieve this by setting a HTTP header: response.setHeader(Cache-Control,no-cache); see the javadocs for more on the setHeader method of the response object. See http://www.mnot.net/cache_docs/ for a very good tutorial on caching. Remke -Oorspronkelijk bericht- Van: David Bolsover [mailto:[EMAIL PROTECTED] Verzonden: donderdag 19 juni 2003 13:51 Aan: Struts User Onderwerp: Image cache problem Hi all I have been using struts for some time now but a new problem has come up: I use a form to select some options needed retrieve some data required to generate a graph. For the sake of clarity, I'll call this retrieveDataAction. retrieveDataAction gets the data and places it into session scope under key 'GRAPHDATA' the user is then forwarded to displaydata.jsp. displaydata.jsp contains the following (simplfied): logic:present name=GRAPHDATA scope=session phtml:img page=/createimage.do //p /logic:present The createimageAction retrieves the GRAPHDATA from session scope, generates a gif image and writes it to response.OutputStream(), closes the stream and returns null. The problem I have is that at least one client (using IE 5) finds that the same image is always presented even though he has requested some different data. I have not been able to reproduce the problem using an IE 6 client - does anyone know if this is an IE 5 'feature' and - is there a solution? David Bolsover - 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: Passing multiple ActionForms (at the same time) to an Action
In the situation I describe I want two forms to be submitted to the search action *at the same time*- one representing the currently entered details of the booking one representing the entered search criteria. The action should return both of these forms unmodified (to preserve data the user has entered) and create a bean representing the search results. I want to use struts forms for both the booking data and search criteria so that when the view is created the previously entered values are preserved - that is one the things struts is doing for me (isn't it?) Does that make sense? Is there an alternative to creating a 'super form' containg the 'real' data and the search criteria data? Or do I just not get it? thanks, Paul From: Ted Husted [mailto:[EMAIL PROTECTED] snip HTTP only allows you to submit a single form. If you then need to express an incoming form as two forms on a result page, you can post the incoming form bean under another attribute name (or names). Then each form on the result page will take the properties it needs, based on which form-bean was specified for its mapping. -T. Paul McCulloch wrote: Hi, I'm a struts newbie, so forgive me if this is a FAQ. Is there a way to submit multiple ActionForms to a single Action? I'm trying to implement search functionality on the same page as the view's primary function. I think an example would help... Consider a simplified ticket booking system. The booking view allows the user to book a number of tickets for one show. It has fields for Customer, Performance, number of tickets free text remarks. The Customer Performance fields each have an associated serach button. If the user presses the 'Performance Search' button then the view is redrawn showing the booking details already entered on the left and a Performance Search 'pane' on the right. The search pane includes criteria such as 'show', 'venue', 'time' etc. And a 'search now' button. Pressing the 'search now' button brings back, in the search pane a list of matching performances. Clicking on a performance in the list populates the performance field in the booking pane. It is also possible for the user to enter remarks, whilst using the search function without losing those remarks. The Customer search function works in a similar manner, and is displayed in place of the performance search when in use. With me so far? (thanks for reading). Working under the assumption that I can't submit two forms (the booking the search criteria) to a single action (the search action) I have come up with the following implementation: I have a single form containing all of the booking fields and all of the search criteria fields, with the view generating a different single html form definition depending on which of the search 'modes' should be visible. This seems to work ok. A second requirement is that these 'search functions' be resueable on other views. To this end I have defined the search fields in my form class via a map (so that I don't need to redefine the form class, just to add a new search criteria). I intend to wrap up the display logic in some custom tags. Is this is a sensible approach? Or is there a simpler way? Ideally I'd like my generated html to include multiple forms - one for the booking and one for the search, but if I do this then how do I send my booking form search form to the search action (so that the page can be redrawn with any modified booking details preserved? Many thanks for any input. Paul ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised to undertake anti virus checks prior to accessing the attachment to this electronic mail. Axios Systems Ltd grants no warranties regarding performance use or quality of any attachment and undertakes no liability for loss or damage howsoever caused.
RE: ActionForm 'reset' method being called when JSP is rendered
Ted, After I sent the original e-mail I found out that one of my developers had changed where the ActionForm was initially instantiated. The first JSP is calling an Action (via a html:link/ that does NOT have an ActionForm associated with it. This Action preloads a series of JavaBeans and then forwards to the second JSP. The Action associated with this JSP does have the ActionForm associated with it, and since the ActionForm has never been instantiated, the html:form/ tag was doing it at that time. I guess I never realized that the html:form/ tag would do this (instantiate an ActionForm and call reset) - I've always been under the impression that the ActionForm, reset, and validate methods were not called until AFTER the form was submitted. Learning something new everyday . 8-) Thanks. Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 6:56 AM To: Struts Users Mailing List Subject: Re: ActionForm 'reset' method being called when JSP is rendered In Struts 1.0.2 and later, reset is called by the html:form tag *if* the ActionForm is being instantiated at that time. The scope shouldn't matter. Also remember that the html:form tag is looking at the Action to which it submits, which may not be Action 1. If these are the same Action, or share the same formbean under the same attribute, then the ActionForm should already exist, and reset should not be called. -Ted. Jerry Jalenak wrote: I'm seeing some odd behaviour with one of my actions. If anyone can explain this I'd sure appreciate it Here's what I've got - in struts-config I have an ActionForm that is shared by two Actions. The ActionForm is created in session scope by the first action, and referenced by the second Action (also in session). Tracing the calls to 'reset' and 'validate' I see the following: JSP is displayed - html form is submitted - 'reset' is called - 'validate' is called - Action 1 is performed - forward to next JSP - 'reset' is called - JSP is displayed /\/\/\/\/\/\/\ ! My understanding is that 'reset' should not be called again until the form on the second JSP is submitted. Have I completely mis-understood how this works? Or is it something due to the ActionForm being created in session scope? TIA! Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Ted Husted, Struts in Action http://husted.com/struts/book.html - 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]
FileNotFoundException when creating FileInputStream
When I attempt to open an XSL file to complete a transformation, I get the exception FileNotFound. Steps: [1] Get file location from properties file without problem: String myXsl = getProperties().getProperty(fop.render.article); String contents: http://localhost/artimus/pdf/renderPdf.xsl;( verified by logging ) [2] construct FileInputStream from string, and I get exception FileInputStream in = new FileInputStream(myXsl); Err msg: java.io.FileNotFoundException: http:\localhost\artimus\pdf\renderPdf.xsl Note from the message that FileInputStream appears to change the address. How do I force the constructor to accept the whole address? regards, douglas reames rms finance 919 929 3465 _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Passing multiple ActionForms (at the same time) to an Action
Hi Paul, You might try changing the scope attribute of the actions associated with the forms to be session. Jon Ridgway -Original Message- From: Paul McCulloch [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 13:32 To: 'Struts Users Mailing List' Subject: RE: Passing multiple ActionForms (at the same time) to an Action In the situation I describe I want two forms to be submitted to the search action *at the same time*- one representing the currently entered details of the booking one representing the entered search criteria. The action should return both of these forms unmodified (to preserve data the user has entered) and create a bean representing the search results. I want to use struts forms for both the booking data and search criteria so that when the view is created the previously entered values are preserved - that is one the things struts is doing for me (isn't it?) Does that make sense? Is there an alternative to creating a 'super form' containg the 'real' data and the search criteria data? Or do I just not get it? thanks, Paul From: Ted Husted [mailto:[EMAIL PROTECTED] snip HTTP only allows you to submit a single form. If you then need to express an incoming form as two forms on a result page, you can post the incoming form bean under another attribute name (or names). Then each form on the result page will take the properties it needs, based on which form-bean was specified for its mapping. -T. Paul McCulloch wrote: Hi, I'm a struts newbie, so forgive me if this is a FAQ. Is there a way to submit multiple ActionForms to a single Action? I'm trying to implement search functionality on the same page as the view's primary function. I think an example would help... Consider a simplified ticket booking system. The booking view allows the user to book a number of tickets for one show. It has fields for Customer, Performance, number of tickets free text remarks. The Customer Performance fields each have an associated serach button. If the user presses the 'Performance Search' button then the view is redrawn showing the booking details already entered on the left and a Performance Search 'pane' on the right. The search pane includes criteria such as 'show', 'venue', 'time' etc. And a 'search now' button. Pressing the 'search now' button brings back, in the search pane a list of matching performances. Clicking on a performance in the list populates the performance field in the booking pane. It is also possible for the user to enter remarks, whilst using the search function without losing those remarks. The Customer search function works in a similar manner, and is displayed in place of the performance search when in use. With me so far? (thanks for reading). Working under the assumption that I can't submit two forms (the booking the search criteria) to a single action (the search action) I have come up with the following implementation: I have a single form containing all of the booking fields and all of the search criteria fields, with the view generating a different single html form definition depending on which of the search 'modes' should be visible. This seems to work ok. A second requirement is that these 'search functions' be resueable on other views. To this end I have defined the search fields in my form class via a map (so that I don't need to redefine the form class, just to add a new search criteria). I intend to wrap up the display logic in some custom tags. Is this is a sensible approach? Or is there a simpler way? Ideally I'd like my generated html to include multiple forms - one for the booking and one for the search, but if I do this then how do I send my booking form search form to the search action (so that the page can be redrawn with any modified booking details preserved? Many thanks for any input. Paul ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your employer does not consent to Internet email messages of this kind, please advise us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my Company or employer unless otherwise indicated by an authorised representative independent of this message. WARNING: While Axios Systems Ltd takes steps to prevent computer viruses from being transmitted via electronic mail attachments we cannot guarantee that attachments do not contain computer virus code. You are therefore strongly advised
Re: Validator documentation
Wednesday, June 18, 2003 3:46 PM , David Graham [EMAIL PROTECTED] a écrit : Hello, I'm looking for an exaustive documentation of the struts validator's rules defined in validator-rules.xml. Where can I find the name, values and meaning of heach variable the rules can take ? Neither : http://jakarta.apache.org/struts/userGuide/dev_validator.html nor the javadoc document this. And the sample chapter from Struts in action is obsolet for 1.1rc1. The link you sited does contain examples of the most common variables. The mask validation accepts a mask variable, the intRange validation accepts min and max variables (which are also applicable to the minlength and maxlength validations). And what about requiredif and its numerous variables, and about the future validatewhen syntaxe ?A example is not by definition exaustive. I think everybody does the way I do when using validator, e.g. guess the right use from samples taken form site to site and from the errors thrown. IMHO a true doc on that subject may be very usefull. For exemple : - The variables name and possible value. - The logic of each rules. - Whether the rules is aviable client side or not or if there is a difference between client side and server side logic. - The evolution along struts versions. - And samples of course. More, about all this item can be found from different places so it's rather a need to regroup them. Maybe one can consider posting a doc enancement ticket in bugzilla ? Malik. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: iterating thru a collection
Looks like you need a Map, not a List. Mark -Original Message- From: Natalie D Rassmann [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 7:47 AM To: Struts Users Mailing List Subject: iterating thru a collection I need to iterate thru a collection and put it in an html-el:select field. How do I go about doing this My collection type looks like this ArrayList options int selectedOption The ArrayList of options is the following type: String label int id Can anyone help me??? Thanks in advance... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
i18n, passing variable into arg0 using bean:message
Hi, Individually these all work deleteBusiness.confirm.p1 = Confirm company b{0}/b is correct. bean:message key=deleteBusiness.confirm.p1 arg0=Esso/ bean:write name=deleteOganizationForm property=organizationName scope=session ignore=true/ Instead of using a literal of esso we want to use the value taken from our formBean, deleteOganizationForm. We have tried various combinations. Can somebody please provide an example? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validate String[]
Hi,Ben. (B (BI think "required"(and others also) is work only String, (Bnot array. (BI was same situation, so I made a class that... (B (B (Bpublic class InputChecks extends FieldChecks { (Bpublic static boolean validateRequiredArray(Object (Bbean, (B ValidatorAction (Bva, Field field, (B ActionErrors (Berrors, (B (BHttpServletRequest request) { (B (BString[] values = (String[])bean; (B (Bfor (int i=0;ivalues.length;i++) { (B (Bif(!FieldChecks.validateRequired(values[i],va,field,errors,request)){ (B return false; (B } (B} (Breturn true; (B} (B} (B (B (Band add [validator-rules.xml] (B (B (B validator name="requiredArray" (Bclassname="zz.yy.xx.InputChecks" (B method="validateRequiredArray" (B methodParams="java.lang.Object, (B (Borg.apache.commons.validator.ValidatorAction, (B org.apache.commons.validator.Field, (B (Borg.apache.struts.action.ActionErrors, (B (Bjavax.servlet.http.HttpServletRequest" (B msg="errors.required" (B /validator (B (B (B (BThis work all item in array. (BBut, I don't know that is best way... (B (B- Original Message - (BFrom: "Ben Anderson" [EMAIL PROTECTED] (BTo: [EMAIL PROTECTED] (BSent: Thursday, June 19, 2003 9:17 PM (BSubject: validate String[] (B (B (B I have a page with multiple checkboxes (I'm using (Bhtml:multibox) and I (B need to validate that at least one of them is checked. (B (B code file="struts-config.xml" (Bform-bean (Bname="reportForm" (B (Btype="org.apache.struts.validator.DynaValidatorActionForm" (Bform-property name="reportList" (Btype="java.lang.String[]"/ (B /code (B (B code file="validation.xml" (Bfield property="reportList" depends="required" (Bmsg name="required" (Bkey="err.reportList.required"/ (B /code (B (B This doesn't seem to work. I've been reading through (BStruts Chapter 12 pdf (B about validation, but can't seem to find any cases where (Bthe property is an (B array of Strings. Any thoughts? (B Thanks in advance, (B Ben Anderson (B (B (B_ (B STOP MORE SPAM with the new MSN 8 and get 2 months FREE* (B (B http://join.msn.com/?page=features/junkmail (B (B (B (B- (B To unsubscribe, e-mail: (B[EMAIL PROTECTED] (B For additional commands, e-mail: (B[EMAIL PROTECTED] (B (B (B__ (BDo You Yahoo!? (BYahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ (B (B (B- (BTo unsubscribe, e-mail: [EMAIL PROTECTED] (BFor additional commands, e-mail: [EMAIL PROTECTED]
jstl parseDate question
Hi, I read various threads in this newsgroup about getting a Date from a jsp page into a bean. Now I'm converting a String value into a Date value in an Action. But there is a JSTL tag fmt:parseDate that should be doing this. But nowhere in the documentation can I find a small example of how to do it. Is it possible to parse user input to a date object using fmt:parseDate or is it only for parsing Strings to date used in the page itself? Johan -- Nilling Software Design Postbus 43 2280 AA Rijswijk ZH w: http://www.nilling.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Image cache problem - solved
Remke Thanks I was already setting: response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); In the jsp containing the image to solve the problem of page caches. What caught me out was that this had to do this for the image also - as I had just done before your mail came in! In my createimageAction I now have: OutputStream sos = response.getOutputStream(); response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); response.setContentType(image/jpeg); write image to sos sos.close(); return null; Problem solved :-) David -Original Message- From: Remke Rutgers [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 13:24 To: 'Struts Users Mailing List' Subject: RE: Image cache problem Hi David, I think it has nothing to do with browser versions, I think this is only caused by caching settings. You must realize that caching can occur both in browser cache (configure this using Tools-Internet Options-General-Temporary Internet Files-Settings) and in proxy server cache. You should force your createimage.do to be non cachable. (Instruct proxy servers and browsers to always retrieve a fresh version) You can achieve this by setting a HTTP header: response.setHeader(Cache-Control,no-cache); see the javadocs for more on the setHeader method of the response object. See http://www.mnot.net/cache_docs/ for a very good tutorial on caching. Remke -Oorspronkelijk bericht- Van: David Bolsover [mailto:[EMAIL PROTECTED] Verzonden: donderdag 19 juni 2003 13:51 Aan: Struts User Onderwerp: Image cache problem Hi all I have been using struts for some time now but a new problem has come up: I use a form to select some options needed retrieve some data required to generate a graph. For the sake of clarity, I'll call this retrieveDataAction. retrieveDataAction gets the data and places it into session scope under key 'GRAPHDATA' the user is then forwarded to displaydata.jsp. displaydata.jsp contains the following (simplfied): logic:present name=GRAPHDATA scope=session phtml:img page=/createimage.do //p /logic:present The createimageAction retrieves the GRAPHDATA from session scope, generates a gif image and writes it to response.OutputStream(), closes the stream and returns null. The problem I have is that at least one client (using IE 5) finds that the same image is always presented even though he has requested some different data. I have not been able to reproduce the problem using an IE 6 client - does anyone know if this is an IE 5 'feature' and - is there a solution? David Bolsover - 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: iterating thru a collection
Not to sure what is required here but for populating a select box options with values and labels I just create a java.util.List of beans. e.g. Category bean public class Category { protected int id; protected String name; // getters/setters } Now you just load the List (e.g. categoryList of type java.util.List) into the options/options tag specifying the value and label that will be pulled out of the beans in the List. (e.g. value=Category.id; label=Category.name) something like that...:) --Alen - Original Message - From: Mark Galbreath [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 2:49 PM Subject: RE: iterating thru a collection Looks like you need a Map, not a List. Mark -Original Message- From: Natalie D Rassmann [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 7:47 AM To: Struts Users Mailing List Subject: iterating thru a collection I need to iterate thru a collection and put it in an html-el:select field. How do I go about doing this My collection type looks like this ArrayList options int selectedOption The ArrayList of options is the following type: String label int id Can anyone help me??? Thanks in advance... - 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]
Any one has build.xml for making jar of struts source files
Hi , I have downloaded the sourcefiles for struts frameework. I need to make the struts.jar out of it. Can anyone send me the build.xml file to be used by ANT. Thanks in advance, Regards Vijay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
javascript validation
Hi, I have the following in my struts-config.xml action path=/admin/createContentType type=com.xdeep.pacific.servlet.admin.forms.ContentTypesAction name=BillingParametersForm scope=request input=contentTypes.jsp forward name=failure path=/admin/contentTypes.jsp?action=create/ forward name=success path=/admin/updateBillingParameters.jsp/ /action and in my validation.xml form-validation formset form name=BillingParametersForm field property=contentType depends=required arg0 key=admin.prompt.contentType/ /field /form /formset /form-validation and my jsp has the following form html:form action=/admin/createContentType focus=contentType onsubmit=validateBillingParametersForm(this); html:text property=contentType/ html:submit property=action value=Create/ html:reset value=Reset/ /html:form html:javascript formName=BillingParametersForm dynamicJavascript=true staticJavascript=false/ script language=Javascript1.1 src=staticJavascript.jsp/script My BillingParametersForm extends org.apache.struts.validator.ValidatorForm When the field is left blank an alert window does pop up as it should, but after I dismiss it I get forwarded onto the success page. Any suggestions on what I might be doing wrong. Thanks, Paul I'm using Vodafone Mail - to get your free mobile email account go to http://www.vodafone.ie Use of Vodafone Mail is subject to Terms and Conditions http://www.vodafone.ie/terms/website - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator documentation
Wednesday, June 18, 2003 3:46 PM , David Graham [EMAIL PROTECTED] a écrit : Hello, I'm looking for an exaustive documentation of the struts validator's rules defined in validator-rules.xml. Where can I find the name, values and meaning of heach variable the rules can take ? Neither : http://jakarta.apache.org/struts/userGuide/dev_validator.html nor the javadoc document this. And the sample chapter from Struts in action is obsolet for 1.1rc1. The link you sited does contain examples of the most common variables. The mask validation accepts a mask variable, the intRange validation accepts min and max variables (which are also applicable to the minlength and maxlength validations). And what about requiredif and its numerous variables, and about the future validatewhen syntaxe ? That page also contains a requiredif example. A example is not by definition exaustive. I think everybody does the way I do when using validator, e.g. guess the right use from samples taken form site to site and from the errors thrown. I never claimed it was exhaustive but it's all we have right now. IMHO a true doc on that subject may be very usefull. For exemple : - The variables name and possible value. - The logic of each rules. - Whether the rules is aviable client side or not or if there is a difference between client side and server side logic. - The evolution along struts versions. - And samples of course. Feel free to open an enhancement ticket and attach a cvs diff -u formatted patch on the docs. David More, about all this item can be found from different places so it's rather a need to regroup them. Maybe one can consider posting a doc enancement ticket in bugzilla ? Malik. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[struts-menu] how to use URL rewriting ?
Hi all, our application uses URL rewriting to track session (for some obscure reasons...) We use struts-menu taglib, and it doesn't urlrewrite links in menu items. From what I've seen in struts-menu sources, it is not possible because MenuDisplayer doesn't have any HttpResponse param. Do you know any struts-menu extension or patch that uses response.encodeURL() ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts-menu] how to use URL rewriting ?
Try html:rewrite http://jakarta.apache.org/struts/userGuide/dev_html.html From: Nicolas De Loof [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: [struts-menu] how to use URL rewriting ? Date: Thu, 19 Jun 2003 15:53:56 +0200 Hi all, our application uses URL rewriting to track session (for some obscure reasons...) We use struts-menu taglib, and it doesn't urlrewrite links in menu items. From what I've seen in struts-menu sources, it is not possible because MenuDisplayer doesn't have any HttpResponse param. Do you know any struts-menu extension or patch that uses response.encodeURL() ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action Errors
Title: Message hi all, how do we do to call errors properties in other file than ApplicationRessources one ? can't find any tips .. Y. Ce message, ainsi que tous les fichiers joints est destin aux seules personnes dont le nom est mentionn comme destinataire. Il peut contenir des informations sensibles ne devant pas tre divulgues et est protg contre toute violation par les dispositions pnales de la loi relative au secret des correspondances. Si vous recevez ce message par erreur, nous vous remercions de le renvoyer son expditeur, sans en conserver trace ou copie, et de ne pas utiliser, reproduire, rvler, modifier ou diffuser de manire directe ou indirecte les informations qu'il contient - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript validation
You need this: onsubmit=return validateBillingParametersForm(this); David Hi, I have the following in my struts-config.xml action path=/admin/createContentType type=com.xdeep.pacific.servlet.admin.forms.ContentTypesAction name=BillingParametersForm scope=request input=contentTypes.jsp forward name=failure path=/admin/contentTypes.jsp?action=create/ forward name=success path=/admin/updateBillingParameters.jsp/ /action and in my validation.xml form-validation formset form name=BillingParametersForm field property=contentType depends=required arg0 key=admin.prompt.contentType/ /field /form /formset /form-validation and my jsp has the following form html:form action=/admin/createContentType focus=contentType onsubmit=validateBillingParametersForm(this); html:text property=contentType/ html:submit property=action value=Create/ html:reset value=Reset/ /html:form html:javascript formName=BillingParametersForm dynamicJavascript=true staticJavascript=false/ script language=Javascript1.1 src=staticJavascript.jsp/script My BillingParametersForm extends org.apache.struts.validator.ValidatorForm When the field is left blank an alert window does pop up as it should, but after I dismiss it I get forwarded onto the success page. Any suggestions on what I might be doing wrong. Thanks, Paul I'm using Vodafone Mail - to get your free mobile email account go to http://www.vodafone.ie Use of Vodafone Mail is subject to Terms and Conditions http://www.vodafone.ie/terms/website - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts-menu] how to use URL rewriting ?
The problem we have is that URL are set in menu-config.xml, and struts-menu use it to set links in DHTML menu. Thank you for your help. Nico. Try html:rewrite http://jakarta.apache.org/struts/userGuide/dev_html.html From: Nicolas De Loof [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: [struts-menu] how to use URL rewriting ? Date: Thu, 19 Jun 2003 15:53:56 +0200 Hi all, our application uses URL rewriting to track session (for some obscure reasons...) We use struts-menu taglib, and it doesn't urlrewrite links in menu items. From what I've seen in struts-menu sources, it is not possible because MenuDisplayer doesn't have any HttpResponse param. Do you know any struts-menu extension or patch that uses response.encodeURL() ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - 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: Any one has build.xml for making jar of struts source files
It should be there already. Surely you get it with the source code automatically? I could send you one but it might not be the right version. It's in the root directory of the unzipped source tar file. Adam Vijay K Hegde wrote: Hi , I have downloaded the sourcefiles for struts frameework. I need to make the struts.jar out of it. Can anyone send me the build.xml file to be used by ANT. Thanks in advance, Regards Vijay - 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: Action Errors
Messagemessage-resources parameter=org.apache.struts.webapp.example.AlternateApplicationResources key=alternate /message-resources bean:message key=prompt.password bundle=alternate/ Chech struts examples war file. --Alen - Original Message - From: Le Goff, Yoann To: 'Struts Users Mailing List' Sent: Thursday, June 19, 2003 4:03 PM Subject: Action Errors hi all, how do we do to call errors properties in other file than ApplicationRessources one ? can't find any tips .. Y. Ce message, ainsi que tous les fichiers joints est destiné aux seules personnes dont le nom est mentionné comme destinataire. Il peut contenir des informations sensibles ne devant pas être divulguées et est protégé contre toute violation par les dispositions pénales de la loi relative au secret des correspondances. Si vous recevez ce message par erreur, nous vous remercions de le renvoyer à son expéditeur, sans en conserver trace ou copie, et de ne pas utiliser, reproduire, révéler, modifier ou diffuser de manière directe ou indirecte les informations qu'il contient --- - - 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: Image cache problem - solved
Struts 1.1 will do this for you automatically if you set the following in your struts-config.xml controller !-- all pages get HTTP headers to defeat browser caching -- set-property property=nocache value=true/ /controller David Bolsover wrote: Remke Thanks I was already setting: response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); In the jsp containing the image to solve the problem of page caches. What caught me out was that this had to do this for the image also - as I had just done before your mail came in! In my createimageAction I now have: OutputStream sos = response.getOutputStream(); response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); response.setContentType(image/jpeg); write image to sos sos.close(); return null; Problem solved :-) David -Original Message- From: Remke Rutgers [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 13:24 To: 'Struts Users Mailing List' Subject: RE: Image cache problem Hi David, I think it has nothing to do with browser versions, I think this is only caused by caching settings. You must realize that caching can occur both in browser cache (configure this using Tools-Internet Options-General-Temporary Internet Files-Settings) and in proxy server cache. You should force your createimage.do to be non cachable. (Instruct proxy servers and browsers to always retrieve a fresh version) You can achieve this by setting a HTTP header: response.setHeader(Cache-Control,no-cache); see the javadocs for more on the setHeader method of the response object. See http://www.mnot.net/cache_docs/ for a very good tutorial on caching. Remke -Oorspronkelijk bericht- Van: David Bolsover [mailto:[EMAIL PROTECTED] Verzonden: donderdag 19 juni 2003 13:51 Aan: Struts User Onderwerp: Image cache problem Hi all I have been using struts for some time now but a new problem has come up: I use a form to select some options needed retrieve some data required to generate a graph. For the sake of clarity, I'll call this retrieveDataAction. retrieveDataAction gets the data and places it into session scope under key 'GRAPHDATA' the user is then forwarded to displaydata.jsp. displaydata.jsp contains the following (simplfied): logic:present name=GRAPHDATA scope=session phtml:img page=/createimage.do //p /logic:present The createimageAction retrieves the GRAPHDATA from session scope, generates a gif image and writes it to response.OutputStream(), closes the stream and returns null. The problem I have is that at least one client (using IE 5) finds that the same image is always presented even though he has requested some different data. I have not been able to reproduce the problem using an IE 6 client - does anyone know if this is an IE 5 'feature' and - is there a solution? David Bolsover - 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]
Double log output from commons-logging with log4j
Hi folks, I'm hunting for some time the cause, why I get double output lines from log... My LogonForm::execute looks similar to: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println(LogonAction::execute called); // Obtain username and password from web tier LogonForm logonForm = (LogonForm) form; String userid = logonForm.getUserid() // Log log = LogFactory.getLog(this.getClass()); if (log.isDebugEnabled()) { log.debug(User +userid+ logged on); } // Return success return (mapping.findForward(Constants.SUCCESS)); } The output I get is: ... [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance LogonAction::execute called [DEBUG] app.control.LogonAction - User A123456 logged on [DEBUG] app.control.LogonAction - User A123456 logged on ... Since I get LogonAction::execute called only once I'm pretty sure that execute is only called once. I think it has probably to do with my commons-logging.properties or log4j.properties, but I really can't spot what I'm doing wrong: commons-logging.properties: org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory log4j.properties: # Logger catogory (DEBUG INFO WARN ERROR FATAL) log4j.rootLogger=WARN,Console log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console log4j.logger.app=DEBUG,Console # Appender Console # Pattern: level, category, message log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=[%-5p] %c - %m Both are stored in the WEB-INF/classes directory. Can anybody give me a hint? Thanks, Markus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts-menu] how to use URL rewriting ?
I wrote a MenuDispalyer that can be configured in a properties file. It will not solve your problem but it show how you can write your own MenuDisplayer to add replacement variable you need. It will require you to retrieve the session id from the pageContext and then pass it as a parameter for message resource replacement. If you are interested by my code look at the patch section of the sourceforge account of Struts-Menu where I posted it as RecursiveMenuDisplayer. Then look at RecusrsiveMenuDisplayer.getDisplayString(String key, String content, MenuComponent menu) to see how the variable are prepared. Malik. Thursday, June 19, 2003 4:10 PM , Nicolas De Loof [EMAIL PROTECTED] a crit : The problem we have is that URL are set in menu-config.xml, and struts-menu use it to set links in DHTML menu. Thank you for your help. Nico. Try html:rewrite http://jakarta.apache.org/struts/userGuide/dev_html.html From: Nicolas De Loof [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: [struts-menu] how to use URL rewriting ? Date: Thu, 19 Jun 2003 15:53:56 +0200 Hi all, our application uses URL rewriting to track session (for some obscure reasons...) We use struts-menu taglib, and it doesn't urlrewrite links in menu items. From what I've seen in struts-menu sources, it is not possible because MenuDisplayer doesn't have any HttpResponse param. Do you know any struts-menu extension or patch that uses response.encodeURL() ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - 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]
AW: Double log output from commons-logging with log4j
Try to expand your logging output to ensure it is only one thread working on that request: log4j.appender.Console.layout.ConversionPattern=[%t] (%d{HH:mm:ss,SSS}) %C{4}.%M - %m%n -Ursprüngliche Nachricht- Von: Markus Holzem [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. Juni 2003 16:21 An: Struts Users Mailing List Betreff: Double log output from commons-logging with log4j Hi folks, I'm hunting for some time the cause, why I get double output lines from log... My LogonForm::execute looks similar to: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println(LogonAction::execute called); // Obtain username and password from web tier LogonForm logonForm = (LogonForm) form; String userid = logonForm.getUserid() // Log log = LogFactory.getLog(this.getClass()); if (log.isDebugEnabled()) { log.debug(User +userid+ logged on); } // Return success return (mapping.findForward(Constants.SUCCESS)); } The output I get is: ... [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance LogonAction::execute called [DEBUG] app.control.LogonAction - User A123456 logged on [DEBUG] app.control.LogonAction - User A123456 logged on ... Since I get LogonAction::execute called only once I'm pretty sure that execute is only called once. I think it has probably to do with my commons-logging.properties or log4j.properties, but I really can't spot what I'm doing wrong: commons-logging.properties: org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF actory log4j.properties: # Logger catogory (DEBUG INFO WARN ERROR FATAL) log4j.rootLogger=WARN,Console log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console log4j.logger.app=DEBUG,Console # Appender Console # Pattern: level, category, message log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=[%-5p] %c - %m Both are stored in the WEB-INF/classes directory. Can anybody give me a hint? Thanks, Markus - 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 MVC - forms, EJB, data marshalling
I am starting a new app and trying to work out the best design approach. At the moment I want to get the app up and running, and so I'm just going to use tomcat and struts and achieve MVC by seperating out the database access into factory classes. At some point after I've got the project running, I want to replace the factory layer with CMP entity beans in JBoss (mostly for the learning experience). I've read Mastering EJB by Roman et al and so have a newby's idea of what the benefits would be although I'd like to hear what some gurus out there who've got experience with CMP say. My doubts are about whether entity beans can handle what I want to do. After I finished a successful project (not using EJB) which handled data-intensive lists with nested tags, I'm thinking of pursuing that design paradigm further. The value beans were created in the factories and passed into the action forms for use by the nested tags. The value beans had a validate() method, which took a Locale as the parameter when necessary, e.g. for date validation. Now I'm not sure if I can use the same principle in EJB. Can I take an CMP entity bean out of the J2EE container and use it in a struts form? And the reverse - can I pass a bean back again with updated values? Thanks Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FileNotFoundException when creating FileInputStream
hi, May be you are trying to get HTTP file using File Stream, that's why ;-) navjot |-Original Message- |From: douglas reames [mailto:[EMAIL PROTECTED] |Sent: Thursday, June 19, 2003 6:14 PM |To: [EMAIL PROTECTED] |Cc: [EMAIL PROTECTED] |Subject: FileNotFoundException when creating FileInputStream | | |When I attempt to open an XSL file to complete a transformation, I get the |exception FileNotFound. Steps: | | [1] Get file location from properties file without problem: |String myXsl = |getProperties().getProperty(fop.render.article); | |String contents: |http://localhost/artimus/pdf/renderPdf.xsl;( verified by logging ) | | [2] construct FileInputStream from string, and I get exception |FileInputStream in = new FileInputStream(myXsl); | |Err msg: java.io.FileNotFoundException: |http:\localhost\artimus\pdf\renderPdf.xsl | |Note from the message that FileInputStream appears to change the address. | |How do I force the constructor to accept the whole address? | |regards, |douglas reames |rms finance |919 929 3465 | |_ |MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. |http://join.msn.com/?page=features/virus | | |- |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: Image cache problem - solved
Adam Thanks - I'll check this out - but a question - you may be able to answer. In my application, the forwarded-to jsp is the result of a call to retrieveDataAction. The image embedded in the page is as a result of a call to createimageAction - which returns null - will setting the nocache property in the controller handle this situation correctly? David -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 15:16 To: Struts Users Mailing List Subject: Re: Image cache problem - solved Struts 1.1 will do this for you automatically if you set the following in your struts-config.xml controller !-- all pages get HTTP headers to defeat browser caching -- set-property property=nocache value=true/ /controller David Bolsover wrote: Remke Thanks I was already setting: response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); In the jsp containing the image to solve the problem of page caches. What caught me out was that this had to do this for the image also - as I had just done before your mail came in! In my createimageAction I now have: OutputStream sos = response.getOutputStream(); response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); response.setContentType(image/jpeg); write image to sos sos.close(); return null; Problem solved :-) David -Original Message- From: Remke Rutgers [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 13:24 To: 'Struts Users Mailing List' Subject: RE: Image cache problem Hi David, I think it has nothing to do with browser versions, I think this is only caused by caching settings. You must realize that caching can occur both in browser cache (configure this using Tools-Internet Options-General-Temporary Internet Files-Settings) and in proxy server cache. You should force your createimage.do to be non cachable. (Instruct proxy servers and browsers to always retrieve a fresh version) You can achieve this by setting a HTTP header: response.setHeader(Cache-Control,no-cache); see the javadocs for more on the setHeader method of the response object. See http://www.mnot.net/cache_docs/ for a very good tutorial on caching. Remke -Oorspronkelijk bericht- Van: David Bolsover [mailto:[EMAIL PROTECTED] Verzonden: donderdag 19 juni 2003 13:51 Aan: Struts User Onderwerp: Image cache problem Hi all I have been using struts for some time now but a new problem has come up: I use a form to select some options needed retrieve some data required to generate a graph. For the sake of clarity, I'll call this retrieveDataAction. retrieveDataAction gets the data and places it into session scope under key 'GRAPHDATA' the user is then forwarded to displaydata.jsp. displaydata.jsp contains the following (simplfied): logic:present name=GRAPHDATA scope=session phtml:img page=/createimage.do //p /logic:present The createimageAction retrieves the GRAPHDATA from session scope, generates a gif image and writes it to response.OutputStream(), closes the stream and returns null. The problem I have is that at least one client (using IE 5) finds that the same image is always presented even though he has requested some different data. I have not been able to reproduce the problem using an IE 6 client - does anyone know if this is an IE 5 'feature' and - is there a solution? David Bolsover - 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]
[OT] Re: Problems with an inherited getter in a derived bean
Alen Ribic wrote: My friend, I must admit that I have never applied inheritance on static nested classes in my life. (Not at least that I can remember :) ) I'm not to sure what the minimal access control level for static nested classes is from point of nested inheritance and Struts system. Maybe it has to do something with like reflection process that it needs that nested class public access. :) No idea, maybe someone else can comment on this issue? Quite interested myself to know the answer to this one. Very strange. Seems like it could be a bug even. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and database
Sloan Bowman wrote: I will do my best to explain this but I will also point you in the right direction. First off you need to read the Java Blueprints on using DAO with J2ee. This will teach you the best methods of using Databases by using the DAO to encapsulate the DataSource . Here is the link to the Java Blueprints http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html read this complete document and it will help you out alot with how you should use your databases in your applications. And for excellent sample code of a J2EE application that uses DAO pattern without using EJBs see this one: http://java.sun.com/blueprints/code/adventure/1.0/docs/architecture.html Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts-menu] how to use URL rewriting ?
Thanks a lot. Nico. I wrote a MenuDispalyer that can be configured in a properties file. It will not solve your problem but it show how you can write your own MenuDisplayer to add replacement variable you need. It will require you to retrieve the session id from the pageContext and then pass it as a parameter for message resource replacement. If you are interested by my code look at the patch section of the sourceforge account of Struts-Menu where I posted it as RecursiveMenuDisplayer. Then look at RecusrsiveMenuDisplayer.getDisplayString(String key, String content, MenuComponent menu) to see how the variable are prepared. Malik. Thursday, June 19, 2003 4:10 PM , Nicolas De Loof [EMAIL PROTECTED] a crit : The problem we have is that URL are set in menu-config.xml, and struts-menu use it to set links in DHTML menu. Thank you for your help. Nico. Try html:rewrite http://jakarta.apache.org/struts/userGuide/dev_html.html From: Nicolas De Loof [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: [struts-menu] how to use URL rewriting ? Date: Thu, 19 Jun 2003 15:53:56 +0200 Hi all, our application uses URL rewriting to track session (for some obscure reasons...) We use struts-menu taglib, and it doesn't urlrewrite links in menu items. From what I've seen in struts-menu sources, it is not possible because MenuDisplayer doesn't have any HttpResponse param. Do you know any struts-menu extension or patch that uses response.encodeURL() ? Nico. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - 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: design issue MVC - forms, EJB, data marshalling
I am starting a new app and trying to work out the best design approach. At the moment I want to get the app up and running, and so I'm just going to use tomcat and struts and achieve MVC by seperating out the database access into factory classes. At some point after I've got the project running, I want to replace the factory layer with CMP entity beans in JBoss (mostly for the learning experience). There's a project in the commons-sandbox called Mapper that may help you. It allows you to plugin persistence layers without your app knowing or changing (sort of like commons-logging). My doubts are about whether entity beans can handle what I want to do. After I finished a successful project (not using EJB) which handled data-intensive lists with nested tags, I'm thinking of pursuing that design paradigm further. The value beans were created in the factories and passed into the action forms for use by the nested tags. The value beans had a validate() method, which took a Locale as the parameter when necessary, e.g. for date validation. Now I'm not sure if I can use the same principle in EJB. Can I take an CMP entity bean out of the J2EE container and use it in a struts form? And the reverse - can I pass a bean back again with updated values? You should not use EJBs in that way because the method calls are potentially very expensive. See the ValueObject and DataAccessObject patterns here for more info: http://developer.java.sun.com/developer/restricted/patterns/J2EEPatternsAtAGlance.html David Thanks Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
javax.servlet.ServletException: BeanUtils.populate
Hi, I use DynaForm whith indexed properties, and contrary to many messages on this list this doesn't work form-bean dynamic=true name=ligneProduitForm type=org.apache.struts.validator.DynaValidatorForm form-property name=ligneReceptionDTO type=LigneReceptionIhmDTO[] size=10 / /form-bean logic:iterate name=lignesReceptionDTO id=ligneReceptionDTO type=com.auchan.protoj2ee.dto.LigneReceptionIhmDTO bean:define name=ligneReceptionDTO property=produitDTO id=produit / TR TD bgcolor=#E3EFFB valign=centerfont class=txtnoir html:text name=ligneReceptionDTO property=quantiteRecue indexed=true size=3 maxlength=3 //font /TD ... /TR /logic:iterate This is ok. But if i remove the size attribute of form-property I have a javax.servlet.ServletException: BeanUtils.populate caused by an java.lang.ArrayIndexOutOfBoundsException could somebody explain me my error? I used Tomcat 4.1.18, JDK 1.4.1_01-b01 and jakarta-struts-1.1-b2 Thanks
RE: Passing multiple ActionForms (at the same time) to an Action
I don't think this will help. The problem is that when I do a submit for my search form I lose any *unsubmitted* data from the booking form. Please correct me if I'm wrong - I'm a 5 day newbie! Paul -Original Message- From: Jon.Ridgway [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 13:46 To: 'Struts Users Mailing List' Subject: RE: Passing multiple ActionForms (at the same time) to an Action Hi Paul, You might try changing the scope attribute of the actions associated with the forms to be session. Jon Ridgway -Original Message- From: Paul McCulloch [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 13:32 To: 'Struts Users Mailing List' Subject: RE: Passing multiple ActionForms (at the same time) to an Action In the situation I describe I want two forms to be submitted to the search action *at the same time*- one representing the currently entered details of the booking one representing the entered search criteria. The action should return both of these forms unmodified (to preserve data the user has entered) and create a bean representing the search results. I want to use struts forms for both the booking data and search criteria so that when the view is created the previously entered values are preserved - that is one the things struts is doing for me (isn't it?) Does that make sense? Is there an alternative to creating a 'super form' containg the 'real' data and the search criteria data? Or do I just not get it? thanks, Paul From: Ted Husted [mailto:[EMAIL PROTECTED] snip HTTP only allows you to submit a single form. If you then need to express an incoming form as two forms on a result page, you can post the incoming form bean under another attribute name (or names). Then each form on the result page will take the properties it needs, based on which form-bean was specified for its mapping. -T. Paul McCulloch wrote: Hi, I'm a struts newbie, so forgive me if this is a FAQ. Is there a way to submit multiple ActionForms to a single Action? I'm trying to implement search functionality on the same page as the view's primary function. I think an example would help... Consider a simplified ticket booking system. The booking view allows the user to book a number of tickets for one show. It has fields for Customer, Performance, number of tickets free text remarks. The Customer Performance fields each have an associated serach button. If the user presses the 'Performance Search' button then the view is redrawn showing the booking details already entered on the left and a Performance Search 'pane' on the right. The search pane includes criteria such as 'show', 'venue', 'time' etc. And a 'search now' button. Pressing the 'search now' button brings back, in the search pane a list of matching performances. Clicking on a performance in the list populates the performance field in the booking pane. It is also possible for the user to enter remarks, whilst using the search function without losing those remarks. The Customer search function works in a similar manner, and is displayed in place of the performance search when in use. With me so far? (thanks for reading). Working under the assumption that I can't submit two forms (the booking the search criteria) to a single action (the search action) I have come up with the following implementation: I have a single form containing all of the booking fields and all of the search criteria fields, with the view generating a different single html form definition depending on which of the search 'modes' should be visible. This seems to work ok. A second requirement is that these 'search functions' be resueable on other views. To this end I have defined the search fields in my form class via a map (so that I don't need to redefine the form class, just to add a new search criteria). I intend to wrap up the display logic in some custom tags. Is this is a sensible approach? Or is there a simpler way? Ideally I'd like my generated html to include multiple forms - one for the booking and one for the search, but if I do this then how do I send my booking form search form to the search action (so that the page can be redrawn with any modified booking details preserved? Many thanks for any input. Paul ** Axios Email Confidentiality Footer Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. If you or your
Re: Problems with an inherited getter in a derived bean
Aaaa, my suspicion seemed to lean to right direction. :) --Alen - Original Message - From: Gareth Andrew [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 5:25 PM Subject: Re: Problems with an inherited getter in a derived bean Hi, Just for fun I set up a little test app. It demonstrates that the bug is definitely in Common Beanutils. Normal Java relfection can call a method derived from a protected nested class without problems. The problem seems to be in o/a/c/b/MethodUtils.java : line 442ish where Beanutils checks the declaring class to see if its public - it should probably check the derived class instead ie clazz = method.getClass() -MethodUtils.java - getAccessibleMethod(Method method) - // If the requested method is not public we cannot call it if (!Modifier.isPublic(method.getModifiers())) { return (null); } // If the declaring class is public, we are done Class clazz = method.getDeclaringClass(); if (Modifier.isPublic(clazz.getModifiers())) { return (method); } End-- As far as your problem goes the simplest fix seems to be write a public getName() method in Area and in its implementation call super.getName(). The alternative is to fix Beanutils (I haven't checked bugzilla so this might even be a recently fixed bug). I'm cross-posting this to commons-dev to confirm that it is a bug since I may look at it a bit furthere and write a patch next week if I have the time. Paul- Hope this helps Alan - Hope this is of interest Gareth. PS. I've also appended a quick test app I wrote --scratchpad.java -- public class scratchpad { public static void main(String[] args) throws Exception{ publicNestedClass test = new publicNestedClass(); //Works - nested inheritance works ok //System.out.println(test.getMessage()); //Doesn't work PropertyUtils bug //System.out.println((String)PropertyUtils.getProperty(test, message)); Class c = publicNestedClass.class; Method m = c.getMethod(getMessage, null); if(m!=null){ System.out.println(Method + m.getName() + of + m.getDeclaringClass() + found.); System.out.println(Method + (Modifier.isPublic(m.getModifiers()) ? is : isn't) + public); System.out.println(Class + (Modifier.isPublic(m.getClass().getModifiers()) ? is : isn't) + public); System.out.println(Declaring Class + (Modifier.isPublic(m.getDeclaringClass().getModifiers()) ? is : isn't) + public); } System.out.println((String)m.invoke(test, null)); } protected static class protectedNestedClass { public String getMessage(){ return Hello from a protected nested class; } } public static class publicNestedClass extends protectedNestedClass{ } } -- - Paul Harrison wrote: thanks for confirming that this should work - one fact that I omitted in my original mailing was that the classes were inner classes i.e. it was the PostCode.Area class that is in the collection public class PostCode { protected static class Pbase { protected String name; public String getName() { return name; } } public static class Area extends Pbase { }} I works it I change the access on the Pbase class to public, but do I have to ? I thought that it was legal to have derived classes increase the accessibility - I do not want to expose the Pbase class - however this is pushing the limits of my knowledge about what should be happening. Alen Ribic wrote: I'm doing the same thing in my current project successfully. No problems in my specializes class. e.g. public abstract class BaseBusinessBean implements java.io.Serializable { protected int id; protected String description; // getters/setters here } e.g. public class Category extends BaseBusinessBean { // Category specific getters/setters } Now I use Category class with no problem in my options for select box. You have code snippet? --Alen - Original Message - From: Paul Harrison [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 4:55 PM Subject: Problems with an inherited getter in a derived bean In my struts application, I have a base bean with a set of basic properties (e.g. name) and then I create various derived beans with their own extra properties. I have a problem with the html:options
RESOLVED RE: Path Info for downloaded files
We resolved the download issue by first doing: response.reset(); I would still be interested in how to set the Path Info. thanks, jaafar -Original Message- From: El Harouchi, Jaafar [IT] Sent: Thursday, June 19, 2003 1:01 AM To: [EMAIL PROTECTED] Subject: Path Info for downloaded files Hi, I've been trying to get generated PDF and CSV files to be downloaed by my actions but can't get it to work in IE using HTTP 1.0 when my app is behind the corporate portal. It works when accessed directly through the app (but not when I try to reach the action by putting the full url). I'm using all the tricks I could find: Setting ContentType: response.setContentType(application/pdf); Setting the ContentDisposition: response.setHeader(Content-Disposition, attachment; filename=file.pdf; Adding 8192 bytes to be sure that IE shows the document: ostream.write(new byte[8192]); /Setting contentlength: response.setContentLength(data.length+8192); // Flush the buffer: response.flushBuffer(); It works in Netscape 4.7, Netscape 6. Since IE is the problem and our corporate standard i have to try setting the Path Info, instead on relying on the content disposition. So how would you set the path info if you have your actions mapped as follows: servlet-mapping servlet-nameaction/servlet-name url-pattern/action/*/url-pattern /servlet-mapping and configured as follows: action path=/dailyReports type=com.ssmb.fipb.primedirect.web.reports.DailyReportAction name=reportForm parameter=dispatchMethod scope=request forward name=next path=/jsp/dailyReports_cv.jsp redirect=false/ /action These are dispatch actions anf the url is something like: http://.../action/dailyReports If I change it to GET from POST it would be: http://.../action/dailyReports?dispatchMethod=retrievereportRequest.reportIds=RDQQPB77reportRequest.format=pdfreportRequest.mgmtGroupNumber=51555reportRequest.actMnemonic=XPBALC Where would the path info go? If I add it in between action/file.pdf/dailyReports the mapping fails and my action is not invoked. If I add it at the very end test/file.pdf I get the same stupid IE error after it prompts you to open/save. Any ideas would be greatly appreciate it. Sorry if it is a little incoherent but we really understimated our effort and have had to work looong hours. thanks a lot -jaafar - 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]
dynamic properties
I am still fairly new to java and struts so please forgive me if this questions doesn't make sense. I am wanting to dynamically change paths to files, images, css, etc based on the url used to access the site. For example, if a user enters the site via abc.domain.com, I would like the paths to images to be something along the lines of /images/abc.domain.com/image.jpg. I'm sure there are many ways to accomplish this, but I was trying to find a way to perform this within the struts framework. Possibly by dynamically using different property files? Would this make sense? Is there be a better solution? Maybe a filter of some sort? Has anyone tried to do something similar? Any guidance is greatly appreciated. Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to instantiate a DynaActionForm?
Hi, we found some help in the way to instanciate a DynaActionForm presented by Carl Walker . But actually, we aren't able to put the form in the request. This works only in the session object. Is there anyone to help me? Thanks to answer quickly Julie Cardon
$ formatting in html options tag
in labelProperty getDescription i will get only amounts 1000,2000,3000 etc from database.at the presetation layer i need to display these values as $1000,$2000,$3000 etc.Is there a way to append formatting $ in the html:options tag other than adding $ to the collection.if i add $ to the collection then again sending back to database i need to remove $ html:select property=myProperty html:options collection=options property=value labelProperty=description/ /html:select Thanks, Sridhar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm 'reset' method being called when JSP is rendered
I am writing an application with a series of wizard type pages, so I thought that I would use one big ActionForm in session scope and each page add extra information to it - however this did not work as reset was being called at each page invocation - I am interested to hear that reset should only be called at instantiation time, because I believe that in 1.1 RC2 it is being called more often than that - I can did out the old verision of the code to have a look at the exact circumstances if necessary Ted Husted wrote: In Struts 1.0.2 and later, reset is called by the html:form tag *if* the ActionForm is being instantiated at that time. The scope shouldn't matter. Also remember that the html:form tag is looking at the Action to which it submits, which may not be Action 1. If these are the same Action, or share the same formbean under the same attribute, then the ActionForm should already exist, and reset should not be called. -Ted. Jerry Jalenak wrote: I'm seeing some odd behaviour with one of my actions. If anyone can explain this I'd sure appreciate it Here's what I've got - in struts-config I have an ActionForm that is shared by two Actions. The ActionForm is created in session scope by the first action, and referenced by the second Action (also in session). Tracing the calls to 'reset' and 'validate' I see the following: JSP is displayed - html form is submitted - 'reset' is called - 'validate' is called - Action 1 is performed - forward to next JSP - 'reset' is called - JSP is displayed /\/\/\/\/\/\/\ ! My understanding is that 'reset' should not be called again until the form on the second JSP is submitted. Have I completely mis-understood how this works? Or is it something due to the ActionForm being created in session scope? TIA! Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Paul Harrison [EMAIL PROTECTED] tel: 0161 428 2794 mob: 07904025192 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $ formatting in html options tag
The JSTL's fmt tags have some of this capability. Why can't you use an option value=1$10,000/option to send back an unformatted value to the form? David in labelProperty getDescription i will get only amounts 1000,2000,3000 etc from database.at the presetation layer i need to display these values as $1000,$2000,$3000 etc.Is there a way to append formatting $ in the html:options tag other than adding $ to the collection.if i add $ to the collection then again sending back to database i need to remove $ html:select property=myProperty html:options collection=options property=value labelProperty=description/ /html:select Thanks, Sridhar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FileNotFoundException when creating FileInputStream
FileInputStream expects a filename, but you fed it a URL. Is the XSL file within your webapp? If so, don't use a URL to reference it. If it is not within your web app but it is under your control, consider moving it into your web app. If you cannot move it, you will need to make an HTTP request to go get it. This code will go get it and give you an InputStream to read from (there may be better ways -- I just hobbled this together): InputStream in = new StringBufferInputStream( new URLConnection(new URL(myXsl)).getResponseMessage() ); This is expensive, so if you need to get this often and it doesn't change much, you should cache it within your app. Be sure to consider what a reasonable cache strategy would be, though. If you just get it once and hold onto it forever, your app will need to be restarted every time the xsl file changes, which would not be acceptable in a production environment in most cases. -Max - Original Message - From: douglas reames [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 5:43 AM Subject: FileNotFoundException when creating FileInputStream When I attempt to open an XSL file to complete a transformation, I get the exception FileNotFound. Steps: [1] Get file location from properties file without problem: String myXsl = getProperties().getProperty(fop.render.article); String contents: http://localhost/artimus/pdf/renderPdf.xsl;( verified by logging ) [2] construct FileInputStream from string, and I get exception FileInputStream in = new FileInputStream(myXsl); Err msg: java.io.FileNotFoundException: http:\localhost\artimus\pdf\renderPdf.xsl Note from the message that FileInputStream appears to change the address. How do I force the constructor to accept the whole address? regards, douglas reames rms finance 919 929 3465 _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus - 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: Image cache problem - solved
I haven't looked at the source code for the struts controller that the config xml affects, but I should think that the controller sets the response headers whatever your action returns. Perhaps someone else knows for sure? David Bolsover wrote: Adam Thanks - I'll check this out - but a question - you may be able to answer. In my application, the forwarded-to jsp is the result of a call to retrieveDataAction. The image embedded in the page is as a result of a call to createimageAction - which returns null - will setting the nocache property in the controller handle this situation correctly? David -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 15:16 To: Struts Users Mailing List Subject: Re: Image cache problem - solved Struts 1.1 will do this for you automatically if you set the following in your struts-config.xml controller !-- all pages get HTTP headers to defeat browser caching -- set-property property=nocache value=true/ /controller David Bolsover wrote: Remke Thanks I was already setting: response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); In the jsp containing the image to solve the problem of page caches. What caught me out was that this had to do this for the image also - as I had just done before your mail came in! In my createimageAction I now have: OutputStream sos = response.getOutputStream(); response.setHeader(Cache-Control,no-cache); response.setHeader(Pragma,no-cache); response.setContentType(image/jpeg); write image to sos sos.close(); return null; Problem solved :-) David -Original Message- From: Remke Rutgers [mailto:[EMAIL PROTECTED] Sent: 19 June 2003 13:24 To: 'Struts Users Mailing List' Subject: RE: Image cache problem Hi David, I think it has nothing to do with browser versions, I think this is only caused by caching settings. You must realize that caching can occur both in browser cache (configure this using Tools-Internet Options-General-Temporary Internet Files-Settings) and in proxy server cache. You should force your createimage.do to be non cachable. (Instruct proxy servers and browsers to always retrieve a fresh version) You can achieve this by setting a HTTP header: response.setHeader(Cache-Control,no-cache); see the javadocs for more on the setHeader method of the response object. See http://www.mnot.net/cache_docs/ for a very good tutorial on caching. Remke -Oorspronkelijk bericht- Van: David Bolsover [mailto:[EMAIL PROTECTED] Verzonden: donderdag 19 juni 2003 13:51 Aan: Struts User Onderwerp: Image cache problem Hi all I have been using struts for some time now but a new problem has come up: I use a form to select some options needed retrieve some data required to generate a graph. For the sake of clarity, I'll call this retrieveDataAction. retrieveDataAction gets the data and places it into session scope under key 'GRAPHDATA' the user is then forwarded to displaydata.jsp. displaydata.jsp contains the following (simplfied): logic:present name=GRAPHDATA scope=session phtml:img page=/createimage.do //p /logic:present The createimageAction retrieves the GRAPHDATA from session scope, generates a gif image and writes it to response.OutputStream(), closes the stream and returns null. The problem I have is that at least one client (using IE 5) finds that the same image is always presented even though he has requested some different data. I have not been able to reproduce the problem using an IE 6 client - does anyone know if this is an IE 5 'feature' and - is there a solution? David Bolsover - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: entity references in struts config xml
James Mitchell wrote: On Wednesday 18 June 2003 17:14, Derek Scherger wrote: James Mitchell wrote: On Wednesday 18 June 2003 15:23, Derek Scherger wrote: Does anyone know how to get entity references to work with struts 1.0.2 under tomcat 4.1.24? The first few lines of my struts-config.xml look like this: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; [!ENTITY barfoo SYSTEM barfoo.xml] struts-config barfoo; /struts-config When it comes to processing the barfoo; entity reference it fails with a file not found exception. Running tomcat with strace under linux I can see it trying to find barfoo.xml in the tomcat/bin directory rather than under the appropriate context's WEB-INF directory. Note that the same entity reference in web.xml works fine (i.e. it looks for barfoo.xml under the appropriate context's WEB-INF directory which is where I would expect a relative reference to be relative to). Using an absolute reference for the file isn't really a solution because the environment this app has to run in is a mix of linux, windows and solaris. (i.e. C:\\foo\\bar\\tomcat\\webapps\\foobarcontext\\WEB-INF\\barfoo.xml won't work on all platforms that is has to work on.). While not an exact solution to your dilema, why don't you just use multiple config files? I'm not entirely sure what you mean by this, it might only be available in struts 1.1. The problem we have at the moment is that we have multiple web apps that share a bunch of common struts (and tiles) configuration. Rather than having multiple copies of this shared configuration in various config files I'd like to have on copy of the shared stuff referenced by the various config files. Yes, I undertand your requirements. There are patches available to enable backward compatibility to Struts 1.0. See http://jamesholmes.com/struts/ for complete details. Should you choose to use the Struts Console (also available from that same url), it doesn't work with entity refs. That's one of the items standing in the way of supporting OJB configuration in the near future. Good luck with whatever you choose. I've just had a look at the url you mention above and it does seem to indicate that entity refs in the struts config files should work. Before I go patching to get multiple config files to work with 1.0.2 I'd like to get to the bottom of the problem I have using entity refs. We're not using the struts console so I'm not too worried about breaking that. The problem that I have is that entity refs are relative to tomcat bin rather than the context's WEB-INF. BTW, thanks for the quick responses! Cheers, Derek - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action class time out logic
Hi Guys: I have an action class that delegate to the business layer for processing. Sometimes it takes a long time to do the processing. I would like to have a timeout of say 2 minutes, I couldnot implement the timeout in the jsp page, because it is the action class which is doing the processing logic and until the execute method returns, the jsp is never executed. So How could i implement the time out in the action class. I tried to implement a timer using the timer class. but still it doesnot work, the response is not flushed until the execute method returns, that means the time it take to finish the processing of the business logic. -- code for timer-- new TimerTask(){ run() { System.out.println(timer ended); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.timeout)); if (!errors.isEmpty()) request.setAttribute(Globals.ERROR_KEY, errors); try { PrintWriter out = response.getWriter(); out.write(timeout); out.flush(); //response.sendRedirect(request.getContextPath()); //response.flushBuffer(); System.out.println(send to browser); } catch(IOException ex) { System.out.println(IO EXCEPTION); } } } even though i did write something to the response stream, the response is not send until the execute method returns. any ideas why? I believe someone might have done this and could help out . Thank you for your time and effort. a sample code will be greatly appreciated cheers - Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!
Re: design issue MVC - forms, EJB, data marshalling
From: David Graham [EMAIL PROTECTED] There's a project in the commons-sandbox called Mapper that may help you. It allows you to plugin persistence layers without your app knowing or changing (sort of like commons-logging). Hello, I can't find the Mapper project in the website, do you have an URL ? Thanks, -- Laurent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: design issue MVC - forms, EJB, data marshalling
OK, found ! It's in the cvs section of the site. - Original Message - From: David Graham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 4:18 PM Subject: Re: design issue MVC - forms, EJB, data marshalling I am starting a new app and trying to work out the best design approach. At the moment I want to get the app up and running, and so I'm just going to use tomcat and struts and achieve MVC by seperating out the database access into factory classes. At some point after I've got the project running, I want to replace the factory layer with CMP entity beans in JBoss (mostly for the learning experience). There's a project in the commons-sandbox called Mapper that may help you. It allows you to plugin persistence layers without your app knowing or changing (sort of like commons-logging). My doubts are about whether entity beans can handle what I want to do. After I finished a successful project (not using EJB) which handled data-intensive lists with nested tags, I'm thinking of pursuing that design paradigm further. The value beans were created in the factories and passed into the action forms for use by the nested tags. The value beans had a validate() method, which took a Locale as the parameter when necessary, e.g. for date validation. Now I'm not sure if I can use the same principle in EJB. Can I take an CMP entity bean out of the J2EE container and use it in a struts form? And the reverse - can I pass a bean back again with updated values? You should not use EJBs in that way because the method calls are potentially very expensive. See the ValueObject and DataAccessObject patterns here for more info: http://developer.java.sun.com/developer/restricted/patterns/J2EEPatternsAtAG lance.html David Thanks Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail - 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: How to ignore validation when form loads (first time)
Hi Sashi, Don't know if you've received any replies to this, but I initially handled it the same as you, but ran into problems when I was going back to the servlet for drop-down actions etc. I only wanted validation errors to appear when the user hit the save button, so I ended up just checking for the save in the validation method as such: //only validate form when a save has been pressed try {if (request.getParameter(saveBtn.x).equals(null)) return null;} catch (NullPointerException ex) {return null;} I'm also interested in feed-back on my approach. -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 1:19 PM To: [EMAIL PROTECTED] Subject: How to ignore validation when form loads (first time) Hi We have JSP pages which need user input. How can I display the form initially with out validation and then when user enters data and submits the page, the validation has to be done. I tried to accomplish it by giving two action in Struts-Config.xml. as shown below eg: action path=/AddRate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=false forward name=success path=AddRate.jsp/ /action action path=/Rate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=true forward name=success path=AddRate.do?target=create/ /action Not sure if this the way to do. Can somebody tell me if there is a better way to accomplish this. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Double log output from commons-logging with log4j
No, it is really the same, even the same timestamp: ... [Servlet.Engine.Transports:10] (18:07:45,802) apache.struts.action.RequestProcessor.processActionCreate - Creating new Action instance [Servlet.Engine.Transports:10] (18:07:45,802) apache.struts.action.RequestProcessor.processActionCreate - Creating new Action instance LogonAction::execute called [Servlet.Engine.Transports:10] (18:07:46,142) app.control.LogonAction.execute - User A123456 logged on [Servlet.Engine.Transports:10] (18:07:46,142) app.control.LogonAction.execute - User A123456 logged on ... Kroeger, Joerg wrote: Try to expand your logging output to ensure it is only one thread working on that request: log4j.appender.Console.layout.ConversionPattern=[%t] (%d{HH:mm:ss,SSS}) %C{4}.%M - %m%n -Ursprüngliche Nachricht- Von: Markus Holzem [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. Juni 2003 16:21 An: Struts Users Mailing List Betreff: Double log output from commons-logging with log4j Hi folks, I'm hunting for some time the cause, why I get double output lines from log... My LogonForm::execute looks similar to: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println(LogonAction::execute called); // Obtain username and password from web tier LogonForm logonForm = (LogonForm) form; String userid = logonForm.getUserid() // Log log = LogFactory.getLog(this.getClass()); if (log.isDebugEnabled()) { log.debug(User +userid+ logged on); } // Return success return (mapping.findForward(Constants.SUCCESS)); } The output I get is: ... [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance LogonAction::execute called [DEBUG] app.control.LogonAction - User A123456 logged on [DEBUG] app.control.LogonAction - User A123456 logged on ... Since I get LogonAction::execute called only once I'm pretty sure that execute is only called once. I think it has probably to do with my commons-logging.properties or log4j.properties, but I really can't spot what I'm doing wrong: commons-logging.properties: org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF actory log4j.properties: # Logger catogory (DEBUG INFO WARN ERROR FATAL) log4j.rootLogger=WARN,Console log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console log4j.logger.app=DEBUG,Console # Appender Console # Pattern: level, category, message log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=[%-5p] %c - %m Both are stored in the WEB-INF/classes directory. Can anybody give me a hint? Thanks, Markus - 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]
block direct access to JSP files
Hi, I have a Struts based application and would like to block all direct access to JSP files by user, so if a user typing a URL point to a JSP file directly, it will fail. I did a change to web.xml but not working on Websphere 4.0.3 (I should post to websphere news group but I hope some one here already did the same thing) here is my web.xml config relate to this web resource protection, It works fine on tomcat, but never in Websphere, any idea? security-constraint web-resource-collection web-resource-nameblockJSPDirectAccess/web-resource- name descriptionto block JSP direct access/description url-pattern*.jsp/url-pattern /web-resource-collection auth-constraint description/description role-name/role-name /auth-constraint /security-constraint - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Double log output from commons-logging with log4j
You are assigning your console appender twice. log4j.rootLogger=WARN,Console log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console log4j.logger.app=DEBUG,Console log4j.logger.app will inherit the appender from rootLogger, so you can just do log4j.rootLogger=WARN,Console log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console log4j.logger.app=DEBUG and that should take care of your extra messages. Markus Holzem [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] cc: Subject: Re: AW: Double log output from commons-logging with log4j 06/19/2003 12:11 PM Please respond to Struts Users Mailing List No, it is really the same, even the same timestamp: ... [Servlet.Engine.Transports:10] (18:07:45,802) apache.struts.action.RequestProcessor.processActionCreate - Creating new Action instance [Servlet.Engine.Transports:10] (18:07:45,802) apache.struts.action.RequestProcessor.processActionCreate - Creating new Action instance LogonAction::execute called [Servlet.Engine.Transports:10] (18:07:46,142) app.control.LogonAction.execute - User A123456 logged on [Servlet.Engine.Transports:10] (18:07:46,142) app.control.LogonAction.execute - User A123456 logged on ... Kroeger, Joerg wrote: Try to expand your logging output to ensure it is only one thread working on that request: log4j.appender.Console.layout.ConversionPattern=[%t] (%d{HH:mm:ss,SSS}) %C{4}.%M - %m%n -Ursprüngliche Nachricht- Von: Markus Holzem [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. Juni 2003 16:21 An: Struts Users Mailing List Betreff: Double log output from commons-logging with log4j Hi folks, I'm hunting for some time the cause, why I get double output lines from log... My LogonForm::execute looks similar to: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println(LogonAction::execute called); // Obtain username and password from web tier LogonForm logonForm = (LogonForm) form; String userid = logonForm.getUserid() // Log log = LogFactory.getLog(this.getClass()); if (log.isDebugEnabled()) { log.debug(User +userid+ logged on); } // Return success return (mapping.findForward(Constants.SUCCESS)); } The output I get is: ... [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance [DEBUG] org.apache.struts.action.RequestProcessor - Creating new Action instance LogonAction::execute called [DEBUG] app.control.LogonAction - User A123456 logged on [DEBUG] app.control.LogonAction - User A123456 logged on ... Since I get LogonAction::execute called only once I'm pretty sure that execute is only called once. I think it has probably to do with my commons-logging.properties or log4j.properties, but I really can't spot what I'm doing wrong: commons-logging.properties: org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jF actory log4j.properties: # Logger catogory (DEBUG INFO WARN ERROR FATAL) log4j.rootLogger=WARN,Console log4j.logger.org.apache.struts.action.RequestProcessor=DEBUG,Console log4j.logger.app=DEBUG,Console # Appender Console # Pattern: level, category, message log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout
RE: Struts and database
A follow up to the J2EE DAO Pattern: I found that it helps a lot using externalized SQL statements, i.e., build SQL statements in an XML file with your own DTD. It's point #3 in that blueprint. However, to this date I haven't found any good examples online. Also I sent an email to the blueprint team asking how to pass multiple arguments(for example, a collection.) If anyone looked at the 'petsstore' example that comes with the blueprints, you would notice that the number of parameters are hardcoded all the time in the Dao related .xml files. So still I don't know how to pass a collection as the 'input-mapping.' I am just wondering if anyone is using externalized SQL statements in their application as well. What's your view on it? Thanks! -Original Message- From: Sloan Bowman [mailto:[EMAIL PROTECTED] Sent: June 18, 2003 9:49 PM To: Struts Users Mailing List Subject: Re: Struts and database I will do my best to explain this but I will also point you in the right direction. First off you need to read the Java Blueprints on using DAO with J2ee. This will teach you the best methods of using Databases by using the DAO to encapsulate the DataSource . Here is the link to the Java Blueprints http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html read this complete document and it will help you out alot with how you should use your databases in your applications. Lets use an example say for a User requesting a item from the online store for our example. First you build the ActionForm which stores the data sent by the form. The ActionForm is passed through the FrontController which in turn dispatches you to the correct Action. In our case the Action will be using methods from a class which contains all of your Buisness logic. Form example, we have a ItemDAO which has a method getItem(int itemNum). This method returns a ItemBean which stores all of the information about that item. This Bean you are using to store all of the information is called a State Bean (if I remember right, corrections are welcome). When you get the ItemBean returned from the method getItem(int itemNum) you can then add it to your session/request etc.. for example you could do request.setAttribute(itemBean, itemBean). Now once you return the ActionForward in the Action (Example: mapping.findForward(success)) the itemBean will be part of the request and you acn access these properties in the View using jsp, velocity etc.. I hope this helps you out. --Sloan p.s. Sorry for the type o's I didn't proof read Hi! Would anyone give me some examples of database programming, which lead from retrieving data to rendering view. (I mean real database, not from XML files), e.g. any web site with source, or even better, some simple example? I am very confused on how to use beans from the model. If there any book that focus on database programming? I have been searching on the web, but unable to find. Andy Cheng [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: Problems with an inherited getter in a derived bean
The answer to your puzzle is found in the JLS, 8.2.1.4 Accessing Members of Inaccessible Classes. For brevity I won't copy and paste everything but leave it as an exercise for the reader. ;^) http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#4086 2 David Hibbs Staff Programmer / Analyst Distributed Applications Development and Support American National Insurance Company -Original Message- From: Paul Harrison [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 6:50 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: Problems with an inherited getter in a derived bean thanks for confirming that this should work - one fact that I omitted in my original mailing was that the classes were inner classes i.e. it was the PostCode.Area class that is in the collection public class PostCode { protected static class Pbase { protected String name; public String getName() { return name; } } public static class Area extends Pbase { } } I works it I change the access on the Pbase class to public, but do I have to ? I thought that it was legal to have derived classes increase the accessibility - I do not want to expose the Pbase class - however this is pushing the limits of my knowledge about what should be happening. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: design issue MVC - forms, EJB, data marshalling
I can't find the Mapper project in the website, do you have an URL ? It doesn't have a website yet because I just committed it recently but you can get it out of cvs. I'm interested in any and all feedback. David Thanks, -- Laurent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and database
Hello, Take a look at Commons-Scaffold on the apache-jakarta site, it uses externalized SQL statements in properties files. My 0.02 Euros ;-) -- Laurent - Original Message - From: Yansheng Lin [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 5:26 PM Subject: RE: Struts and database A follow up to the J2EE DAO Pattern: I found that it helps a lot using externalized SQL statements, i.e., build SQL statements in an XML file with your own DTD. It's point #3 in that blueprint. However, to this date I haven't found any good examples online. Also I sent an email to the blueprint team asking how to pass multiple arguments(for example, a collection.) If anyone looked at the 'petsstore' example that comes with the blueprints, you would notice that the number of parameters are hardcoded all the time in the Dao related .xml files. So still I don't know how to pass a collection as the 'input-mapping.' I am just wondering if anyone is using externalized SQL statements in their application as well. What's your view on it? Thanks! -Original Message- From: Sloan Bowman [mailto:[EMAIL PROTECTED] Sent: June 18, 2003 9:49 PM To: Struts Users Mailing List Subject: Re: Struts and database I will do my best to explain this but I will also point you in the right direction. First off you need to read the Java Blueprints on using DAO with J2ee. This will teach you the best methods of using Databases by using the DAO to encapsulate the DataSource . Here is the link to the Java Blueprints http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.ht ml read this complete document and it will help you out alot with how you should use your databases in your applications. Lets use an example say for a User requesting a item from the online store for our example. First you build the ActionForm which stores the data sent by the form. The ActionForm is passed through the FrontController which in turn dispatches you to the correct Action. In our case the Action will be using methods from a class which contains all of your Buisness logic. Form example, we have a ItemDAO which has a method getItem(int itemNum). This method returns a ItemBean which stores all of the information about that item. This Bean you are using to store all of the information is called a State Bean (if I remember right, corrections are welcome). When you get the ItemBean returned from the method getItem(int itemNum) you can then add it to your session/request etc.. for example you could do request.setAttribute(itemBean, itemBean). Now once you return the ActionForward in the Action (Example: mapping.findForward(success)) the itemBean will be part of the request and you acn access these properties in the View using jsp, velocity etc.. I hope this helps you out. --Sloan p.s. Sorry for the type o's I didn't proof read Hi! Would anyone give me some examples of database programming, which lead from retrieving data to rendering view. (I mean real database, not from XML files), e.g. any web site with source, or even better, some simple example? I am very confused on how to use beans from the model. If there any book that focus on database programming? I have been searching on the web, but unable to find. Andy Cheng [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: Struts and database
A follow up to the J2EE DAO Pattern: I found that it helps a lot using externalized SQL statements, i.e., build SQL statements in an XML file with your own DTD. It's point #3 in that blueprint. However, to this date I haven't found any good examples online. Also I sent an email to the blueprint team asking how to pass multiple arguments(for example, a collection.) If anyone looked at the 'petsstore' example that comes with the blueprints, you would notice that the number of parameters are hardcoded all the time in the Dao related .xml files. So still I don't know how to pass a collection as the 'input-mapping.' I am just wondering if anyone is using externalized SQL statements in their application as well. What's your view on it? I store all of my sql statements in a properties file and use ? for replacement parameters into PreparedStatement objects. That way I can support many databases by swapping in a different properties file. Even if you only need to support 1 database it's still useful because you don't need to recompile to change sql. There is a Mapper project in the commons-sandbox that supports this. David Thanks! -Original Message- From: Sloan Bowman [mailto:[EMAIL PROTECTED] Sent: June 18, 2003 9:49 PM To: Struts Users Mailing List Subject: Re: Struts and database I will do my best to explain this but I will also point you in the right direction. First off you need to read the Java Blueprints on using DAO with J2ee. This will teach you the best methods of using Databases by using the DAO to encapsulate the DataSource . Here is the link to the Java Blueprints http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html read this complete document and it will help you out alot with how you should use your databases in your applications. Lets use an example say for a User requesting a item from the online store for our example. First you build the ActionForm which stores the data sent by the form. The ActionForm is passed through the FrontController which in turn dispatches you to the correct Action. In our case the Action will be using methods from a class which contains all of your Buisness logic. Form example, we have a ItemDAO which has a method getItem(int itemNum). This method returns a ItemBean which stores all of the information about that item. This Bean you are using to store all of the information is called a State Bean (if I remember right, corrections are welcome). When you get the ItemBean returned from the method getItem(int itemNum) you can then add it to your session/request etc.. for example you could do request.setAttribute(itemBean, itemBean). Now once you return the ActionForward in the Action (Example: mapping.findForward(success)) the itemBean will be part of the request and you acn access these properties in the View using jsp, velocity etc.. I hope this helps you out. --Sloan p.s. Sorry for the type o's I didn't proof read Hi! Would anyone give me some examples of database programming, which lead from retrieving data to rendering view. (I mean real database, not from XML files), e.g. any web site with source, or even better, some simple example? I am very confused on how to use beans from the model. If there any book that focus on database programming? I have been searching on the web, but unable to find. Andy Cheng [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] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: design issue MVC - forms, EJB, data marshalling
Adam Hardy wrote: I am starting a new app and trying to work out the best design approach. At the moment I want to get the app up and running, and so I'm just going to use tomcat and struts and achieve MVC by seperating out the database access into factory classes. At some point after I've got the project running, I want to replace the factory layer with CMP entity beans in JBoss (mostly for the learning experience). I've read Mastering EJB by Roman et al and so have a newby's idea of what the benefits would be although I'd like to hear what some gurus out there who've got experience with CMP say. My doubts are about whether entity beans can handle what I want to do. After I finished a successful project (not using EJB) which handled data-intensive lists with nested tags, I'm thinking of pursuing that design paradigm further. The value beans were created in the factories and passed into the action forms for use by the nested tags. The value beans had a validate() method, which took a Locale as the parameter when necessary, e.g. for date validation. Now I'm not sure if I can use the same principle in EJB. Can I take an CMP entity bean out of the J2EE container and use it in a struts form? And the reverse - can I pass a bean back again with updated values? I think it would be better to employ the session facade pattern, perhaps using a Session bean, for a couple reasons. 1) you don't expose the entity beans (essentially they are wrapped privately in the session facade) 2) you can populate some POJOs like value objects or whatever from the data in the entity beans Note that if you are using CMP (esp 2.0), you may find it faster to simply develop with CMP and skip the factory business (unless your factory classes really are just prototypes and you don't spend too much time perfecting and goldplating them) -- the whole point is that you don't have to do all the hand-coding when you use CMP. Use XDoclet to spare yourself the hassle of generating all the boilerplate, and some app servers (such as JBoss) have XDoclet tags that will generate the database for you. See xpetstore-ejb (http://xpetstore.sourceforge.net/) for an example of this. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to instantiate a DynaActionForm?
This is wonderful!! Now it's working great! Thank you so much Ted! P.S In case someone also wants to use this approach, after populate the profile info and put the bean into request, you have to do: request.setAttribute(profileForm, formObj) instead of request.setAttribute(baseForm, formObj) -Original Message- From: Ted Husted [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 4:44 AM To: Struts Users Mailing List Subject: Re: How to instantiate a DynaActionForm? The validator actually goes by the ActionMapping attribute name, which by default is the formbean name. So you can have a base formbean, defined as an DynaActionForm, and then give it different attributes in each mapping. action name=baseForm attribute=loginForm action name=baseForm attribute=profileForm Then in the validator, you have have a form for loginForm and another for profileForm (if you need it). -T. Joseph Yang wrote: Thanks for all the answers! I used Carl's example, and it works But I do like Ted's idea, so I tried it out, combined the two forms together, then the validator is not working, because when I define the validation, there are no firstName or lastName on the login page... Any suggestions on this? - 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 and database
I store all of my sql statements in a properties file and use ? for replacement parameters into PreparedStatement objects. That way I can support many databases by swapping in a different properties file. Even if you only need to support 1 database it's still useful because you don't need to recompile to change sql. There is a Mapper project in the commons-sandbox that supports this. I should also mention that Mapper also makes it trivially easy to pass in a collection of objects to fill the ? sql parameters. If you use Mapper, please send me feedback :-). David _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: hidden fields and extension tag errors with weblogic
On Wed, 18 Jun 2003, Clauson, Kelly wrote: Date: Wed, 18 Jun 2003 19:18:45 - From: Clauson, Kelly [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: hidden fields and extension tag errors with weblogic Thanks for the response Rich. This did not work, but it did get me started on the right path. This code in the jsp: html:select property=week value=%= request.getParameter('Week') % results in this error: myaddedit.java:213: unclosed character literal probably occurred due to an error in /list/myAddEdit.jsp line 21: html:select property=week value=%= request.getParameter('Week') % The problem is that Java and JSP have different interpretations of quoting literal characters (single and double quotes): * In JSP, you can use either kind of quotes for an attribute value, as long as they match. * In Java, single quotes are used for character literals, and double quotes are used for strings. So, the following would do what you want: html:select property=week value='%= request.getParameter(Week) %' Note the use of single quotes around the attribute value for value, so that you can use double quotes inside the Java expression. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to get the formbean in script
Is this what you are looking for? ..something like this in your struts-config.xml: form-beans !-- HomePage form bean -- form-bean name=incidentForm type=pwgsc.smis.presentation.IncidentForm/ /form-beans !-- Process an incident request for opening a new or existing incident-- actionpath=/incident type=pwgsc.smis.actions.maintainHO.IncidentAction name=incidentForm scope=request validate=true input=/incident.jsp forward name=incidentpath=/incident.jsp/ forward name=unsafe path=/unsafe.do/ forward name=contributingpath=/contributing.do/ forward name=hazardous path=/hazardous.do/ /action and then access from the .jsp something like: html:text name=incidentForm property=incidentDate //td -Original Message- From: Duan Qiang [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 10:52 PM To: Struts Users Mailing List Subject: how to get the formbean in script Hi, I have a formbean defined as test, how can I get the formbean in JSP so that I can better control it rather than using bean:write name=test property = xxx /. I tried to use bean:define id=test name=test / but I got the exception that no test found in any scope. I have one question, when the formbean is initialized ? when the page containing the formbean is shown for the first time, the bean should exists in proper scope? write? Thx. - 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 Action Scripting
On Wed, 18 Jun 2003, Igor Shabalov wrote: Date: Wed, 18 Jun 2003 09:16:58 -0700 From: Igor Shabalov [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Struts Action Scripting Craig, do not tell me that it is impossible, when I've already have this done in Exadel Application Framework. Yes! Careful work with classloaders can do the job. This is possible, because Struts runtime control any use of Action classes, and, presumably, user do not use Action classes directly from users code. That might work for Actions, but how about for beans in general? Or classes loaded from a parent class loader (like classes from common/lib in Tomcat)? I'm really not interested in trying to support fancy class loading tricks like this, across all platforms, in the Struts codebase itself. It was hard enough to get class loading inside *one* container (I wrote a large chunk of the Catalina code in Tomcat) to work reliably. If you are interested in trying this with Exadel, then more power to you ... and I'll happily send the support questions to your user list instead :-). Best, Igor. Craig On Tue, 17 Jun 2003 01:02:15 -0700 (PDT), Craig R. McClanahan [EMAIL PROTECTED] wrote: On Thu, 12 Jun 2003, Igor Shabalov wrote: Date: Thu, 12 Jun 2003 11:13:47 -0700 From: Igor Shabalov [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Struts Action Scripting It's not about compilation time. It's about ability to reload code on- the fly. Here Eclipse do not helps you. Compilation time can be rather small. Time to reload all application will be unacceptable, I just need to reload one action. Java does not provide any mechanism to unload a previously loaded class. The best you can do is throw away the ClassLoader that loaded that class (which is what containers like Tomcat do when you reload an existing app) . The fact that JSP pages can be recompiled only works because the container goes to EXTREME lengths to load the class for each page in a separate class loader -- but that doesn't work in the general case, because there is no way to know what other classes might refer to a particular class. The only safe answer is to reload the app as a whole. You should give up on the hope of reloading an individual class, and instead concentrate on techniques that reduce the reload time of your app as a whole. Of course, that's primarily an issue for developers, not your production deployment, so it is probably not the most important thing to spend your time on anyway. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Igor Shabalov Director of Engineering Exadel Inc. http://www.exadel.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using expression in Struts tags
On Wed, 18 Jun 2003 [EMAIL PROTECTED] wrote: html:text property=${someBean.property} / Note that this actually WILL work in a JSP 2.0 container (such as Tomcat 5), because EL expressions can be used everywhere (even in template text). Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts-EL Dependency
On Wed, 18 Jun 2003, Aaron Longwell wrote: Date: Wed, 18 Jun 2003 16:39:35 -0600 From: Aaron Longwell [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts-User [EMAIL PROTECTED] Subject: Struts-EL Dependency Gurus, I want to create JSP tags that utilize the JSTL EL functionality. I am aware that I need to make calls to a static org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager object (man, that's a long name). Question... where do I find the distribution of this file. The jstl.jar that can be downloaded from the taglibs project has only javax packages. I see that it's a dependency of struts-el in the Struts contrib directory but which project is standard.jar from? It's from the standard tag library at Jakarta Taglibs. This code base is the basis of the reference implementation of JSTL. My goal is to port all of my tags to EL tags in much the same way struts tags were ported to struts-el tags. Can somebody explain the nature of the jstl.jar and standard.jar? You'll need both jstl.jar and standard.jar to use this particular static method. Thanks, Aaron Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts and database
What! You don't have to recompile when you make a change to your properties file? Man, I must've been doing something seriuosly wrong. Whenever I changed anything in the application.properties or struts-config.xml, or any of my dtd's and .xml files(including validation.xml, which is such a pain...), I would have to recompile the project and restart tomcat. The only thing that doesn't require recompile is changes made to any .jsp files or .java files. Even with .java files, if there is synchronized(Object) statement, the debugger would give me a warning saying things 'may out of sync.' I am using Eclipse 2.1, which btw is much better than visualAge 4.0:). I store all of my sql statements in a properties file and use ? for replacement parameters into PreparedStatement objects. That way I can support many databases by swapping in a different properties file. Even if you only need to support 1 database it's still useful because you don't need to recompile to change sql. There is a Mapper project in the commons-sandbox that supports this. I should also mention that Mapper also makes it trivially easy to pass in a collection of objects to fill the ? sql parameters. If you use Mapper, please send me feedback :-). David _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - 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: How to ignore validation when form loads (first time)
I found that the approach with 2 action mappings worked fine and I got the impression when I first chose this method that it is intended to be use this way. I also used your method to check whether to validate, in situations where I had a list of records where some could be edited and some could be deleted. When deleting, I wanted to inhibit validation. Adam Kandi Potter wrote: Hi Sashi, Don't know if you've received any replies to this, but I initially handled it the same as you, but ran into problems when I was going back to the servlet for drop-down actions etc. I only wanted validation errors to appear when the user hit the save button, so I ended up just checking for the save in the validation method as such: //only validate form when a save has been pressed try {if (request.getParameter(saveBtn.x).equals(null)) return null;} catch (NullPointerException ex) {return null;} I'm also interested in feed-back on my approach. -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 1:19 PM To: [EMAIL PROTECTED] Subject: How to ignore validation when form loads (first time) Hi We have JSP pages which need user input. How can I display the form initially with out validation and then when user enters data and submits the page, the validation has to be done. I tried to accomplish it by giving two action in Struts-Config.xml. as shown below eg: action path=/AddRate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=false forward name=success path=AddRate.jsp/ /action action path=/Rate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=true forward name=success path=AddRate.do?target=create/ /action Not sure if this the way to do. Can somebody tell me if there is a better way to accomplish this. 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]
RE: Struts and database
What! You don't have to recompile when you make a change to your properties file? Compiling is only for Java code. Text files don't need to be compiled so you might be talking about rebuilding your app? David Man, I must've been doing something seriuosly wrong. Whenever I changed anything in the application.properties or struts-config.xml, or any of my dtd's and .xml files(including validation.xml, which is such a pain...), I would have to recompile the project and restart tomcat. The only thing that doesn't require recompile is changes made to any .jsp files or .java files. Even with .java files, if there is synchronized(Object) statement, the debugger would give me a warning saying things 'may out of sync.' I am using Eclipse 2.1, which btw is much better than visualAge 4.0:). I store all of my sql statements in a properties file and use ? for replacement parameters into PreparedStatement objects. That way I can support many databases by swapping in a different properties file. Even if you only need to support 1 database it's still useful because you don't need to recompile to change sql. There is a Mapper project in the commons-sandbox that supports this. I should also mention that Mapper also makes it trivially easy to pass in a collection of objects to fill the ? sql parameters. If you use Mapper, please send me feedback :-). David _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - 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] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ActionForm 'reset' method being called when JSP is rendered
If what your saying is true, it would break a *lot* of applications that create/reuse an ActionForm in a particular scope and then forward to a page. I wonder if something else is happening in your app. Just a thought... Regards, Rich -Original Message- From: Paul Harrison [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 11:43 AM To: Struts Users Mailing List Subject: Re: ActionForm 'reset' method being called when JSP is rendered I am writing an application with a series of wizard type pages, so I thought that I would use one big ActionForm in session scope and each page add extra information to it - however this did not work as reset was being called at each page invocation - I am interested to hear that reset should only be called at instantiation time, because I believe that in 1.1 RC2 it is being called more often than that - I can did out the old verision of the code to have a look at the exact circumstances if necessary Ted Husted wrote: In Struts 1.0.2 and later, reset is called by the html:form tag *if* the ActionForm is being instantiated at that time. The scope shouldn't matter. Also remember that the html:form tag is looking at the Action to which it submits, which may not be Action 1. If these are the same Action, or share the same formbean under the same attribute, then the ActionForm should already exist, and reset should not be called. -Ted. Jerry Jalenak wrote: I'm seeing some odd behaviour with one of my actions. If anyone can explain this I'd sure appreciate it Here's what I've got - in struts-config I have an ActionForm that is shared by two Actions. The ActionForm is created in session scope by the first action, and referenced by the second Action (also in session). Tracing the calls to 'reset' and 'validate' I see the following: JSP is displayed - html form is submitted - 'reset' is called - 'validate' is called - Action 1 is performed - forward to next JSP - 'reset' is called - JSP is displayed /\/\/\/\/\/\/\ ! My understanding is that 'reset' should not be called again until the form on the second JSP is submitted. Have I completely mis-understood how this works? Or is it something due to the ActionForm being created in session scope? TIA! Jerry Jalenak Team Lead, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Paul Harrison [EMAIL PROTECTED] tel: 0161 428 2794 mob: 07904025192 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: design issue MVC - forms, EJB, data marshalling
I decided that I didn't have time to dive straight into EJB, although I'm taking far more time than expected on the design. Hmph! Thanks for the input. What though is POJO? Erik Price wrote: I think it would be better to employ the session facade pattern, perhaps using a Session bean, for a couple reasons. 1) you don't expose the entity beans (essentially they are wrapped privately in the session facade) 2) you can populate some POJOs like value objects or whatever from the data in the entity beans Note that if you are using CMP (esp 2.0), you may find it faster to simply develop with CMP and skip the factory business (unless your factory classes really are just prototypes and you don't spend too much time perfecting and goldplating them) -- the whole point is that you don't have to do all the hand-coding when you use CMP. Use XDoclet to spare yourself the hassle of generating all the boilerplate, and some app servers (such as JBoss) have XDoclet tags that will generate the database for you. See xpetstore-ejb (http://xpetstore.sourceforge.net/) for an example of this. Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: design issue MVC - forms, EJB, data marshalling
David Graham wrote: There's a project in the commons-sandbox called Mapper that may help you. It allows you to plugin persistence layers without your app knowing or changing (sort of like commons-logging). I'll check out Mapper. Thanks also for the link to the design patterns. Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: design issue MVC - forms, EJB, data marshalling
POJO = Plain Ole Java Object -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 1:01 PM To: Struts Users Mailing List Subject: Re: design issue MVC - forms, EJB, data marshalling I decided that I didn't have time to dive straight into EJB, although I'm taking far more time than expected on the design. Hmph! Thanks for the input. What though is POJO? Erik Price wrote: I think it would be better to employ the session facade pattern, perhaps using a Session bean, for a couple reasons. 1) you don't expose the entity beans (essentially they are wrapped privately in the session facade) 2) you can populate some POJOs like value objects or whatever from the data in the entity beans Note that if you are using CMP (esp 2.0), you may find it faster to simply develop with CMP and skip the factory business (unless your factory classes really are just prototypes and you don't spend too much time perfecting and goldplating them) -- the whole point is that you don't have to do all the hand-coding when you use CMP. Use XDoclet to spare yourself the hassle of generating all the boilerplate, and some app servers (such as JBoss) have XDoclet tags that will generate the database for you. See xpetstore-ejb (http://xpetstore.sourceforge.net/) for an example of this. Erik - 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: How to ignore validation when form loads (first time)
thanks for the feedback. -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 12:57 PM To: Struts Users Mailing List Subject: Re: How to ignore validation when form loads (first time) I found that the approach with 2 action mappings worked fine and I got the impression when I first chose this method that it is intended to be use this way. I also used your method to check whether to validate, in situations where I had a list of records where some could be edited and some could be deleted. When deleting, I wanted to inhibit validation. Adam Kandi Potter wrote: Hi Sashi, Don't know if you've received any replies to this, but I initially handled it the same as you, but ran into problems when I was going back to the servlet for drop-down actions etc. I only wanted validation errors to appear when the user hit the save button, so I ended up just checking for the save in the validation method as such: //only validate form when a save has been pressed try {if (request.getParameter(saveBtn.x).equals(null)) return null;} catch (NullPointerException ex) {return null;} I'm also interested in feed-back on my approach. -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 1:19 PM To: [EMAIL PROTECTED] Subject: How to ignore validation when form loads (first time) Hi We have JSP pages which need user input. How can I display the form initially with out validation and then when user enters data and submits the page, the validation has to be done. I tried to accomplish it by giving two action in Struts-Config.xml. as shown below eg: action path=/AddRate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=false forward name=success path=AddRate.jsp/ /action action path=/Rate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=true forward name=success path=AddRate.do?target=create/ /action Not sure if this the way to do. Can somebody tell me if there is a better way to accomplish this. 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]
File size limit on uploads?
Chaps, I have been having a number of problems with multipart/form-data uploads of files, what I thought had been a problem with the sequence of events (see my previous posts) now seems to be a problem of the size of file being uploaded. I was convinced that at some point I had managed to upload a 70Mb file, I think it must have been wishful thinking on my part... :) The problem is as follows: 1. I GET a page that displays a form for uploading multiple files. 2. The user selects a file and POSTs the form using the submit button. 3. If the file seems to be = 2Mb(ish) the Action receives no form parameters or attributes excluding the usual suspects (instances of org.apache.struts.action.MESSAGE, org.apache.struts.action.mapping.instance and org.apache.struts.action.MODULE) 4. There appears to be no exception being thrown, certainly not on that is bubbling up into my code! 5. I do not have a maxFileSize set in web.xml Does anyone have any ideas? Chris. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts and database
www.ibatis.com Is a great one out there also. Jacob -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 11:34 AM To: [EMAIL PROTECTED] Subject: RE: Struts and database A follow up to the J2EE DAO Pattern: I found that it helps a lot using externalized SQL statements, i.e., build SQL statements in an XML file with your own DTD. It's point #3 in that blueprint. However, to this date I haven't found any good examples online. Also I sent an email to the blueprint team asking how to pass multiple arguments(for example, a collection.) If anyone looked at the 'petsstore' example that comes with the blueprints, you would notice that the number of parameters are hardcoded all the time in the Dao related .xml files. So still I don't know how to pass a collection as the 'input-mapping.' I am just wondering if anyone is using externalized SQL statements in their application as well. What's your view on it? I store all of my sql statements in a properties file and use ? for replacement parameters into PreparedStatement objects. That way I can support many databases by swapping in a different properties file. Even if you only need to support 1 database it's still useful because you don't need to recompile to change sql. There is a Mapper project in the commons-sandbox that supports this. David Thanks! -Original Message- From: Sloan Bowman [mailto:[EMAIL PROTECTED] Sent: June 18, 2003 9:49 PM To: Struts Users Mailing List Subject: Re: Struts and database I will do my best to explain this but I will also point you in the right direction. First off you need to read the Java Blueprints on using DAO with J2ee. This will teach you the best methods of using Databases by using the DAO to encapsulate the DataSource . Here is the link to the Java Blueprints http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.h tml read this complete document and it will help you out alot with how you should use your databases in your applications. Lets use an example say for a User requesting a item from the online store for our example. First you build the ActionForm which stores the data sent by the form. The ActionForm is passed through the FrontController which in turn dispatches you to the correct Action. In our case the Action will be using methods from a class which contains all of your Buisness logic. Form example, we have a ItemDAO which has a method getItem(int itemNum). This method returns a ItemBean which stores all of the information about that item. This Bean you are using to store all of the information is called a State Bean (if I remember right, corrections are welcome). When you get the ItemBean returned from the method getItem(int itemNum) you can then add it to your session/request etc.. for example you could do request.setAttribute(itemBean, itemBean). Now once you return the ActionForward in the Action (Example: mapping.findForward(success)) the itemBean will be part of the request and you acn access these properties in the View using jsp, velocity etc.. I hope this helps you out. --Sloan p.s. Sorry for the type o's I didn't proof read Hi! Would anyone give me some examples of database programming, which lead from retrieving data to rendering view. (I mean real database, not from XML files), e.g. any web site with source, or even better, some simple example? I am very confused on how to use beans from the model. If there any book that focus on database programming? I have been searching on the web, but unable to find. Andy Cheng [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] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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 MVC - forms, EJB, data marshalling
Original Message - From: Mike Jasnowski [EMAIL PROTECTED] POJO = Plain Ole Java Object POJO = Plain Old Java Object ( nothing to do with Ole M$, just a typo ) -- Laurent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FileNotFoundException when creating FileInputStream
you are absolutely correct. I have inserted a temporary workaround. thanks for responding. best regards, douglas reames From: Navjot Singh [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: RE: FileNotFoundException when creating FileInputStream Date: Thu, 19 Jun 2003 20:29:56 +0530 hi, May be you are trying to get HTTP file using File Stream, that's why ;-) navjot |-Original Message- |From: douglas reames [mailto:[EMAIL PROTECTED] |Sent: Thursday, June 19, 2003 6:14 PM |To: [EMAIL PROTECTED] |Cc: [EMAIL PROTECTED] |Subject: FileNotFoundException when creating FileInputStream | | |When I attempt to open an XSL file to complete a transformation, I get the |exception FileNotFound. Steps: | | [1] Get file location from properties file without problem: |String myXsl = |getProperties().getProperty(fop.render.article); | |String contents: |http://localhost/artimus/pdf/renderPdf.xsl;( verified by logging ) | | [2] construct FileInputStream from string, and I get exception |FileInputStream in = new FileInputStream(myXsl); | |Err msg: java.io.FileNotFoundException: |http:\localhost\artimus\pdf\renderPdf.xsl | |Note from the message that FileInputStream appears to change the address. | |How do I force the constructor to accept the whole address? | |regards, |douglas reames |rms finance |919 929 3465 | |_ |MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. |http://join.msn.com/?page=features/virus | | |- |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] _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: design issue MVC - forms, EJB, data marshalling
Actually I wasn't referring to OLE as in M$ speak, Ole is just a short version of Old :) -Original Message- From: Laurent PETIT [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: design issue MVC - forms, EJB, data marshalling Original Message - From: Mike Jasnowski [EMAIL PROTECTED] POJO = Plain Ole Java Object POJO = Plain Old Java Object ( nothing to do with Ole M$, just a typo ) -- Laurent - 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 MVC - forms, EJB, data marshalling
Actually I wasn't referring to OLE as in M$ speak, Ole is just a short version of Old :) By short, do you mean the same amount of characters ;-) ? For some reason the POJO term really irritates me. I'm not sure why we need a special nomenclature for Java objects. David -Original Message- From: Laurent PETIT [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: design issue MVC - forms, EJB, data marshalling Original Message - From: Mike Jasnowski [EMAIL PROTECTED] POJO = Plain Ole Java Object POJO = Plain Old Java Object ( nothing to do with Ole M$, just a typo ) -- Laurent - 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] _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to ignore validation when form loads (first time)
Even my code is working with 2 action mappings, but I have 15 JSP pages so I will have to have 30 action mappings which is worrying me. [EMAIL PROTECTED] 06/19/03 01:04PM thanks for the feedback. -Original Message- From: Adam Hardy [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 12:57 PM To: Struts Users Mailing List Subject: Re: How to ignore validation when form loads (first time) I found that the approach with 2 action mappings worked fine and I got the impression when I first chose this method that it is intended to be use this way. I also used your method to check whether to validate, in situations where I had a list of records where some could be edited and some could be deleted. When deleting, I wanted to inhibit validation. Adam Kandi Potter wrote: Hi Sashi, Don't know if you've received any replies to this, but I initially handled it the same as you, but ran into problems when I was going back to the servlet for drop-down actions etc. I only wanted validation errors to appear when the user hit the save button, so I ended up just checking for the save in the validation method as such: //only validate form when a save has been pressed try {if (request.getParameter(saveBtn.x).equals(null)) return null;} catch (NullPointerException ex) {return null;} I'm also interested in feed-back on my approach. -Original Message- From: Sashi Ravipati [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2003 1:19 PM To: [EMAIL PROTECTED] Subject: How to ignore validation when form loads (first time) Hi We have JSP pages which need user input. How can I display the form initially with out validation and then when user enters data and submits the page, the validation has to be done. I tried to accomplish it by giving two action in Struts-Config.xml. as shown below eg: action path=/AddRate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=false forward name=success path=AddRate.jsp/ /action action path=/Rate type=.AddRateAction name=addRateForm input=AddRate.jsp scope=request validate=true forward name=success path=AddRate.do?target=create/ /action Not sure if this the way to do. Can somebody tell me if there is a better way to accomplish this. 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]
Re: design issue MVC - forms, EJB, data marshalling
David, would you happen to have an example app or at least an action where you have implemented the Mapper ? Adam David Graham wrote: I can't find the Mapper project in the website, do you have an URL ? It doesn't have a website yet because I just committed it recently but you can get it out of cvs. I'm interested in any and all feedback. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: design issue MVC - forms, EJB, data marshalling
By short, do you mean the same amount of characters ;-) ? By short I mean in the way ya'll is short for you all ;) -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 1:23 PM To: [EMAIL PROTECTED] Subject: RE: design issue MVC - forms, EJB, data marshalling Actually I wasn't referring to OLE as in M$ speak, Ole is just a short version of Old :) By short, do you mean the same amount of characters ;-) ? For some reason the POJO term really irritates me. I'm not sure why we need a special nomenclature for Java objects. David -Original Message- From: Laurent PETIT [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 2:17 PM To: Struts Users Mailing List Subject: Re: design issue MVC - forms, EJB, data marshalling Original Message - From: Mike Jasnowski [EMAIL PROTECTED] POJO = Plain Ole Java Object POJO = Plain Old Java Object ( nothing to do with Ole M$, just a typo ) -- Laurent - 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] _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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 MVC - forms, EJB, data marshalling
Mike Jasnowski wrote: Actually I wasn't referring to OLE as in M$ speak, Ole is just a short version of Old :) But not much shorter! ;) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FileNotFoundException when creating FileInputStream
Is the XSL file within your webapp? If so, don't use a URL to reference it. It is within the webapp. I began using the absolute reference - http://localhost:8080/artimus...; - because I was getting FileNotFound when I tried using a relative reference. I need to refer to the above static xsl file to perform a PDF transformation on the fly. I am obvoiusly a newbie - how do I do it? Take the reference out of the Properties File and put it in Struts-Config? I would prefer not to hard-code the reference. thanks for responding to me earlier. To temporarily workaround this issue, I have inserted an absolute file reference in the Properties File. This will obviously not work once I move the war file to a remote server that I don't control. best regards, douglas reames From: Max Cooper [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: FileNotFoundException when creating FileInputStream Date: Thu, 19 Jun 2003 08:46:10 -0700 FileInputStream expects a filename, but you fed it a URL. Is the XSL file within your webapp? If so, don't use a URL to reference it. If it is not within your web app but it is under your control, consider moving it into your web app. If you cannot move it, you will need to make an HTTP request to go get it. This code will go get it and give you an InputStream to read from (there may be better ways -- I just hobbled this together): InputStream in = new StringBufferInputStream( new URLConnection(new URL(myXsl)).getResponseMessage() ); This is expensive, so if you need to get this often and it doesn't change much, you should cache it within your app. Be sure to consider what a reasonable cache strategy would be, though. If you just get it once and hold onto it forever, your app will need to be restarted every time the xsl file changes, which would not be acceptable in a production environment in most cases. -Max - Original Message - From: douglas reames [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, June 19, 2003 5:43 AM Subject: FileNotFoundException when creating FileInputStream When I attempt to open an XSL file to complete a transformation, I get the exception FileNotFound. Steps: [1] Get file location from properties file without problem: String myXsl = getProperties().getProperty(fop.render.article); String contents: http://localhost/artimus/pdf/renderPdf.xsl;( verified by logging ) [2] construct FileInputStream from string, and I get exception FileInputStream in = new FileInputStream(myXsl); Err msg: java.io.FileNotFoundException: http:\localhost\artimus\pdf\renderPdf.xsl Note from the message that FileInputStream appears to change the address. How do I force the constructor to accept the whole address? regards, douglas reames rms finance 919 929 3465 _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus - 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] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: design issue MVC - forms, EJB, data marshalling
David Graham wrote: Actually I wasn't referring to OLE as in M$ speak, Ole is just a short version of Old :) By short, do you mean the same amount of characters ;-) ? For some reason the POJO term really irritates me. I'm not sure why we need a special nomenclature for Java objects. NB, AFAIK, it's just an abbreviation, not really nomenclature. IMHO of course. TTYL. ;) Erik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]