Load classes without restart tomcat
Hallo all, can I load classes that I have chance without restart Tomcat? When I chance classes then I get this error: javax.servlet.ServletException: org.apache.struts.util.PropertyMessageResources Is there a possibility to do this? Best regards, Stefan
Re: Data Object and Calendar
Matt, I solved this problem using JavaScript (if Java behaves with the same way, it will work for Java too). I compared resulting values of day, month and year for destination date after setting this properties. If they're different, date is invalid. I include my JavaScript version here: (See attached file: validate.js) --- Andrei Mamitchev [EMAIL PROTECTED] ICQ#: 89581227 I have a Data Object (DO) that we use to throw b/w our EJBs and forms. 1. In one particular DO, I am using the Gregorian Calendar to set day, month and year. 2. I am using the validation framework to validate that day is b/w 1-31, that month is b/w 1-12 and year is b/w 2001 and 2100. The validation framework is not validating day or month, because with the gregorian calendar in my getters/setters - you can set a day or a month to any number and it will simply increment the calendar. Does anyone know of a way to get around this? I'd like to NOT use Javascript, but I want to validate the value the user entered, rather than the value from the DO using getValue(); validate.js
Antigen found =*.js file
Antigen for Exchange found validate.js matching =*.js file filter. The file is currently Removed. The message, Re: Data Object and Calendar, was sent from [EMAIL PROTECTED] and was discovered in IMC Queues\Inbound located at ZDF/ZDF_MAINZ/NT_49613194.
ScanMail Message: To Recipient virus found and action taken.
ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED] Subject = Re: Data Object and Calendar Scanning Time = 08/01/2001 09:54:48 Action on virus found: The attachment validate.js matched file blocking settings. ScanMail has Deleted it. Warning to recipient. ScanMail detected a virus in an email attachment. 08/01/200109:54 AM [validate.js/Deleted] Re: Data Object and Calendar [EMAIL PROTECTED]
VIRUS Warning: AW: Data Object and Calendar
Hi Andrei, what does this mean: ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED] Subject = Re: Data Object and Calendar Scanning Time = 08/01/2001 09:54:48 Action on virus found: The attachment validate.js matched file blocking settings. ScanMail has Deleted it. Warning to recipient. ScanMail detected a virus in an email attachment. 08/01/200109:54 AM [validate.js/Deleted] Re: Data Object and Calendar [EMAIL PROTECTED] -Ursprungliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 1. August 2001 10:47 An: [EMAIL PROTECTED] Betreff: Re: Data Object and Calendar Matt, I solved this problem using JavaScript (if Java behaves with the same way, it will work for Java too). I compared resulting values of day, month and year for destination date after setting this properties. If they're different, date is invalid. I include my JavaScript version here: (See attached file: validate.js) --- Andrei Mamitchev [EMAIL PROTECTED] ICQ#: 89581227 I have a Data Object (DO) that we use to throw b/w our EJBs and forms. 1. In one particular DO, I am using the Gregorian Calendar to set day, month and year. 2. I am using the validation framework to validate that day is b/w 1-31, that month is b/w 1-12 and year is b/w 2001 and 2100. The validation framework is not validating day or month, because with the gregorian calendar in my getters/setters - you can set a day or a month to any number and it will simply increment the calendar. Does anyone know of a way to get around this? I'd like to NOT use Javascript, but I want to validate the value the user entered, rather than the value from the DO using getValue();
Re: VIRUS Warning: AW: Data Object and Calendar
Unfortunately discussion software treated my attachment as virus. I'll put here entrie contents of my function: var dateDelim = '-'; var dateOrder = 'DMY'; var dateMask = ''; var lastValidatedDate = null; var requiredMsg = 'Value required for field '; var invalidMsg = 'Invalid value for field ';function validateDate(item, label, required) { if(required item.value == '') { alert(requiredMsg + '' + label + ''); return false; } if(item.value == '') return true; var expRes = /([0-9]*)([^0-9]([0-9]*)([^0-9]([0-9] *))?)?/.exec(item.value); if(expRes != null) { var curDate = new Date(); var ys = expRes[(dateOrder.indexOf('Y') + 1) * 2 - 1]; var y = NaN; if(ys == '') y = curDate.getFullYear(); else y = parseInt(ys); if(y = 0 y = 99) { var y100 = curDate.getFullYear(); y100 = y100 - (y100 % 100); if(y 50) { y += y100 - 100; } else { y += y100; } } var ms = expRes[(dateOrder.indexOf('M') + 1) * 2 - 1]; var m = NaN; if(ms == '') m = curDate.getMonth() + 1; else m = parseInt(ms); var d = parseInt(expRes[(dateOrder.indexOf('D') + 1) * 2 - 1]); var date = new Date(y, m - 1, d); } if(expRes == null || isNaN(d) || date == null || date.getFullYear() != y || date.getMonth() != (m - 1) || date.getDate() != d) { item.focus(); item.focus(); alert(invalidMsg + '' + label + ''); return false; } else { var adj = '' for(i=0; i3; i++) { if(i 0) adj += dateDelim; switch(dateOrder.charAt(i)) { case 'Y': adj += date.getFullYear(); break; case 'M': var mm = new String('0' + (date.getMonth() + 1)); adj += mm.substr(mm.length - 2); break; case 'D': var dd = new String('0' + date.getDate()); adj += dd.substr(dd.length - 2); break; } } item.value = adj; lastValidatedDate = adj; return true; } } --- Andrei Mamitchev [EMAIL PROTECTED] ICQ#: 89581227 Hi Andrei, what does this mean: ScanMail for Microsoft Exchange has detected virus-infected attachment(s). Sender = [EMAIL PROTECTED] Recipient(s) = [EMAIL PROTECTED] Subject = Re: Data Object and Calendar Scanning Time = 08/01/2001 09:54:48 Action on virus found: The attachment validate.js matched file blocking settings. ScanMail has Deleted it. Warning to recipient. ScanMail detected a virus in an email attachment. 08/01/200109:54 AM [validate.js/Deleted] Re: Data Object and Calendar [EMAIL PROTECTED] -Ursprungliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 1. August 2001 10:47 An: [EMAIL PROTECTED] Betreff: Re: Data Object and Calendar Matt, I solved this problem using JavaScript (if Java behaves with the same way, it will work for Java too). I compared resulting values of day, month and year for destination date after setting this properties. If they're different, date is invalid. I include my JavaScript version here: (See attached file: validate.js) --- Andrei Mamitchev [EMAIL PROTECTED] ICQ#: 89581227 I have a Data Object (DO) that we use to throw b/w our EJBs and forms. 1. In one particular DO, I am using the Gregorian Calendar to set day, month and year. 2. I am using the validation framework to validate that day is b/w 1-31, that month is b/w 1-12 and year is b/w 2001 and 2100. The validation framework is not validating day or month, because with the gregorian calendar in my getters/setters - you can set a day or a month to any number and it will simply increment the calendar. Does anyone know of a way to get around this? I'd like to NOT use Javascript, but I want to validate the value the user entered, rather than the value from the DO using getValue();
Re: AW: AW: action-mapping: why must the action-Attribute path be equivalent to the name of the jsp?
I share a similar concern. I'm wondering if it makes sense to extend Struts' mapping architecture so that it will also look into a 'magic' url parameter and dispatch accordingly. For example, if the URL is MyAction.do?subAction=Create the ActionServlet will dispatch the request to the MyActionCreate class given the following (enhanced) action mapping. action path=MyAction subAction=Create type=MyActionCreate .../ This will make it easily to have forms with multiple buttons which require different actions. -- John At 10:18 AM 8/1/2001 +0200, you wrote: Isn't it against the mvc philosophy to put navigation code (e.g. control) into a tag (e.g. view) ? -Ursprungliche Nachricht- Von: Ted Husted [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 31. Juli 2001 18:42 An: [EMAIL PROTECTED] Betreff: Re: AW: action-mapping: why must the action-Attribute path be equivalent to the name of the jsp? The usual solution would be to design your forms to contain hidden fields that tell the Action which operation to perform with the next request. So typically, there would be one button with a hidden field that conveyed whether this was the FirstAction or the SecondAction. These would all go back to a single Action that either performed all the operations, or forwarded onto another Action. If you will be using this button that much, you might also consider writing your own custom tag so the button could program itself from the request. In general, the request is meant to convey information to the presentation layer about how it is suppose to write itself. In my own projects, I am experimenting with ways to make the current ActionMappings available to the JSP, as they are to perform() and validate(), which starts to open several doors. [EMAIL PROTECTED] wrote: Thanks, at least it's a working work-around. But the ugly thing is, that in both cases the same action is called and I am forced to call the real action from the first action depending on the pushed button. + Action inserts fire bean into rquest context + Forward to JSP + JSP checks to see if fire==first. If so, write TheFirstAction button + JSP checks to see if fire==second. If so, write TheSecondActon button + submit fires action + action does nothing and forwards to the real action depending on the button. In my real world the page will be reused at least 5 or six times. So rather than putting the Control part of MVC in the struts-config.xml I start piggypacking info in the request and analysing this in the dummy action. However again thanks. Peter -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610
RE: Problem with Struts in VAJ 3.5.3 WTE
I think this file can be located any where, however it must also be added to Visual Age as a resource. To add as a resource... Go to the Resource Tab and select the required project. Right click on the project you want to add the file to and select AddResource. Browse to the directory holding the ApplicationResources.properties file and click OK. Select the ApplicationResources.properties file and click OK. I wasn't able to get the employeelist example working, but I did get the strut-example application working. I found the strut-example code much easier to work with. David David McIvor Experienced Software Developer Liberty Information Technology Direct Line:++44 (0) 28 9044 5520 Clarendon House Fax:++44 (0) 28 9044 5511 9-21 Adelaide StreetSwitchboard:++44 (0) 28 9044 5500 Belfast, Northern Ireland BT2 8DJ Email: [EMAIL PROTECTED] Disclaimer: The contents of this e-mail and attached files in no way reflect any policies of Liberty Information Technology Ltd. -Original Message- From: Maria Laura Velazquez [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 21:11 To: [EMAIL PROTECTED] Subject: RE: Problem with Struts in VAJ 3.5.3 WTE Hi!, I'm María Laura, and I have the problem mentioned here: the employeelist app index.jsp page throws the following error: Mensaje: Server caught unhandled exception from servlet [jsp]: Missing message for key index.title Firstly, I edited the ApplicationResourses.properties files, adding the key index.title, because it wasn't here. Second, I have added the extra-path: c:\archivos de programa/ibm/visualage for java/ide/project_resources/ibm websphere test environment/hosts/default_host/employeelist/WEB-INF/classes and the following directory structure : employeelist- index.jsp jsp- *.jsp *.webapp WEB-INF- *.tld, *.xml, *.dtd classes- ApplicationResourses.properties WEB-INF- *.tld, *.xml, *.dtd classes- ApplicationResourses.properties And it didn't work. Also, I edited the EmployeeEdit.jsp page and added the following line (that appears in index.jsp): titlebean:message key=index.title//title Surprisingly, I hadn't the error for the key index.title, but the title for my page was: bean:message key=index.title/ !!! Has anybody some idea about this? how can I solve this problem? Excuse me for my english. Regards. ML -Mensaje original- De: Lock, Steven [mailto:[EMAIL PROTECTED]] Enviado el: jueves, 21 de junio de 2001 10:57 Para: [EMAIL PROTECTED] Asunto: Re: Problem with Struts in VAJ 3.5.3 WTE Hi Thanks John, I tried recreating the directory structure of your webapp but it unfortunately didn't help (I take it your employeelist webapp thus has a document root of $approot$/web is that correct?). Igor, that you have it working without changes makes me think that there may be something wrong with my setup. This is my webapp definition: websphere-webgroup name=employeelist descriptionEmployeeList Webgroup/description document-root$approot$/document-root classpath$approot$/classpath root-uri/employeelist/root-uri auto-reload enabled=true polling-interval=3000/ shared-contextfalse/shared-context /websphere-webgroup and my directory structure: employeelist -index.jsp jsp -employeeEdit.jsp -employeeList.jsp -employeeSearch.jsp Web-inf -all the .XML, .DTD and .TLD files classes -ApplicationResources.properties I also have va root/ide/project_resources/ibm websphere test environment/hosts/default_host/employeelist/WEB-INF/classes; va root/ide/project_resources/ibm websphere test environment/hosts/default_host/employeelist/WEB-INF; in the extra directories list. The webapp itself works ok (I tested the HelloWorld servlet). Is index.jsp necessary for the employeelist demo? Thanks Steve -Ursprüngliche Nachricht- Von: Karmanov, Igor [mailto:[EMAIL PROTECTED]] Gesendet am: Donnerstag, 21. Juni 2001 14:49 An: [EMAIL PROTECTED] Betreff: RE: Problem with Struts in VAJ 3.5.3 WTE I've got the employeelist working fine in WTE 3.5.3 without any changes and now I'm testing my app with the same structure. It looks like the key for access to ApplicationResources.properties file is to put the following in extra class path in WTE: d:/program files/ibm/visualage for java/ide/project_resources/ibm websphere test
SIGN-OFF
_ For Rs. 2,000,000 worth of Aptech scholarships click below http://events.rediff.com/aptechsch/scholarship.htm
RE: Automatic Form Validation - A further question
Thanks again David. I have explored extending ActionForm to check for and ignore first time validation. However, it seems from my debug, that the form bean is created a new each time. Can someone else confirm this ? My further question is this: If I choose NOT to use automatic validation, and my request goes to the Action first [not the JSP], then what isthe best way to determine in the action that this is the 'first time' for this form bean i.e. it has been created only as a result of the ActionServlet, not because it's coming from the form on a JSP ? I know you can check the values of the form bean, but this seems a little messy. Any suggestions ? Any help is appreciated, as this is an important issue for us. Cheers Ghoot -Original Message- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 18:43 To: [EMAIL PROTECTED] Subject: RE: Automatic Form Validation --- Emaho, Ghoot [EMAIL PROTECTED] wrote: Thanks for the reply David. Yeah, 'action' checking is another way of determining wether or not to do the validation. I guess I was wondering if it was possible to configure the Form to prevent first time checking ? Would anyone else find this useful ? Given the recent discussions about preventing direct acces to JSP's, it seems that the Form validation is designed [in default operation] in such a way as to expect that you have gone directly to the JSP first. This is one thing I wouldnt really ever want to do, as I prefer all requests to go through an action - even if it is just to redirect to the JSP [call me a control freak! but there area lot of others that feel the same :) ] I think it is good to go through the controller if you really want to keep the view separate. I wonder if the Auto Validation should accomodate the more common scenario [certainly in larger applications] where you do want to force requests thru actions and avoid direct JSP access, but avoid first time validation. I guess Action Form could be extended to provide this, but I was hoping it would already be there - as it seems quite obvious and important. I dont think we should be encouraging people to go directly to the JSP as part of the Struts framework [just my 2p] You could always have one Action class that handles all things that are auto-validatded and another for things that shouldn't be validated. I'm not sure how you could have the framework handle something that is specific for your application unless there was a parameter that could turn off the auto-validation for the current request (org.apache.struts.action.Action.VALIDATE=false). Picking up on what you mentioned David, about handling all 'actions' todo with a form in the one Action class. We have some sceanrios where this is just not practical. What about those scenarios ?! You can of course have as many actions to go with a form as you want. I just prefer keeping it to a minimum. Thanks anyway David. Any other comments ? G -Original Message- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 16:46 To: [EMAIL PROTECTED] Subject: RE: Automatic Form Validation If you have a variable called action that keeps track of what type of action you are performing (create, update, delete), you could check for this in the validate method and only validate on create or update. The Struts example webapp has an action field to keep track of this. I wouldn't do that personally. I've always done my validation from the Action so I could use the same action for everything associated with a form/table. For example, delete doesn't need validation or sending someone through the action to the view for the first time (as you mentionded). So I don't think there is anything wrong with not using the automatic validation. I think it just depends on your design preference. David --- Emaho, Ghoot [EMAIL PROTECTED] wrote: Some further details on my question: I understand that you can have the request go straight to the JSP and avoid the first time validation. This is acceptable in some circumstance, but in other circumstances you may wish to have your action do some work before presenting the page (a common requirement in more complex applications), and you may wish to avoid access to any JSP's directly. How then (with this extra clarification) can you prevent the behaviour described in the original posting ? Many thanks for any help Ghoot PS Please someone respond ! So i dont get too disillusioned :) -Original Message- From: Emaho, Ghoot Sent: 31 July 2001 15:49 To: [EMAIL PROTECTED] Subject: Automatic Form Validation Quick question
Re: AW: AW: action-mapping: why must the action-Attribute path be equivalent to the name of the jsp?
[EMAIL PROTECTED] wrote: Isn't it against the mvc philosophy to put navigation code (e.g. control) into a tag (e.g. view) ? Generally, it's the view's job to capture user gestures, and the controller's job to interpret them. Presentation code that says next or prev is a gesture. Code that says next.jsp or prev.jsp is interpreting a gesture. So far this discussion has been about constructing a dynamic view that presents the buttons needed to capture the user gestures: they want to do this or they want to do that. A core problem is that a HTML button's label and its value are the same, so we have to use hidden fields, and other smoke-and-mirror techniques, to get buttons with the same labels to represent different gestures. In real life, we still need to use logic to program the view. Otherwise, we would have to a different page for every combination of application state. One form for input. Another for update. Of course, this would violate the MVC prime directive: optimize for long-term maintenance (or change is the only constant ;0). The cutting edge is whether the view knows anything about other views. When this happens, changes start to cascade between pages, and maintenance is not optimal. So long as all links pass through ActionForwards (forward=) and mappings (*.do or /do/*), then the flow is being determined by controller layer, and could be reconfigured without changing the presentation code. Thus, the MVC gods are appeased ;-) -Ted.
String as Index
Hi, as far as I can remember, there was a topic about String as index in property getters/setters here some time ago. I'd like somethigh like this: html:text property=aaa{bbb} / and aaa{bbb} should be converted to getAaa(bbb) and setAaa(bbb, value). Is there something implemented in this direction already? Can I use the results? Can I help? -- gR
[LONG] Re: action-mapping: why must the action-Attributepath be equivalent to the name of the jsp?
John Yu wrote: I'm wondering if it makes sense to extend Struts' mapping architecture so that it will also look into a 'magic' url parameter and dispatch accordingly. For example, if the URL is MyAction.do?subAction=Create the ActionServlet will dispatch the request to the MyActionCreate class given the following (enhanced) action mapping. action path=MyAction subAction=Create type=MyActionCreate .../ Actions can forward to other ActionMappings, if the mappings are exposed as ActionForwards. If that's something you would like to do, you can use a generic dispatcher that would look for the subaction parameter and return the appropriate forward to another mapping. Here's an example perform() that can forward anywhere given /do/Dispatch?forward=forwardName. // -- Locals ActionForward thisForward = null; String wantForward = null; // -- Check check request for forward wantForward = request.getParameter(forward); // -- If found, consult mappings if (wantForward!=null) thisForward = mapping.findForward(wantForward); // -- If anything not found, dispatch error if (thisForward==null) { thisForward = mapping.findForward(error); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(action.missing.parameter)); saveErrors(request, errors); } return thisForward; Here's a simple Hello World action to test it: response.setContentType(text/plain); PrintWriter writer = response.getWriter(); writer.println(Hello from: + mapping.getPath()); return(null); And some sample mappings: !-- Dispatcher action mapping -- action path=/Dispatch type=ext.http.DispatchForward scope=request validate=false forward name=test1 path=/do/Test1/ forward name=test2 path=/do/Test2/ /action action path=/Test1 type=ext.http.Test1 scope=request validate=false /action action path=/Test2 type=ext.http.Test1 scope=request validate=false /action If you ask for do/Dispatch?task=test1 you get Hello from test1 if you open do/Dispatch?task=test2 you get Hello from test2. (Note that an Action knows which path is used to call it, which is another way you can have Actions do different things based on the mapping context.) I only just wrote this, and it seems OK, but be warned that it is alpha code ;o) A couple of things to keep in mind: + You never really call an Action. You reference an ActionMapping, and the Controller calls the Action from that. + The ActionForms are populated from the request when the controller invokes the Action for a mapping. So if you forward the request to another mapping, it would populate the form for that mapping from the forwarded request. + Actions are not bound to ActionForms. The form is bound by the ActionMapping, and an Action can be used in any number of mappings. + Many times developers use the same or related names for an Action and the path to an ActionMapping. That is only a convenience. In Struts, you can only specify a logical path to an ActionMapping. What is behind that mapping is determined by the configuration file, and therefore belongs to the controller layer. Meanwhile ... a similar thing to the DispatchForward class given above can be done using the optional DispatchAction class in Struts 1.0 (org.apache.struts.actions.DispatchAction). Here you can create alternate perform methods in a single action, and call one or the another in the request. So you could have public ActionForward retrieve(ActionMapping mapping, ... public ActionForward update(ActionMapping mapping, ... and then call one or the other using myDispatchAction?method=retrieve or myDispatchAction?method=update. See the Struts JavaDoc for details. Very neat, really. -Ted.
RE: String as Index
You can use the PropertyUtils that I have created (reusing the Struts one) within the Mapper framework (http://www.husted.com/about/struts/resources.htm#extensions). It supports string keyed properties, using the notation 'simple.nested.indexed[1].stringKeyed(key)'. See this posting about this topic. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10858.html Fr. -Original Message- From: Gregor Rayman [mailto:[EMAIL PROTECTED]] Sent: 01 August 2001 13:55 To: [EMAIL PROTECTED] Subject: String as Index Hi, as far as I can remember, there was a topic about String as index in property getters/setters here some time ago. I'd like somethigh like this: html:text property=aaa{bbb} / and aaa{bbb} should be converted to getAaa(bbb) and setAaa(bbb, value). Is there something implemented in this direction already? Can I use the results? Can I help? -- gR The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
Re: String as Index
Hello Gregor, Wednesday, August 01, 2001, 3:55:04 PM, you wrote: GR as far as I can remember, there was a topic about String as index in GR property getters/setters here some time ago. GR I'd like somethigh like this: GR html:text property=aaa{bbb} / GR and aaa{bbb} should be converted to getAaa(bbb) and setAaa(bbb, value). GR Is there something implemented in this direction already? Can I use the GR results? Can I help? Now indexed properties can be used only. All properties are processed by utilites from beanutils package at jakarta-commons. It can parse indexed properties only. Named properties is great addition, of course. And of course, you can refactor beanutils package to implement named properties. It will be great help. 8) -- Best regards, Olegmailto:[EMAIL PROTECTED]
RE: Problem with Struts in VAJ 3.5.3 WTE
Hi! Sorry for my ignorance, but I'm new to struts. Finally, I have made the employeelist example work! The problem with the Missing message for key index.title error was that I have another ApplicationResources.properties file in another proyect, that was in the classpath too. And WTE found it first, and it tried to find the index.title key in that file, and it couldn't. So, to solve the problem, I renamed that file in the other project, and WTE started to work with the emploeyeelist's resources. My conclusion is that if it exists 2 or more properties files with the same name for different projects in the classpath, WTE will take the first, or at least, only one of them. If somebody has another conclusion.thanks! I hope this will help somebody else. Regards. ML -Mensaje original- De: McIvor, David (LIT) [mailto:[EMAIL PROTECTED]] Enviado el: miércoles, 01 de agosto de 2001 6:14 Para: '[EMAIL PROTECTED]' Asunto: RE: Problem with Struts in VAJ 3.5.3 WTE I think this file can be located any where, however it must also be added to Visual Age as a resource. To add as a resource... Go to the Resource Tab and select the required project. Right click on the project you want to add the file to and select AddResource. Browse to the directory holding the ApplicationResources.properties file and click OK. Select the ApplicationResources.properties file and click OK. I wasn't able to get the employeelist example working, but I did get the strut-example application working. I found the strut-example code much easier to work with. David David McIvor Experienced Software Developer Liberty Information Technology Direct Line:++44 (0) 28 9044 5520 Clarendon House Fax:++44 (0) 28 9044 5511 9-21 Adelaide StreetSwitchboard:++44 (0) 28 9044 5500 Belfast, Northern Ireland BT2 8DJ Email: [EMAIL PROTECTED] Disclaimer: The contents of this e-mail and attached files in no way reflect any policies of Liberty Information Technology Ltd. -Original Message- From: Maria Laura Velazquez [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 21:11 To: [EMAIL PROTECTED] Subject: RE: Problem with Struts in VAJ 3.5.3 WTE Hi!, I'm María Laura, and I have the problem mentioned here: the employeelist app index.jsp page throws the following error: Mensaje: Server caught unhandled exception from servlet [jsp]: Missing message for key index.title Firstly, I edited the ApplicationResourses.properties files, adding the key index.title, because it wasn't here. Second, I have added the extra-path: c:\archivos de programa/ibm/visualage for java/ide/project_resources/ibm websphere test environment/hosts/default_host/employeelist/WEB-INF/classes and the following directory structure : employeelist- index.jsp jsp- *.jsp *.webapp WEB-INF- *.tld, *.xml, *.dtd classes- ApplicationResourses.properties WEB-INF- *.tld, *.xml, *.dtd classes- ApplicationResourses.properties And it didn't work. Also, I edited the EmployeeEdit.jsp page and added the following line (that appears in index.jsp): titlebean:message key=index.title//title Surprisingly, I hadn't the error for the key index.title, but the title for my page was: bean:message key=index.title/ !!! Has anybody some idea about this? how can I solve this problem? Excuse me for my english. Regards. ML -Mensaje original- De: Lock, Steven [mailto:[EMAIL PROTECTED]] Enviado el: jueves, 21 de junio de 2001 10:57 Para: [EMAIL PROTECTED] Asunto: Re: Problem with Struts in VAJ 3.5.3 WTE Hi Thanks John, I tried recreating the directory structure of your webapp but it unfortunately didn't help (I take it your employeelist webapp thus has a document root of $approot$/web is that correct?). Igor, that you have it working without changes makes me think that there may be something wrong with my setup. This is my webapp definition: websphere-webgroup name=employeelist descriptionEmployeeList Webgroup/description document-root$approot$/document-root classpath$approot$/classpath root-uri/employeelist/root-uri auto-reload enabled=true polling-interval=3000/ shared-contextfalse/shared-context /websphere-webgroup and my directory structure: employeelist -index.jsp jsp -employeeEdit.jsp -employeeList.jsp -employeeSearch.jsp Web-inf -all
jsp pages got memory limits?
Title: jsp pages got memory limits? Hi all. I'm getting this Exception: === java.lang.VerifyError: (class: jsp/_0002fjsp_0002f_00031_00035_0005f_00035_0005fpilotTest_0005f_00030_00035_00036_00030_0002ejsp15_0005f5_0005fpilotTest_0005f0560_jsp_22, method: _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletRespo === when building a form with aprox 30 radio buttons. It seems that over a 92Kb. of .class generated from out jsp page the system crashes. If I remove some data from the form, this doesn't happens. Any idea about? There are memory limits with struts or even jsp specification? --- Raffaele Sgherri ? Sapient | Via Crocefisso, 19 - 20122 Milano (Italia).
Re: jsp pages got memory limits?
True, there is a 64k limit for a java method. You need to divide your page in sub-pages, and do some insert / include of your sub-pages. You can use jsp:include ... or, best ;-), Template tags, or Tiles tags. Cedric Tiles sites : http://www.lifl.fr/~dumoulin/tiles/ (mirror) : http://www.geocities.com/cedricdumoulin/tiles/ Raffaele Sgherri wrote: Hi all. I'm getting this Exception: === java.lang.VerifyError: (class: jsp/_0002fjsp_0002f_00031_00035_0005f_00035_0005fpilotTest_0005f_00030_00035_00036_00030_0002ejsp15_0005f5_0005fpilotTest_0005f0560_jsp_22, method: _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletRespo === when building a form with aprox 30 radio buttons. It seems that over a 92Kb. of .class generated from out jsp page the system crashes. If I remove some data from the form, this doesn't happens. Any idea about? There are memory limits with struts or even jsp specification? --- Raffaele Sgherri ? Sapient | Via Crocefisso, 19 - 20122 Milano (Italia).
Re: String as Index
Oleg V Alexeev [EMAIL PROTECTED] wrote: Now indexed properties can be used only. All properties are processed by utilites from beanutils package at jakarta-commons. It can parse indexed properties only. Named properties is great addition, of course. And of course, you can refactor beanutils package to implement named properties. It will be great help. 8) -- Best regards, Olegmailto:[EMAIL PROTECTED] And Rey Francois [EMAIL PROTECTED] wrote: You can use the PropertyUtils that I have created (reusing the Struts one) within the Mapper framework (http://www.husted.com/about/struts/resources.htm#extensions). It supports string keyed properties, using the notation 'simple.nested.indexed[1].stringKeyed(key)'. See this posting about this topic. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10858.html Fr. I will evaluate it. It seems, Francois has already implemented exactly what I need. Anyway, if there is something to be done (like bringing this to beanutils) I'd help if there is need. -- gR
Re[2]: String as Index
Hello Rey, Rey, I search page but can not found anything about your string keyed proeprties. Can you send URL to the archive with sources? Wednesday, August 01, 2001, 3:59:51 PM, you wrote: RF You can use the PropertyUtils that I have created (reusing the Struts one) RF within the Mapper framework RF (http://www.husted.com/about/struts/resources.htm#extensions). It supports RF string keyed properties, using the notation RF 'simple.nested.indexed[1].stringKeyed(key)'. RF See this posting about this topic. RF http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10858.html RF Fr. RF -Original Message- RF From: Gregor Rayman [mailto:[EMAIL PROTECTED]] RF Sent: 01 August 2001 13:55 RF To: [EMAIL PROTECTED] RF Subject: String as Index RF Hi, RF as far as I can remember, there was a topic about String as index in RF property getters/setters here some time ago. RF I'd like somethigh like this: RF html:text property=aaa{bbb} / RF and aaa{bbb} should be converted to getAaa(bbb) and setAaa(bbb, value). RF Is there something implemented in this direction already? Can I use the RF results? Can I help? RF -- RF gR RF RF The information in this email is confidential and is intended solely RF for the addressee(s). RF Access to this email by anyone else is unauthorised. If you are not RF an intended recipient, you must not read, use or disseminate the RF information contained in the email. RF Any views expressed in this message are those of the individual RF sender, except where the sender specifically states them to be RF the views of Capco. RF http://www.capco.com RF *** -- Best regards, Olegmailto:[EMAIL PROTECTED]
log4j log file location (was: RE: struts and log4J)
Yes, this is how I did it, and it works fine. Does anybody know how you can set the location of the log-file to a *relative* path (e.g. /WEB-INF/log) instead of an absolute path? Marcel -Oorspronkelijk bericht- Van: William Jaynes [mailto:[EMAIL PROTECTED]] Verzonden: dinsdag 31 juli 2001 15:43 Aan: [EMAIL PROTECTED] Onderwerp: Re: struts and log4J The easiest way is to let the log4j static initializer work for you. Place log4j.jar in your WEB-INF/lib directory and your log4j.properties file in WEB-INF/classes. - Original Message - From: DUPRAT Alexandre [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 5:03 AM Subject: struts and log4J Hi all, I'm a newbie in struts. I'd like to use log4J with struts. I don't know where i must do the log4J configuration. In another servlet, i would do it in init method but i would like to use ActionServlet. Where can i put code like : BasicConfigurator.configure() . ? Thanks for help. Alexandre Duprat SOPRA. Direction France Sud. Bordeaux [EMAIL PROTECTED] ++ | Ce courrier ainsi que les fichiers joints sont confidentiels. | | Si vous avez recu ce courrier par erreur, veuillez en informer | | l'administrateur du systeme : [EMAIL PROTECTED] | | - | | Ce message confirme que le courrier a passe le controle| | antivirus du relais de messagerie Internet avec succes.| ++
mock objects for unit testing struts actions
i would like to write JUnit tests for my struts Action classes. these would test that certain attributes have been added to the servlet request, an appropriate ActionForward object is returned, and so forth. i looked into the MockObjects library on sourceforge...but it seems that a lot of the methods on the MockHttpServletRequest are no-ops or return null. am i to understand that i must subclass MockHttpServletRequest and add in whatever stubbed-out functionality i want? or are there other mock objects libraries for the servlet API that will better suit my needs? cheers, p
problem with FormFile
Hi, I have created file upload.jsp: %@ page contentType=text/html; charset=ISO-8859-2 % %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-2 META NAME=Author CONTENT=Bartlomiej Pawlowski titleupload/title /head body html:form action=/upload File html:file property=file maxlength=30 styleClass=form2/ html:submitUpload/html:submit /html:form /body /html:html and ActionForm bean: public class UploadForm extends ActionForm { private FormFile file; public UploadForm() { } public void setFile(FormFile file) { this.file = file; } public FormFile getFile() { return file; } } when I submit this form I receive following exception: Internal Servlet Error: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:486) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:1910) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) Root cause: java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:825) at org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:756) at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:782) What is wrong? Who can help me?
RE: Silly Question - Where is the notEmpty tag?
Ah, the opposite of deprecated, new goodies! :D Thanks! Chris -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 31, 2001 11:45 PM To: [EMAIL PROTECTED] Subject: Re: Silly Question - Where is the notEmpty tag? The logic:empty and logic:notEmpty tags are part of Struts 1.1, and hence only available in the nightly builds at this time. If you're using Struts 1.0, that would explain the problem you are seeing. For documentation that accurately reflects the build you are using, your best bet is to use the struts-documentation.war web app included in the distribution. -- Martin Cooper - Original Message - From: Assenza, Chris [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 12:22 PM Subject: Silly Question - Where is the notEmpty tag? It is on the web page's documentation but nowhere to be found in the source or TLD...I'm assuming it's been deprecated. It may be a good idea to take it off the page cause I was all excited about it until my JSP screamed at me. :P Chris
RE: Automatic Form Validation - A further question
--- Emaho, Ghoot [EMAIL PROTECTED] wrote: Thanks again David. I have explored extending ActionForm to check for and ignore first time validation. However, it seems from my debug, that the form bean is created a new each time. Can someone else confirm this ? If you have the scope of the action set to 'request', then the bean is only around for the request. So it would be created each time. My further question is this: If I choose NOT to use automatic validation, and my request goes to the Action first [not the JSP], then what isthe best way to determine in the action that this is the 'first time' for this form bean i.e. it has been created only as a result of the ActionServlet, not because it's coming from the form on a JSP ? I know you can check the values of the form bean, but this seems a little messy. Any suggestions ? I think checking for values is the best way. How else can you tell one instance from another? The only other way I can think of is to have the a class and a subclass(es) that doesn't do anything, but represents what state the bean is in. Any help is appreciated, as this is an important issue for us. Cheers Ghoot -Original Message- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 18:43 To: [EMAIL PROTECTED] Subject: RE: Automatic Form Validation --- Emaho, Ghoot [EMAIL PROTECTED] wrote: Thanks for the reply David. Yeah, 'action' checking is another way of determining wether or not to do the validation. I guess I was wondering if it was possible to configure the Form to prevent first time checking ? Would anyone else find this useful ? Given the recent discussions about preventing direct acces to JSP's, it seems that the Form validation is designed [in default operation] in such a way as to expect that you have gone directly to the JSP first. This is one thing I wouldnt really ever want to do, as I prefer all requests to go through an action - even if it is just to redirect to the JSP [call me a control freak! but there area lot of others that feel the same :) ] I think it is good to go through the controller if you really want to keep the view separate. I wonder if the Auto Validation should accomodate the more common scenario [certainly in larger applications] where you do want to force requests thru actions and avoid direct JSP access, but avoid first time validation. I guess Action Form could be extended to provide this, but I was hoping it would already be there - as it seems quite obvious and important. I dont think we should be encouraging people to go directly to the JSP as part of the Struts framework [just my 2p] You could always have one Action class that handles all things that are auto-validatded and another for things that shouldn't be validated. I'm not sure how you could have the framework handle something that is specific for your application unless there was a parameter that could turn off the auto-validation for the current request (org.apache.struts.action.Action.VALIDATE=false). Picking up on what you mentioned David, about handling all 'actions' todo with a form in the one Action class. We have some sceanrios where this is just not practical. What about those scenarios ?! You can of course have as many actions to go with a form as you want. I just prefer keeping it to a minimum. Thanks anyway David. Any other comments ? G -Original Message- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 16:46 To: [EMAIL PROTECTED] Subject: RE: Automatic Form Validation If you have a variable called action that keeps track of what type of action you are performing (create, update, delete), you could check for this in the validate method and only validate on create or update. The Struts example webapp has an action field to keep track of this. I wouldn't do that personally. I've always done my validation from the Action so I could use the same action for everything associated with a form/table. For example, delete doesn't need validation or sending someone through the action to the view for the first time (as you mentionded). So I don't think there is anything wrong with not using the automatic validation. I think it just depends on your design preference. David --- Emaho, Ghoot [EMAIL PROTECTED] wrote: Some further details on my question: I understand that you can have the request go straight to the JSP and avoid the first time validation. This is acceptable in some circumstance, but in other circumstances you may wish to have your
RE: Automatic Form Validation - A further question
I have a solution which is acceptable for now. I have switched automatic validation off for the form bean, although i have kept the type/formatting validation logic in the validate method of the form bean. I have also added an additional function to the form bean 'isVirgin()' which my action class calls. This tells the action wether or not it's the first time round. This is achieved by checking all the form bean attributes against null - which they are the first time it is created [providing you dont initialise the private member variables in your form bean] As this method is in the form bean itself, the action is unaware of how this is determined, allowing it to change in the future. If the form is a virgin [excuse the language :)] the action justs forwards on to the input page. If it's not a virgin, it then calls the validate method on the form bean, and then does whatever else it needs to do. This seems to work well and is portable across all my form beans which means i have a consistent implementation. Thanks for your input David Cheers Ghoot -Original Message- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: 01 August 2001 16:11 To: [EMAIL PROTECTED] Subject: RE: Automatic Form Validation - A further question --- Emaho, Ghoot [EMAIL PROTECTED] wrote: Thanks again David. I have explored extending ActionForm to check for and ignore first time validation. However, it seems from my debug, that the form bean is created a new each time. Can someone else confirm this ? If you have the scope of the action set to 'request', then the bean is only around for the request. So it would be created each time. My further question is this: If I choose NOT to use automatic validation, and my request goes to the Action first [not the JSP], then what isthe best way to determine in the action that this is the 'first time' for this form bean i.e. it has been created only as a result of the ActionServlet, not because it's coming from the form on a JSP ? I know you can check the values of the form bean, but this seems a little messy. Any suggestions ? I think checking for values is the best way. How else can you tell one instance from another? The only other way I can think of is to have the a class and a subclass(es) that doesn't do anything, but represents what state the bean is in. Any help is appreciated, as this is an important issue for us. Cheers Ghoot -Original Message- From: David Winterfeldt [mailto:[EMAIL PROTECTED]] Sent: 31 July 2001 18:43 To: [EMAIL PROTECTED] Subject: RE: Automatic Form Validation --- Emaho, Ghoot [EMAIL PROTECTED] wrote: Thanks for the reply David. Yeah, 'action' checking is another way of determining wether or not to do the validation. I guess I was wondering if it was possible to configure the Form to prevent first time checking ? Would anyone else find this useful ? Given the recent discussions about preventing direct acces to JSP's, it seems that the Form validation is designed [in default operation] in such a way as to expect that you have gone directly to the JSP first. This is one thing I wouldnt really ever want to do, as I prefer all requests to go through an action - even if it is just to redirect to the JSP [call me a control freak! but there area lot of others that feel the same :) ] I think it is good to go through the controller if you really want to keep the view separate. I wonder if the Auto Validation should accomodate the more common scenario [certainly in larger applications] where you do want to force requests thru actions and avoid direct JSP access, but avoid first time validation. I guess Action Form could be extended to provide this, but I was hoping it would already be there - as it seems quite obvious and important. I dont think we should be encouraging people to go directly to the JSP as part of the Struts framework [just my 2p] You could always have one Action class that handles all things that are auto-validatded and another for things that shouldn't be validated. I'm not sure how you could have the framework handle something that is specific for your application unless there was a parameter that could turn off the auto-validation for the current request (org.apache.struts.action.Action.VALIDATE=false). Picking up on what you mentioned David, about handling all 'actions' todo with a form in the one Action class. We have some sceanrios where this is just not practical. What about those scenarios ?! You can of course have as many actions to go with a form as you want. I just prefer keeping it to a minimum. Thanks
Templates: a design question
Hello all, I am very new to Struts and I find it interesting. I like the action mapping and also templates, but I have difficulties using them together. E.g. I have a central page, say Main.jsp that has a template which contains constant header and footer and a variable content part. This content part (a jsp) must be determined at the run-time. Because of the template I have to always send back to the user the Main.jsp. How to use action mapping then? One possible solution would be the following. The action handler stores the variable content part as a session attribute and always returns the global mapping main (which is mapped to the Main.jsp). The Main.jsp retrieves the central variable part from the session and pass it to the template. This works, but I have a feeling that I am not correctly using the Struts. Any input from experts would be highly appreciated. Best Regards, Oleg Bondarenko -- Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
onclick event on html:button and html:image
I am relatively new to struts, so please do forgive me if this is a silly question. Here is my problem. Doesn't work: html:image srcKey=image.orders.buttonCancel altKey=altText.orders.buttonCancel onclick=history.back();/ But this works: html:button property=cancel onclick=history.back(); bean:message key=button.cancel/ /html:button the onclick on html:button works fine, but the onclick on html:image doesn't Any ideas? Thanks Aparna
Re: String as Index
Rey Francois [EMAIL PROTECTED] wrote: You can use the PropertyUtils that I have created (reusing the Struts one) within the Mapper framework (http://www.husted.com/about/struts/resources.htm#extensions). It supports string keyed properties, using the notation 'simple.nested.indexed[1].stringKeyed(key)'. See this posting about this topic. http://www.mail-archive.com/struts-user@jakarta.apache.org/msg10858.html Fr. Sorry to bother you again, before I have to read the whole documentation to the Mapper, could you please write, what do I have to do, to be able to use this notation in struts? Thanks in advance -- gR
Re: Templates: a design question
The approach I use (and I believe it is a common approach) is to have two jsp pages for each page on my site that is going to use templates. For example, if I have an ecommerce site it is likely I will have a shopping cart page, a search page and a search results pages... For this example, the set of jsp pages would be as follows: MainLayout.jsp - the main template layout page. ShopCart_content.jsp - the actual content of the shopping card page. ShopCart.jsp - the shopping cart page that references MainLayout.jsp and tells it to use ShopCart_content.jsp... Search_content.jsp - the actual content of the search page. Search.jsp - the search page that references MainLayout.jsp and tells it to use Search_content.jsp... SearchResults_content.jsp - the actual content of the search results page. SearchResults.jsp - the search results page that references MainLayout.jsp and tells it to use SearchResults_content.jsp... This way your action mappings reference ShopCart.jsp, Search.jsp, and SearchResults.jsp... Hope this helps, Troy - Original Message - From: Oleg Bondarenko [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 10:57 AM Subject: Templates: a design question Hello all, I am very new to Struts and I find it interesting. I like the action mapping and also templates, but I have difficulties using them together. E.g. I have a central page, say Main.jsp that has a template which contains constant header and footer and a variable content part. This content part (a jsp) must be determined at the run-time. Because of the template I have to always send back to the user the Main.jsp. How to use action mapping then? One possible solution would be the following. The action handler stores the variable content part as a session attribute and always returns the global mapping main (which is mapped to the Main.jsp). The Main.jsp retrieves the central variable part from the session and pass it to the template. This works, but I have a feeling that I am not correctly using the Struts. Any input from experts would be highly appreciated. Best Regards, Oleg Bondarenko -- Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
RE: Templates: a design question
The approach I use (and I believe it is a common approach) is to have two jsp pages for each page on my site that is going to use templates. MainLayout.jsp - the main template layout page. ShopCart_content.jsp - the actual content of the shopping card page. ShopCart.jsp - the shopping cart page that references MainLayout.jsp and +1 Heh heh - we even use the same naming convention pagename.jsp + pagename_content.jsp. One little issue we've run across is when the Designer wants to display something dynamically in the MainLayout.jsp based on conditions/stuff happening in the content.jsp. Cheers, Tim
Custom tags hiding JSP error messages
Title: Custom tags hiding JSP error messages Hi, I was curious whether other people encountered this problem. I've used tag libraries before, and am currently using struts' template tag library. I have found that runtime JSP errors, such as null pointer exceptions, are hard to debug because the custom tags hide the error message. The only message that usually comes up is a JSPException, which isn't really too helpful. Without custom tags, you get exact line numbers with exact errors (NullPointerException). Perhaps I'm doing something wrong. Can anybody give an opinion ? Thanks, Jamie
Re: jsp pages got memory limits?
There's a description of the problem, and some approaches you can take, here: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg04902.html -- Martin Cooper - Original Message - From: Raffaele Sgherri [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 5:39 AM Subject: jsp pages got memory limits? Hi all. I'm getting this Exception: === java.lang.VerifyError: (class: jsp/_0002fjsp_0002f_00031_00035_0005f_00035_0005fpilotTest_0005f_00030_0 0035_00036_00030_0002ejsp15_0005f5_0005fpilotTest_0005f0560_jsp_22, method: _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletR espo === when building a form with aprox 30 radio buttons. It seems that over a 92Kb. of .class generated from out jsp page the system crashes. If I remove some data from the form, this doesn't happens. Any idea about? There are memory limits with struts or even jsp specification? --- Raffaele Sgherri ? Sapient | Via Crocefisso, 19 - 20122 Milano (Italia).
Taglibs decrease the separation between designer and developer?
Your post brings up a good point concerning what I think is a false assumption concerning the separation between designer and developer. Despite the potential good uses that taglibs can be put to, HTML pages with JSP scriptlets are, I believe, easier to read by web designers than pages with Struts taglibs. (The one caveat being the one I mentioned before--that ONLY view logic--and not business logic--should reside in scriptlets.) My reasoning--and experience--is that when I simply used JSPs, I told our designer to completely ignore the stuff inside the % %s and code around them. Things were fine. Now that we're using Struts, I have to instruct our designer on the ins and outs of a completely new set of pseudo-HTML tags that he doesn't understand at all--and NOT to use the tags he's familiar with (form, head, etc.) It was much easier for both him and me before we made this switch. Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg]On Behalf Of Tim Colson Sent: Tuesday, July 31, 2001 7:57 AM To: [EMAIL PROTECTED] Subject: HTML in Taglibs (was: some comparision between JSP/struts velocity) Niall wrote: Sorry, I couldnt disagree with you more. Custom tags are exactly the place to put html - they are part of the view, Heh heh... I never said definitively that they weren't, just that in the particular situation we had - it seemed like a bad idea. The bits in question were definitively Designer territory. BTW - you are correct when saying this was/is part of the View. However, part of the separation I'm striving for is between Designer and Developer roles. And I hope you'll agree with me that a TagLib isn't something a Designer would likely build. grin if you look at struts html tags thats what they do. Yes. I understand. And honestly, it makes me a trifle uneasy. ;-) Real example - I had a Designer chap get stumped because the html:form attribute name didn't actually map directly to the name of the real html form. When he tried to connect a javascript function to an element in the form - he didn't know the name of the form. When he reasoned, oh, I'll just name my html:form 'bleckfoo', just like I would if it was standard HTML... html:form name=bleckfoo... He got a lovely error similar to the following: Error Location: Edit.jsp Internal Servlet Error: javax.servlet.ServletException: Must specify type attribute if name is specified at org.apache.jasper.runtime.PageContextImpl.handlePageException (PageContextImpl.java:459) at jsp._0002fjsp_0002fEdit_0002ejspEdit_jsp_2._jspService (_0002fjsp_0002fEdit_0002ejspEdit_jsp_2.java:344) (That was a fun one to explain - lemme tell ya. grin ;-) My point - hiding complexity won't always make things simpler. To my Designer colleague, the fact that the html:form automagically associates a Form bean with the form elements, as well as doing other nifty things for him/her behind the scenes didn't matter. What mattered was that they knew how to do HTML, and they were stumped about how to make this Struts thingy work. To which I have to reassure him that Struts is a good thing - it's the darn JSP's that are a bit cumbersome. ;-) Cheers, Tim
Re: problem with FormFile
To use file upload, you need to specify the method and encoding for the form, like this: html:form action=/upload method=post enctype=multipart/form-data ... /html:form -- Martin Cooper - Original Message - From: Bar³omiej Paw³owski [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 7:24 AM Subject: problem with FormFile Hi, I have created file upload.jsp: %@ page contentType=text/html; charset=ISO-8859-2 % %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-2 META NAME=Author CONTENT=Bartlomiej Pawlowski titleupload/title /head body html:form action=/upload File html:file property=file maxlength=30 styleClass=form2/ html:submitUpload/html:submit /html:form /body /html:html and ActionForm bean: public class UploadForm extends ActionForm { private FormFile file; public UploadForm() { } public void setFile(FormFile file) { this.file = file; } public FormFile getFile() { return file; } } when I submit this form I receive following exception: Internal Servlet Error: javax.servlet.ServletException: BeanUtils.populate at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:486) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19 10) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) Root cause: java.lang.IllegalArgumentException: argument type mismatch at java.lang.reflect.Method.invoke(Native Method) at org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:82 5) at org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:75 6) at org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:782) What is wrong? Who can help me?
Re: Custom tags hiding JSP error messages
i've had this problem also...what i've found, though, is that the root error will get logged into the tomcat/logs/servlet.log file...it won't display in the jboss log, that's the jsp exception...check your tomcat log to see if it logged it there (my action classes always log a NPE to the tomcat log)... Jon Brisbin - Original Message - From: Jamie Tsao [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 11:44 AM Subject: Custom tags hiding JSP error messages Custom tags hiding JSP error messages Hi, I was curious whether other people encountered this problem. I've used tag libraries before, and am currently using struts' template tag library. I have found that runtime JSP errors, such as null pointer exceptions, are hard to debug because the custom tags hide the error message. The only message that usually comes up is a JSPException, which isn't really too helpful. Without custom tags, you get exact line numbers with exact errors (NullPointerException). Perhaps I'm doing something wrong. Can anybody give an opinion ? Thanks, Jamie
JBuilder w/Struts Support
Here is my recipe for JBuilder5 w/Struts Support. These steps are a culmination of a variety of posts found on a variety of groups. Thanks to all who contributed to this, for there are many. I hope these steps work for everyone. And I hope Borland eventually adds better support for JB5 w/Struts in the near future. The .TLD is the biggest problem, and it's not even a Struts specific requirement. Ingredients: o Borland JBuilder5 Enterprise (not tested on other versions) o Struts Support Addin Nostruts.zip webinfextension.zip http://codecentral.borland.com/ goto JB5 x OpenTools o Struts Blank .war file struts-blank.war http://jakarta.apache.org/struts goto downloads Steps: 1. Download/Install the above: o Extract the Struts Support Addin files to the open tools directory. Usually it's c:/jbuilder5/lib/ext on Windows. o Extract the Struts Blank file to your webapps directory. This allows it to run outside JB5 For example, the path would likely be C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank on Windows. You can call it whatever you want, but JB5 doesn't like dashes in the project .jpx, so I took it out. 2. Move: o strutsblank\WEB-INFclasses to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src o You'll see... 3. In JB5, set up Struts Support Addin o Tools | Configure Libraries... o New... o Name: Struts Support Addin o Location: User Home (default) o Add... c:/jbuilder5/lib/ext/Nostruts.zip o Add... c:/jbuilder5/lib/ext/webinfextension.zip o Click OK 4. Set Up Struts (still in Configure Libraries) o New... o Name: Struts v1.0 Release (or whatever version you have) o Location: User Home (default) o Add... path.to.struts.jar o Click OK o Click Required Libraries Tab o Add... Struts Support Addin o Click OK 5. Start a new project in JB5. o File | New | Project o Project name: strutsblank o Root path: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps o Project directory name: strutsblank (default) o Source directory name: src (default) o Backup directory name: bak (default) o Documentation directory name: src (default) o Output directory name: classes (default) o Next o Add... Struts v1.0 Release (or whatever version you have) o Next o [Finish] 6. Start a new Web Application. o File | New | Web | Web Application o Name: strutsblank o Directory: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank (default) o Check off Generate WAR 7. Correct .tld file locations: o Open web.xml o Select Tab Libraries o Change all TabLib locations so that they point to the classes directory. o Example: /WEB-INF/classes/struts-bean.tld 8. Open Properties for 'strutsblank' o Right-Click on Web App strutsblank (icon of a hand with a globe) o Go to Classes Tab o Add Files... all files in strutsblank/src (ApplicationResources.properties and *.tld) o Go to Dependencies Tab o Change Exclude All to Include All for both o Click OK 9. Get correct classpath: o Right-Click on index.jsp o Web Run o Don't worry about Error 500 o Copy classpath at the very top of the output (right after C:\jbuilder5\jdk1.3\bin\javaw) o Copy classpath just above the stack trace (right after Classpath according to Servlet Engine is:) 10. Open Project Properties o Project | Project Properties... o Go to Run Tab o Go to JSP/Servlet Tab o VM parameters: -classpath [Copy of classpath taken from Web Run] 11. Try it for real: o Stop last Web Run o Right-Click on index.jsp o Web Run Step seven is one way to correct the missing .TLD files. I was told that the open tools (webinfextension.zip) file did this, but it seems that it just makes sure it's part of the file system, not the .WAR. Adding the .TLD files to the src directory makes sure they are included in the build. Adjusting the web.xml file makes sure they are being addressed correctly. It's a kludge, but it makes the .WAR files deployable without having to add the .TLD files later. The last three steps could be a mystery to some. The goal here is to get the correct classpath and add it to the VM parameters. Remember that the first part of the classpath is in quotes and you don't want anything after the closing quote. Also remember to add a semicolon just before adding the second part of the classpath. Sorry if this is not clear. Just remember that your classpath must be 100% complete. If a resource is mentioned below the -classpath line, add it to the -classpath line. Anthony We all know Linux is great... it does infinite loops in 5 seconds. - Linus
logic:iterate tag and classes exending Vector
Does logic:iterate tag accept as parameter name class that extends Vector? I have a javax.servlet.ServletException: No collection found Thank you
Proper use of HTTP parameters in Struts
I'm new to Struts, so if possible, I'd like someone to help clarify the proper way to deal with HTTP request parameters. It seems as if there are multiple mechanisms for adding parameters to requests. The first is to specify a parameter name as an attribute of an action in the struts-config.xml file. This single parameter can then easily be added via the html:link tag by adding the appropriate parameter identifiers, etc. This approach works pretty well, but it seems to only allow you to pass one parameter through, which is a significant limitation. If you want to use multiple request parameters, another approach is to put the multiple parameters into a Map using RequestUtils.computeParameters(), then pass the resulting Map into RequestUtils.computeURL(), then pass that through html:link as a link attribute. I have a feeling that I'm not getting how this is supposed to work, because the idea of having two architectures--one that supports one parameter, an entirely different one that supports multiple parameters--doesn't make sense. Could someone let me know the standard Struts technique for handling these parameters? Thanks! Greg == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. ==
Re: AW: AW: action-mapping: why must the action-Attribute pathbe equivalent to the name of the jsp?
This mechanism is already available in Struts. Take a look at the DispatchAction class: http://jakarta.apache.org/struts/api/org/apache/struts/actions/DispatchActio n.html -- Martin Cooper - Original Message - From: John Yu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 1:48 AM Subject: Re: AW: AW: action-mapping: why must the action-Attribute path be equivalent to the name of the jsp? I share a similar concern. I'm wondering if it makes sense to extend Struts' mapping architecture so that it will also look into a 'magic' url parameter and dispatch accordingly. For example, if the URL is MyAction.do?subAction=Create the ActionServlet will dispatch the request to the MyActionCreate class given the following (enhanced) action mapping. action path=MyAction subAction=Create type=MyActionCreate .../ This will make it easily to have forms with multiple buttons which require different actions. -- John At 10:18 AM 8/1/2001 +0200, you wrote: Isn't it against the mvc philosophy to put navigation code (e.g. control) into a tag (e.g. view) ? -Ursprungliche Nachricht- Von: Ted Husted [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Gesendet: Dienstag, 31. Juli 2001 18:42 An: [EMAIL PROTECTED] Betreff: Re: AW: action-mapping: why must the action-Attribute path be equivalent to the name of the jsp? The usual solution would be to design your forms to contain hidden fields that tell the Action which operation to perform with the next request. So typically, there would be one button with a hidden field that conveyed whether this was the FirstAction or the SecondAction. These would all go back to a single Action that either performed all the operations, or forwarded onto another Action. If you will be using this button that much, you might also consider writing your own custom tag so the button could program itself from the request. In general, the request is meant to convey information to the presentation layer about how it is suppose to write itself. In my own projects, I am experimenting with ways to make the current ActionMappings available to the JSP, as they are to perform() and validate(), which starts to open several doors. [EMAIL PROTECTED] wrote: Thanks, at least it's a working work-around. But the ugly thing is, that in both cases the same action is called and I am forced to call the real action from the first action depending on the pushed button. + Action inserts fire bean into rquest context + Forward to JSP + JSP checks to see if fire==first. If so, write TheFirstAction button + JSP checks to see if fire==second. If so, write TheSecondActon button + submit fires action + action does nothing and forwards to the real action depending on the button. In my real world the page will be reused at least 5 or six times. So rather than putting the Control part of MVC in the struts-config.xml I start piggypacking info in the request and analysing this in the dummy action. However again thanks. Peter -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com / http://www.scioworks.com http://www.scioworks.com / m: +(65) 9782 9610
save dynamic jsp content
Hi, I am new to struts. In my action class (perform) I want to run a jsp page in background and save its content in an html file. How Can i do that in perfom method ?. After that i know how i will send this html file by e-mail (usinj java smtp) and forward the user to an adequate location (success). Thanks in adavance. Mustapha Essalihe
RE: Taglibs decrease the separation between designer and developer?
That's a good point, but what about when your scriptlets are controlling the presentation? Ie. you've got dynamic row changes, or entirely different tables of output being displayed depending on a flag on the request (assuming you can't generecize the output) - and the designer needs to change the HTML output by those scriptlets? Frankly, I don't mean to diminish the role of the designer (someone I find to be incredibly important) but I generally would not let them edit JSP's at all taglibs or not, unless they had experience with JSP or ASP. While it may not be ideal or efficient to do so, I find that it is much better for the designers to provide me with a mockup and I'll deal with the HTML. It gives developers much more control and flexibility - and then all these issues are moot. Plus, it gives you the added bonus of avoiding the demons that are WYSIWYG web development tools (hehe, I'm known lovingly as the HTML snob by one of my uncles who happens to be a designer). Unfortunately, not every developer knows HTML well so it involves more responsibility for the developer then may actually be good, possible or practical, but for me personally, I wouldn't have it any other way. :) -Chris -Original Message- From: Greg Maletic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:15 PM To: [EMAIL PROTECTED] Subject: Taglibs decrease the separation between designer and developer? Your post brings up a good point concerning what I think is a false assumption concerning the separation between designer and developer. Despite the potential good uses that taglibs can be put to, HTML pages with JSP scriptlets are, I believe, easier to read by web designers than pages with Struts taglibs. (The one caveat being the one I mentioned before--that ONLY view logic--and not business logic--should reside in scriptlets.) My reasoning--and experience--is that when I simply used JSPs, I told our designer to completely ignore the stuff inside the % %s and code around them. Things were fine. Now that we're using Struts, I have to instruct our designer on the ins and outs of a completely new set of pseudo-HTML tags that he doesn't understand at all--and NOT to use the tags he's familiar with (form, head, etc.) It was much easier for both him and me before we made this switch. Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg]On Behalf Of Tim Colson Sent: Tuesday, July 31, 2001 7:57 AM To: [EMAIL PROTECTED] Subject: HTML in Taglibs (was: some comparision between JSP/struts velocity) Niall wrote: Sorry, I couldnt disagree with you more. Custom tags are exactly the place to put html - they are part of the view, Heh heh... I never said definitively that they weren't, just that in the particular situation we had - it seemed like a bad idea. The bits in question were definitively Designer territory. BTW - you are correct when saying this was/is part of the View. However, part of the separation I'm striving for is between Designer and Developer roles. And I hope you'll agree with me that a TagLib isn't something a Designer would likely build. grin if you look at struts html tags thats what they do. Yes. I understand. And honestly, it makes me a trifle uneasy. ;-) Real example - I had a Designer chap get stumped because the html:form attribute name didn't actually map directly to the name of the real html form. When he tried to connect a javascript function to an element in the form - he didn't know the name of the form. When he reasoned, oh, I'll just name my html:form 'bleckfoo', just like I would if it was standard HTML... html:form name=bleckfoo... He got a lovely error similar to the following: Error Location: Edit.jsp Internal Servlet Error: javax.servlet.ServletException: Must specify type attribute if name is specified at org.apache.jasper.runtime.PageContextImpl.handlePageException (PageContextImpl.java:459) at jsp._0002fjsp_0002fEdit_0002ejspEdit_jsp_2._jspService (_0002fjsp_0002fEdit_0002ejspEdit_jsp_2.java:344) (That was a fun one to explain - lemme tell ya. grin ;-) My point - hiding complexity won't always make things simpler. To my Designer colleague, the fact that the html:form automagically associates a Form bean with the form elements, as well as doing other nifty things for him/her behind the scenes didn't matter. What mattered was that they knew how to do HTML, and they were stumped about how to make this Struts thingy work. To
Re: Custom tags hiding JSP error messages
Usually when struts taglib captures an error, it is stored as a request attribute under the key Action.EXCEPTION_KEY. What I ended up doing is write a custom error JSP and set that as my default error page in web.xml. I'm not sure if the template taglibs are storing their exception there however. Calvin On 01 Aug 2001 09:44:29 -0700, Jamie Tsao wrote: Hi, I was curious whether other people encountered this problem. I've used tag libraries before, and am currently using struts' template tag library. I have found that runtime JSP errors, such as null pointer exceptions, are hard to debug because the custom tags hide the error message. The only message that usually comes up is a JSPException, which isn't really too helpful. Without custom tags, you get exact line numbers with exact errors (NullPointerException). Perhaps I'm doing something wrong. Can anybody give an opinion ? Thanks, Jamie
Re: save dynamic jsp content
The easiest way would be to write a client that makes a HTTP request to the server and captures the HTML output that way. Calvin On 01 Aug 2001 13:40:58 -0400, Mustapha Essalihe wrote: Hi, I am new to struts. In my action class (perform) I want to run a jsp page in background and save its content in an html file. How Can i do that in perfom method ?. After that i know how i will send this html file by e-mail (usinj java smtp) and forward the user to an adequate location (success). Thanks in adavance. Mustapha Essalihe
RE: save dynamic jsp content
This will get you an input stream containing the content for the resource. try { Url url = new Url(PATH_TO_RESOURCE_HERE); InputStream is = url.openStream(); // use input stream to get content to pass through SMTP session } catch (MalformedURLException ignored) { } catch (IOException ignored) { } finally { try { is.close(); } catch (IOException ignored) { } } -Original Message- From: Calvin Yu [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 11:07 AM To: [EMAIL PROTECTED] Subject: Re: save dynamic jsp content The easiest way would be to write a client that makes a HTTP request to the server and captures the HTML output that way. Calvin On 01 Aug 2001 13:40:58 -0400, Mustapha Essalihe wrote: Hi, I am new to struts. In my action class (perform) I want to run a jsp page in background and save its content in an html file. How Can i do that in perfom method ?. After that i know how i will send this html file by e-mail (usinj java smtp) and forward the user to an adequate location (success). Thanks in adavance. Mustapha Essalihe
RE: Taglibs decrease the separation between designer and developer?
Chris - Assenza, Chris wrote : I generally would not let [Designers] edit JSP's at all taglibs or not, unless they had experience with JSP or ASP. Yikes. ;-) I agree partially - I too have a dim view that Designers can effectively modify JSP files w/ or w/o taglibs. But I think that in an ideal world the Designer _should_ be able to update the View directly without a developer intermediary as suggested. While it may not be ideal or efficient to do so, I find that it is much better for the designers to provide me with a mockup and I'll deal with the HTML. When the mockup changes by a word or two - the Developer can easily make the update. However - when the changes are dramatic - the Developer must do a massive manual-eyeball diff between the new mockup and the JSP. Efficiency is not the term that usually pops in my head at that point. grin Maybe I'm the minority - but my ideal world is where the View can be built 100% by a Designer. (BTW - if your definition of Designer is someone who does mockups in PhotoShop and can't learn or use simple looping/logic concepts, then ammend the role to Smart Designer or Junior Developer. ;-) The Answer: JSP / JSP StrutsTaglibs / Templates (Velocity, WebMacro, Disney's Tea, etc.) / Alien Technology / 42??? I doubt JSP will be the answer. JSP Struts or standard Taglibs might work - I'm curious to see the how the JSR-052 and Struts tags evolve, especially to handle non-HTML output (WML anyone?) From what's available now - I'd put my money on a simple to use template system like Velocity to do the trick. Cheers, Timothy
Re: Taglibs decrease the separation between designer and developer?
Greg, I think you are exagerating a bit when you say that Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. Comparing a handful of scripting tags that, for the most part, correspond directly to existing html tags to the learning of a language is a bit much. That said, if your designer is unable to understand struts tags, I would recommend that you ask him not to touch them. I don't understand why you would feel the need to teach a designer the ins and outs of Struts tags. Maybe you could try something like this: design the app, using completely stripped jsp pages. Ask your designer to do the interface, then put the tags in his interface. If the designer needs control of the presentation of html contained within custom tags, use style sheets. Also, if you honestly do feel that things were easier without struts, don't use it. It is not a part of the servlet/jsp spec or anything, and its use is completely optional. But I would urge you to stick with it a little more. I think its many advantages far outweigh the small learning curve. One more thing, since you have experience with servlets/jsp, you must admit that code for a select box that looks like this is a thing of beauty::) html:select property=prizeTypeId html:options collection=prizeType property=value labelProperty=label/ /html:select/td Bill Greg Maletic wrote: Your post brings up a good point concerning what I think is a false assumption concerning the separation between designer and developer. Despite the potential good uses that taglibs can be put to, HTML pages with JSP scriptlets are, I believe, easier to read by web designers than pages with Struts taglibs. (The one caveat being the one I mentioned before--that ONLY view logic--and not business logic--should reside in scriptlets.) My reasoning--and experience--is that when I simply used JSPs, I told our designer to completely ignore the stuff inside the % %s and code around them. Things were fine. Now that we're using Struts, I have to instruct our designer on the ins and outs of a completely new set of pseudo-HTML tags that he doesn't understand at all--and NOT to use the tags he's familiar with (form, head, etc.) It was much easier for both him and me before we made this switch. Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg]On Behalf Of Tim Colson Sent: Tuesday, July 31, 2001 7:57 AM To: [EMAIL PROTECTED] Subject: HTML in Taglibs (was: some comparision between JSP/struts velocity) Niall wrote: Sorry, I couldnt disagree with you more. Custom tags are exactly the place to put html - they are part of the view, Heh heh... I never said definitively that they weren't, just that in the particular situation we had - it seemed like a bad idea. The bits in question were definitively Designer territory. BTW - you are correct when saying this was/is part of the View. However, part of the separation I'm striving for is between Designer and Developer roles. And I hope you'll agree with me that a TagLib isn't something a Designer would likely build. grin if you look at struts html tags thats what they do. Yes. I understand. And honestly, it makes me a trifle uneasy. ;-) Real example - I had a Designer chap get stumped because the html:form attribute name didn't actually map directly to the name of the real html form. When he tried to connect a javascript function to an element in the form - he didn't know the name of the form. When he reasoned, oh, I'll just name my html:form 'bleckfoo', just like I would if it was standard HTML... html:form name=bleckfoo... He got a lovely error similar to the following: Error Location: Edit.jsp Internal Servlet Error: javax.servlet.ServletException: Must specify type attribute if name is specified at org.apache.jasper.runtime.PageContextImpl.handlePageException (PageContextImpl.java:459) at jsp._0002fjsp_0002fEdit_0002ejspEdit_jsp_2._jspService (_0002fjsp_0002fEdit_0002ejspEdit_jsp_2.java:344) (That was a fun one to explain - lemme tell ya. grin ;-) My point - hiding complexity won't always make things simpler. To my Designer colleague, the fact that the html:form automagically associates a Form bean with the form elements, as well as doing other nifty things for him/her behind the scenes didn't matter.
Re: save dynamic jsp content
An eaiser way may be to create a BodyTagSupport to capture the output in the doAfterBody method and send it to the mail input stream or write to the file system first if desired. This doesn't require an extra network call and thread. Chris - Original Message - From: Calvin Yu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 1:06 PM Subject: Re: save dynamic jsp content The easiest way would be to write a client that makes a HTTP request to the server and captures the HTML output that way. Calvin On 01 Aug 2001 13:40:58 -0400, Mustapha Essalihe wrote: Hi, I am new to struts. In my action class (perform) I want to run a jsp page in background and save its content in an html file. How Can i do that in perfom method ?. After that i know how i will send this html file by e-mail (usinj java smtp) and forward the user to an adequate location (success). Thanks in adavance. Mustapha Essalihe
processPopulate() call configurable?
Hi, In the ActionServlet.process() method, the processPopulate() method is always called. Is there any way to set some request attribute etc so that the processPopulate call is configurable. The underlying problem is that if I prefill my form, all the values are overwritten by the Request objects current parameter values. I this something that other people have run into? Any work around? Thanks, Ranjit
RE: Taglibs decrease the separation between designer and developer?
I'm sure that this e-mail group is heavier on the Java/JSP developers than it is on designers, so I'll throw out this question: isn't anything that creates visual presentation of information considered design? While Java (Servlets) and the Struts framework create information and functionality, it's HTML, scripting and taglibs that facilitate visual presentation. To me, that's a pretty clear separation between development and design. If you argue that it's a waste of time to teach a designer the Struts taglibs, I think it's fair to ask whether designers should even bother learning HMTL. Most designers involved with the web are perfectly capable of handling programming basics, from HTML to server-side scripting. I think it under-sells the abilities of most web designers to imply that Struts is too much for them. If it's difficult to explain Struts to a designer, the answer isn't relegating the designer to the role of a mockup artist --- it's training. I'd think that most developers have enough on their hands that they wouldn't mind relegating the JSP end of things to a competent and informed designer. The designer gets more freedom to control presentation, and the developer gets to focus on development. --John Kusch -Original Message- From: Bill Clinton [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: Re: Taglibs decrease the separation between designer and developer? Greg, I think you are exagerating a bit when you say that Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. Comparing a handful of scripting tags that, for the most part, correspond directly to existing html tags to the learning of a language is a bit much. That said, if your designer is unable to understand struts tags, I would recommend that you ask him not to touch them. I don't understand why you would feel the need to teach a designer the ins and outs of Struts tags. Maybe you could try something like this: design the app, using completely stripped jsp pages. Ask your designer to do the interface, then put the tags in his interface. If the designer needs control of the presentation of html contained within custom tags, use style sheets. Also, if you honestly do feel that things were easier without struts, don't use it. It is not a part of the servlet/jsp spec or anything, and its use is completely optional. But I would urge you to stick with it a little more. I think its many advantages far outweigh the small learning curve. Greg Maletic wrote: Now that we're using Struts, I have to instruct our designer on the ins and outs of a completely new set of pseudo-HTML tags that he doesn't understand at all--and NOT to use the tags he's familiar with (form, head, etc.) It was much easier for both him and me before we made this switch. Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn.
How to specify a URL in the path
Hi How do I specify a URL in the below forward name=sessionTimeOut path=/abc.jsp / Instead of /abc.jsp , I need it to go to say http://www.something.com Can this be done ? Thanks Vipin
Re: Taglibs decrease the separation between designer and developer?
I agree (even when I know I should leave the View to a Designer). I think any good Web Developer should know HTML (and some Javascript :)). Designers are important, but one must be able to be self-sufficient. Of course, that's my point of view . In Fact, thats why I like JSPs Technology; because you can also get involved in some 'design stuff' (plus, you don't need to compile on your own). That's my personal opinion and I know many people may not agree :). Regards. Luis Olivares. Infosphere S.A. de C.V. tel 8365-42-88 ext. 107. - Original Message - From: Assenza, Chris [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 12:43 PM Subject: RE: Taglibs decrease the separation between designer and developer? That's a good point, but what about when your scriptlets are controlling the presentation? Ie. you've got dynamic row changes, or entirely different tables of output being displayed depending on a flag on the request (assuming you can't generecize the output) - and the designer needs to change the HTML output by those scriptlets? Frankly, I don't mean to diminish the role of the designer (someone I find to be incredibly important) but I generally would not let them edit JSP's at all taglibs or not, unless they had experience with JSP or ASP. While it may not be ideal or efficient to do so, I find that it is much better for the designers to provide me with a mockup and I'll deal with the HTML. It gives developers much more control and flexibility - and then all these issues are moot. Plus, it gives you the added bonus of avoiding the demons that are WYSIWYG web development tools (hehe, I'm known lovingly as the HTML snob by one of my uncles who happens to be a designer). Unfortunately, not every developer knows HTML well so it involves more responsibility for the developer then may actually be good, possible or practical, but for me personally, I wouldn't have it any other way. :) -Chris -Original Message- From: Greg Maletic [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:15 PM To: [EMAIL PROTECTED] Subject: Taglibs decrease the separation between designer and developer? Your post brings up a good point concerning what I think is a false assumption concerning the separation between designer and developer. Despite the potential good uses that taglibs can be put to, HTML pages with JSP scriptlets are, I believe, easier to read by web designers than pages with Struts taglibs. (The one caveat being the one I mentioned before--that ONLY view logic--and not business logic--should reside in scriptlets.) My reasoning--and experience--is that when I simply used JSPs, I told our designer to completely ignore the stuff inside the % %s and code around them. Things were fine. Now that we're using Struts, I have to instruct our designer on the ins and outs of a completely new set of pseudo-HTML tags that he doesn't understand at all--and NOT to use the tags he's familiar with (form, head, etc.) It was much easier for both him and me before we made this switch. Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg]On Behalf Of Tim Colson Sent: Tuesday, July 31, 2001 7:57 AM To: [EMAIL PROTECTED] Subject: HTML in Taglibs (was: some comparision between JSP/struts velocity) Niall wrote: Sorry, I couldnt disagree with you more. Custom tags are exactly the place to put html - they are part of the view, Heh heh... I never said definitively that they weren't, just that in the particular situation we had - it seemed like a bad idea. The bits in question were definitively Designer territory. BTW - you are correct when saying this was/is part of the View. However, part of the separation I'm striving for is between Designer and Developer roles. And I hope you'll agree with me that a TagLib isn't something a Designer would likely build. grin if you look at struts html tags thats what they do. Yes. I understand. And honestly, it makes me a trifle uneasy. ;-) Real example - I had a Designer chap get stumped because the html:form attribute name didn't actually map directly to the name of the real html form. When he tried to connect a javascript function to an element in the form - he didn't know the name of the form. When he reasoned, oh, I'll just name my html:form 'bleckfoo', just like I would if it was standard HTML... html:form name=bleckfoo... He got a
Re: Taglibs decrease the separation between designer and develope r?
Kusch, John wrote: me, that's a pretty clear separation between development and design. If you argue that it's a waste of time to teach a designer the Struts taglibs, I think it's fair to ask whether designers should even bother learning HMTL. John, The line between designer and developer is a blurry one and differs in most organizations. But in my last few postions, my experience has been that HTML proficiency is no longer a given for web designers. Macromedia Dreamweaver seems to be the tool of choice for most designers these days, and HTML skills seems to take a back seat to skills in Photoshop, Flash, Dreamweaver, gif animation, etc. As someone who used notepad as my first HTML editor, this is not something that I am thrilled with, but it seems to be fairly common. Sure, its a pain in the ass to me, especially all that junk html that gets inserted by WYSIWYG editors, but I'd rather have a good artist with no scripting skills making great looking designs than a great html/javscript guy with mediocre artistic talent. So, I guess you are right: it is fair to argue whether designers should even bother learning html. Bill
RE: save dynamic jsp content
Does the bean:include tag solve your problem? Per the Struts documentation, it can capture the dynamic response and makes it available as a bean. See http://jakarta.apache.org/struts/struts-bean.html#include Hope that helps. Ranjit -Original Message- From: Calvin Yu [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 3:45 PM To: [EMAIL PROTECTED] Subject: Re: save dynamic jsp content Fantastic idea! This would be an easier way. Calvin On 01 Aug 2001 14:31:44 -0500, Chris Nokes wrote: An eaiser way may be to create a BodyTagSupport to capture the output in the doAfterBody method and send it to the mail input stream or write to the file system first if desired. This doesn't require an extra network call and thread. Chris - Original Message - From: Calvin Yu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 1:06 PM Subject: Re: save dynamic jsp content The easiest way would be to write a client that makes a HTTP request to the server and captures the HTML output that way. Calvin On 01 Aug 2001 13:40:58 -0400, Mustapha Essalihe wrote: Hi, I am new to struts. In my action class (perform) I want to run a jsp page in background and save its content in an html file. How Can i do that in perfom method ?. After that i know how i will send this html file by e-mail (usinj java smtp) and forward the user to an adequate location (success). Thanks in adavance. Mustapha Essalihe
RE: Taglibs decrease the separation between designer and developer?
Hi, Bill-- I completely agree that Struts Taglibs are much cleaner than the pure HTML alternative, so I concur that your select box example is very simple and nice. I love all of the Struts form input tags, all of which are a real pain to implement with pure HTML and JSP. But I don't think I'm exaggerating very much when I say that the Struts taglibs are a new language: they include tags to define variables, looping constructs, and if-then-else constructs, none of which correspond to actual HTML tags, and all of which I'll need to employ if I'm to completely rid my JSPs of scriptlets. I view that as pretty much a complete language. So my novice reaction to the Struts taglibs is that I've swapped a language that I know (Java) for a language that I don't know (Struts taglibs), and my designer has swapped a language that he knows (pure HTML) for a language he doesn't know (Struts taglibs), at the benefit of giving the designer the potential to write virtual code when I know that he--and at least 95% of the designers I've worked with--won't write view code that I would trust no matter what the language is. (I'm not claiming they're stupid. My experience has been similar to Chris's earlier post, where I let them control the look and feel and I write the view code.) I'm not saying that the Struts taglibs are useless by any stretch of the imagination. But the real benefit I see with taglibs is to clean up the JSPs, not usher in a new age of empowered designers capable of building views with no developer assistance. I should have prefaced my comments by saying that I'm quite new to Struts, am not an expert, so my comments should be taken in that light. I am impressed with Struts and am absolutely not giving up on it. My beef isn't so much with Struts as it is with the whole concept of taglibs being the solution to the MVC separation problem. The only solution to this problem is to keep business logic out of the view, period. Scriptlets don't solve the problem, but I don't think taglibs do either. The only real solution I see is developer restraint. --Greg == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg]On Behalf Of Bill Clinton Sent: Wednesday, August 01, 2001 12:10 PM To: [EMAIL PROTECTED] Subject: Re: Taglibs decrease the separation between designer and developer? Greg, I think you are exagerating a bit when you say that Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. Comparing a handful of scripting tags that, for the most part, correspond directly to existing html tags to the learning of a language is a bit much. That said, if your designer is unable to understand struts tags, I would recommend that you ask him not to touch them. I don't understand why you would feel the need to teach a designer the ins and outs of Struts tags. Maybe you could try something like this: design the app, using completely stripped jsp pages. Ask your designer to do the interface, then put the tags in his interface. If the designer needs control of the presentation of html contained within custom tags, use style sheets. Also, if you honestly do feel that things were easier without struts, don't use it. It is not a part of the servlet/jsp spec or anything, and its use is completely optional. But I would urge you to stick with it a little more. I think its many advantages far outweigh the small learning curve. One more thing, since you have experience with servlets/jsp, you must admit that code for a select box that looks like this is a thing of beauty::) html:select property=prizeTypeId html:options collection=prizeType property=value labelProperty=label/ /html:select/td Bill Greg Maletic wrote: Your post brings up a good point concerning what I think is a false assumption concerning the separation between designer and developer. Despite the potential good uses that taglibs can be put to, HTML pages with JSP scriptlets are, I believe, easier to read by web designers than pages with Struts taglibs. (The one caveat being the one I mentioned before--that ONLY view logic--and not business logic--should reside in scriptlets.) My reasoning--and experience--is that when I simply used JSPs, I told our designer to completely ignore the stuff inside the % %s and code around them. Things were fine. Now that we're using Struts, I have to instruct our designer on the ins and outs of a completely new set of pseudo-HTML tags that he doesn't understand at all--and NOT to use the tags he's familiar with
RE: JBuilder w/Struts Support
Anthony, I am trying to implement your solution and need some clarification on steps 1 and 2. Step 1 question - The instruction that come with the downloaded files from Borland (Nostruts.zip webinfextension.zip) indicate that the JAR files need to be placed into c:/jbuilder5/lib/ext which is different from your instructions which say to place the ZIP files in the directory. I have the ZIP files in the directory but I am wondering if I missed something here? Step 2 question - The instruction Move: strutsblank\WEB-INFclasses to strutsblank\src. So I created strutsblank\ and strutsblank\src directories under C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/, then extracted (unzipped) the struts-blank.war to the strutsblank\ directory. Next, I moved \strutsblank\WEB-INF\classes to \strutsblank\src\classes, is this correct? Thanks, BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:15 AM To: [EMAIL PROTECTED] Subject: JBuilder w/Struts Support Here is my recipe for JBuilder5 w/Struts Support. These steps are a culmination of a variety of posts found on a variety of groups. Thanks to all who contributed to this, for there are many. I hope these steps work for everyone. And I hope Borland eventually adds better support for JB5 w/Struts in the near future. The .TLD is the biggest problem, and it's not even a Struts specific requirement. Ingredients: o Borland JBuilder5 Enterprise (not tested on other versions) o Struts Support Addin Nostruts.zip webinfextension.zip http://codecentral.borland.com/ goto JB5 x OpenTools o Struts Blank .war file struts-blank.war http://jakarta.apache.org/struts goto downloads Steps: 1. Download/Install the above: o Extract the Struts Support Addin files to the open tools directory. Usually it's c:/jbuilder5/lib/ext on Windows. o Extract the Struts Blank file to your webapps directory. This allows it to run outside JB5 For example, the path would likely be C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank on Windows. You can call it whatever you want, but JB5 doesn't like dashes in the project .jpx, so I took it out. 2. Move: o strutsblank\WEB-INFclasses to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src o You'll see... 3. In JB5, set up Struts Support Addin o Tools | Configure Libraries... o New... o Name: Struts Support Addin o Location: User Home (default) o Add... c:/jbuilder5/lib/ext/Nostruts.zip o Add... c:/jbuilder5/lib/ext/webinfextension.zip o Click OK 4. Set Up Struts (still in Configure Libraries) o New... o Name: Struts v1.0 Release (or whatever version you have) o Location: User Home (default) o Add... path.to.struts.jar o Click OK o Click Required Libraries Tab o Add... Struts Support Addin o Click OK 5. Start a new project in JB5. o File | New | Project o Project name: strutsblank o Root path: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps o Project directory name: strutsblank (default) o Source directory name: src (default) o Backup directory name: bak (default) o Documentation directory name: src (default) o Output directory name: classes (default) o Next o Add... Struts v1.0 Release (or whatever version you have) o Next o [Finish] 6. Start a new Web Application. o File | New | Web | Web Application o Name: strutsblank o Directory: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank (default) o Check off Generate WAR 7. Correct .tld file locations: o Open web.xml o Select Tab Libraries o Change all TabLib locations so that they point to the classes directory. o Example: /WEB-INF/classes/struts-bean.tld 8. Open Properties for 'strutsblank' o Right-Click on Web App strutsblank (icon of a hand with a globe) o Go to Classes Tab o Add Files... all files in strutsblank/src (ApplicationResources.properties and *.tld) o Go to Dependencies Tab o Change Exclude All to Include All for both o Click OK 9. Get correct classpath: o Right-Click on index.jsp o Web Run o Don't worry about Error 500 o Copy classpath at the very top of the output (right after C:\jbuilder5\jdk1.3\bin\javaw) o Copy classpath just above the stack trace (right after Classpath according to Servlet Engine is:) 10. Open Project Properties o Project | Project Properties... o Go to Run Tab o Go to JSP/Servlet Tab o VM parameters: -classpath [Copy of classpath taken from Web Run] 11. Try it for real: o Stop last Web Run o Right-Click on index.jsp o Web Run Step seven is one way to correct
RE: JBuilder w/Struts Support
Regarding step 1, you are correct. I had it wrong. The jar files must be used. This might explain why the .TLD files weren't moving over. If this is correct, step 2 may not be necessary. But to clarify, Step 2 had a typo, and wasn't clear to begin with. Sorry about that. It should read: 2. Move: o strutsblank\WEB-INF\classes\*.* to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src Again, the purpose of moving the .tld into src was to make sure they got included in the .war. If I had the open tools wrong, this would explain it. Anthony -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:06 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Anthony, I am trying to implement your solution and need some clarification on steps 1 and 2. Step 1 question - The instruction that come with the downloaded files from Borland (Nostruts.zip webinfextension.zip) indicate that the JAR files need to be placed into c:/jbuilder5/lib/ext which is different from your instructions which say to place the ZIP files in the directory. I have the ZIP files in the directory but I am wondering if I missed something here? Step 2 question - The instruction Move: strutsblank\WEB-INFclasses to strutsblank\src. So I created strutsblank\ and strutsblank\src directories under C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/, then extracted (unzipped) the struts-blank.war to the strutsblank\ directory. Next, I moved \strutsblank\WEB-INF\classes to \strutsblank\src\classes, is this correct? Thanks, BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:15 AM To: [EMAIL PROTECTED] Subject: JBuilder w/Struts Support Here is my recipe for JBuilder5 w/Struts Support. These steps are a culmination of a variety of posts found on a variety of groups. Thanks to all who contributed to this, for there are many. I hope these steps work for everyone. And I hope Borland eventually adds better support for JB5 w/Struts in the near future. The .TLD is the biggest problem, and it's not even a Struts specific requirement. Ingredients: o Borland JBuilder5 Enterprise (not tested on other versions) o Struts Support Addin Nostruts.zip webinfextension.zip http://codecentral.borland.com/ goto JB5 x OpenTools o Struts Blank .war file struts-blank.war http://jakarta.apache.org/struts goto downloads Steps: 1. Download/Install the above: o Extract the Struts Support Addin files to the open tools directory. Usually it's c:/jbuilder5/lib/ext on Windows. o Extract the Struts Blank file to your webapps directory. This allows it to run outside JB5 For example, the path would likely be C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank on Windows. You can call it whatever you want, but JB5 doesn't like dashes in the project .jpx, so I took it out. 2. Move: o strutsblank\WEB-INFclasses to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src o You'll see... 3. In JB5, set up Struts Support Addin o Tools | Configure Libraries... o New... o Name: Struts Support Addin o Location: User Home (default) o Add... c:/jbuilder5/lib/ext/Nostruts.zip o Add... c:/jbuilder5/lib/ext/webinfextension.zip o Click OK 4. Set Up Struts (still in Configure Libraries) o New... o Name: Struts v1.0 Release (or whatever version you have) o Location: User Home (default) o Add... path.to.struts.jar o Click OK o Click Required Libraries Tab o Add... Struts Support Addin o Click OK 5. Start a new project in JB5. o File | New | Project o Project name: strutsblank o Root path: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps o Project directory name: strutsblank (default) o Source directory name: src (default) o Backup directory name: bak (default) o Documentation directory name: src (default) o Output directory name: classes (default) o Next o Add... Struts v1.0 Release (or whatever version you have) o Next o [Finish] 6. Start a new Web Application. o File | New | Web | Web Application o Name: strutsblank o Directory: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank (default) o Check off Generate WAR 7. Correct .tld file locations: o Open web.xml o Select Tab Libraries o Change all TabLib locations so that they point to the classes directory. o Example: /WEB-INF/classes/struts-bean.tld 8. Open Properties for 'strutsblank' o Right-Click on Web App strutsblank (icon of a hand with a globe) o Go to Classes Tab o Add Files... all files in strutsblank/src (ApplicationResources.properties and *.tld) o Go to
DTD Reference Problem Encountered while exercise the Struts EmployeelistExample in VAJ WTE 3.5.3
Hi, I tried to exercise the employeelist example in my VAJ 3.5.3 environment. I encountered a problem of locating a DTD file while starting Servlet Engine listed below: (1) When I used !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; within the struts-config.xml I got error message of .. External entity not found:http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;. (2) When I tried to use !DOCTYPE struts-config SYSTEM http://localhost:8080/WEB-INF/struts-config_1_0.dtd; or !DOCTYPE struts-config SYSTEM struts-config_1_0.dtd within the struts-config.xml I got error message of .. Relative URI /WEB-INF/struts-config_1_0.dtd; cannot be resolved without a document root URI. If someone can give me solutions or suggestions on how to fix this problem, it will be appreciated. Rongbin Cai [EMAIL PROTECTED]
Template Question: does errorPage directive need to be placed in each page?
Hello, I have been using struts for a little while now, but I am just starting to try out the template tags. So far, I have been very impressed. But I have a question about the errorPage directive. I was hoping that I would only need to use it once in the template I defined, but that does not seem to work when exceptions happen in one of the pages that make up the template. So, I tried placing the errorPage directive in each page in the template, but that had the undesireable effect of inserting the errorpage into the template in the place of the page with an exception. For Example, if I have a template defined that has a side menubar, and there is an exception in the menubar, the error page would occupy the position of the menubar, instead of the diplaying the errorpage as its own page. Does anyone have any input on this? I searched the archive and did not find anything on this, so I am guessing (hoping) that I am missing something. Thanks in advance for any replies, Bill
Digester addCallParam question
Should the addCallParam be able to pass attributes (not just element body values)? Sample xml: thing-definition thing name="name1" config key="theKey" value="theValue"/ /thing /thing-definition Sample code: aDigester.addObjectCreate("thing-definition/thing","ThingClass"); aDigester.addSetProperties("thing-definition/thing"); aDigester.addCallMethod("thing-definition/thing/config","addConfig",2); aDigester.addCallParam("key",0); aDigester.addCallParam("value",1); I cannot seem to get the addCallParam calls to work referencing attributes of the config element (nulls are always passed in to the addConfig method). I can change the xml to to make key and value actual elements and read the values from the body and reference them within addCallParam via "thing-definition/thing/config/key" - but was hoping to avoid that... The docs say: "You can specify that the parameter value be taken from a particular named attribute, or from the nested body content of this element" BUT I don't see anyway to reference the named attribute here... What am I missing? Thanks!! Tim Rafert
RE: JBuilder w/Struts Support
Hi Anthony, This might explain why the .TLD files weren't moving over. If this is true then are your instructions for steps 3 through 11 still valid? BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:16 PM To: '[EMAIL PROTECTED]' Subject: RE: JBuilder w/Struts Support Regarding step 1, you are correct. I had it wrong. The jar files must be used. This might explain why the .TLD files weren't moving over. If this is correct, step 2 may not be necessary. But to clarify, Step 2 had a typo, and wasn't clear to begin with. Sorry about that. It should read: 2. Move: o strutsblank\WEB-INF\classes\*.* to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src Again, the purpose of moving the .tld into src was to make sure they got included in the .war. If I had the open tools wrong, this would explain it. Anthony -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:06 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Anthony, I am trying to implement your solution and need some clarification on steps 1 and 2. Step 1 question - The instruction that come with the downloaded files from Borland (Nostruts.zip webinfextension.zip) indicate that the JAR files need to be placed into c:/jbuilder5/lib/ext which is different from your instructions which say to place the ZIP files in the directory. I have the ZIP files in the directory but I am wondering if I missed something here? Step 2 question - The instruction Move: strutsblank\WEB-INFclasses to strutsblank\src. So I created strutsblank\ and strutsblank\src directories under C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/, then extracted (unzipped) the struts-blank.war to the strutsblank\ directory. Next, I moved \strutsblank\WEB-INF\classes to \strutsblank\src\classes, is this correct? Thanks, BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:15 AM To: [EMAIL PROTECTED] Subject: JBuilder w/Struts Support Here is my recipe for JBuilder5 w/Struts Support. These steps are a culmination of a variety of posts found on a variety of groups. Thanks to all who contributed to this, for there are many. I hope these steps work for everyone. And I hope Borland eventually adds better support for JB5 w/Struts in the near future. The .TLD is the biggest problem, and it's not even a Struts specific requirement. Ingredients: o Borland JBuilder5 Enterprise (not tested on other versions) o Struts Support Addin Nostruts.zip webinfextension.zip http://codecentral.borland.com/ goto JB5 x OpenTools o Struts Blank .war file struts-blank.war http://jakarta.apache.org/struts goto downloads Steps: 1. Download/Install the above: o Extract the Struts Support Addin files to the open tools directory. Usually it's c:/jbuilder5/lib/ext on Windows. o Extract the Struts Blank file to your webapps directory. This allows it to run outside JB5 For example, the path would likely be C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank on Windows. You can call it whatever you want, but JB5 doesn't like dashes in the project .jpx, so I took it out. 2. Move: o strutsblank\WEB-INFclasses to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src o You'll see... 3. In JB5, set up Struts Support Addin o Tools | Configure Libraries... o New... o Name: Struts Support Addin o Location: User Home (default) o Add... c:/jbuilder5/lib/ext/Nostruts.zip o Add... c:/jbuilder5/lib/ext/webinfextension.zip o Click OK 4. Set Up Struts (still in Configure Libraries) o New... o Name: Struts v1.0 Release (or whatever version you have) o Location: User Home (default) o Add... path.to.struts.jar o Click OK o Click Required Libraries Tab o Add... Struts Support Addin o Click OK 5. Start a new project in JB5. o File | New | Project o Project name: strutsblank o Root path: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps o Project directory name: strutsblank (default) o Source directory name: src (default) o Backup directory name: bak (default) o Documentation directory name: src (default) o Output directory name: classes (default) o Next o Add... Struts v1.0 Release (or whatever version you have) o Next o [Finish] 6. Start a new Web Application. o File | New | Web | Web Application o Name: strutsblank o Directory: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank (default) o Check off Generate WAR 7. Correct .tld file locations: o Open web.xml o Select Tab Libraries o Change all TabLib locations so that
RE: JBuilder w/Struts Support
Only steps 7 and 8 are effected by this. -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:52 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Hi Anthony, This might explain why the .TLD files weren't moving over. If this is true then are your instructions for steps 3 through 11 still valid? BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:16 PM To: '[EMAIL PROTECTED]' Subject: RE: JBuilder w/Struts Support Regarding step 1, you are correct. I had it wrong. The jar files must be used. This might explain why the .TLD files weren't moving over. If this is correct, step 2 may not be necessary. But to clarify, Step 2 had a typo, and wasn't clear to begin with. Sorry about that. It should read: 2. Move: o strutsblank\WEB-INF\classes\*.* to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src Again, the purpose of moving the .tld into src was to make sure they got included in the .war. If I had the open tools wrong, this would explain it. Anthony -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:06 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Anthony, I am trying to implement your solution and need some clarification on steps 1 and 2. Step 1 question - The instruction that come with the downloaded files from Borland (Nostruts.zip webinfextension.zip) indicate that the JAR files need to be placed into c:/jbuilder5/lib/ext which is different from your instructions which say to place the ZIP files in the directory. I have the ZIP files in the directory but I am wondering if I missed something here? Step 2 question - The instruction Move: strutsblank\WEB-INFclasses to strutsblank\src. So I created strutsblank\ and strutsblank\src directories under C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/, then extracted (unzipped) the struts-blank.war to the strutsblank\ directory. Next, I moved \strutsblank\WEB-INF\classes to \strutsblank\src\classes, is this correct? Thanks, BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:15 AM To: [EMAIL PROTECTED] Subject: JBuilder w/Struts Support Here is my recipe for JBuilder5 w/Struts Support. These steps are a culmination of a variety of posts found on a variety of groups. Thanks to all who contributed to this, for there are many. I hope these steps work for everyone. And I hope Borland eventually adds better support for JB5 w/Struts in the near future. The .TLD is the biggest problem, and it's not even a Struts specific requirement. Ingredients: o Borland JBuilder5 Enterprise (not tested on other versions) o Struts Support Addin Nostruts.zip webinfextension.zip http://codecentral.borland.com/ goto JB5 x OpenTools o Struts Blank .war file struts-blank.war http://jakarta.apache.org/struts goto downloads Steps: 1. Download/Install the above: o Extract the Struts Support Addin files to the open tools directory. Usually it's c:/jbuilder5/lib/ext on Windows. o Extract the Struts Blank file to your webapps directory. This allows it to run outside JB5 For example, the path would likely be C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank on Windows. You can call it whatever you want, but JB5 doesn't like dashes in the project .jpx, so I took it out. 2. Move: o strutsblank\WEB-INFclasses to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src o You'll see... 3. In JB5, set up Struts Support Addin o Tools | Configure Libraries... o New... o Name: Struts Support Addin o Location: User Home (default) o Add... c:/jbuilder5/lib/ext/Nostruts.zip o Add... c:/jbuilder5/lib/ext/webinfextension.zip o Click OK 4. Set Up Struts (still in Configure Libraries) o New... o Name: Struts v1.0 Release (or whatever version you have) o Location: User Home (default) o Add... path.to.struts.jar o Click OK o Click Required Libraries Tab o Add... Struts Support Addin o Click OK 5. Start a new project in JB5. o File | New | Project o Project name: strutsblank o Root path: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps o Project directory name: strutsblank (default) o Source directory name: src (default) o Backup directory name: bak (default) o Documentation directory name: src (default) o Output directory name: classes (default) o Next o Add... Struts v1.0 Release (or whatever version you have) o Next o [Finish] 6. Start a new Web Application. o File | New | Web | Web Application o Name: strutsblank o Directory:
Re: Taglibs decrease the separation between designer and developer?
Bill Clinton wrote: The line between designer and developer is a blurry one and differs in most organizations. But in my last few postions, my experience has been that HTML proficiency is no longer a given for web designers. Macromedia Dreamweaver seems to be the tool of choice for most designers these days, and HTML skills seems to take a back seat to skills in Photoshop, Flash, Dreamweaver, gif animation, etc. And here lies the rub: As GUI JSP Tag extensions like http://jakarta.apache.org/taglibs/doc/ultradev4-doc/intro.html come of age, the Struts tags, and other libraries, start to plug right into the WYSIWYG environment. Programming a custom tag then becomes no different for a designer than programming an ordinary HTML tag. If someone hasn't taken DreamWeaver UltraDev for a test-drive, you should treat yourself. It's a real eye opener as to what can happen when all this comes together. I like to think of Struts as having been designed twenty minutes into the future. It's not only a framework for where we are, it's a framework for where we are going ;-) -Ted.
RE: Digester addCallParam question
Of course - as soon as I sent the email - I found the correct 3 parameter method addCallParam which includes the attribute name as the 3rd param. Sorry for the needless emails... -Original Message-From: Rafert, Tim Sent: Wednesday, August 01, 2001 2:49 PMTo: '[EMAIL PROTECTED]'Subject: Digester addCallParam question Should the addCallParam be able to pass attributes (not just element body values)? Sample xml: thing-definition thing name="name1" config key="theKey" value="theValue"/ /thing /thing-definition Sample code: aDigester.addObjectCreate("thing-definition/thing","ThingClass"); aDigester.addSetProperties("thing-definition/thing"); aDigester.addCallMethod("thing-definition/thing/config","addConfig",2); aDigester.addCallParam("key",0); aDigester.addCallParam("value",1); I cannot seem to get the addCallParam calls to work referencing attributes of the config element (nulls are always passed in to the addConfig method). I can change the xml to to make key and value actual elements and read the values from the body and reference them within addCallParam via "thing-definition/thing/config/key" - but was hoping to avoid that... The docs say: "You can specify that the parameter value be taken from a particular named attribute, or from the nested body content of this element" BUT I don't see anyway to reference the named attribute here... What am I missing? Thanks!! Tim Rafert
Re: some comparision between JSP/struts and velocity
One thing to consider here is the partitioning of functionality across tag libraries. For example, Struts currently has four taglibs - bean, html, logic and template. The tags in the html taglib are the only ones that generate HTML. This was a deliberate design decision, and allows the remaining taglibs to be reused in non-HTML situations. On the ToDo list for Struts 1.1 is a WML taglib. Once that exists, people will be able to create HTML output using the html taglib, or WML output with the wml taglib, and in either case they can continue to use the tags from the bean, logic and template taglibs. I don't think it's a question of whether or not generating HTML from custom tags is a bad thing. It's more a case of ensuring that the tags - and more specifically the tag libraries - are well designed for their intended purpose. -- Martin Cooper - Original Message - From: Assenza, Chris [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 6:28 AM Subject: RE: some comparision between JSP/struts and velocity I tend to agree with Tim here, but only in certain circumstances. If you place very specific HTML code in your tag library then that tag library has become very restricted in its use - basically it can only be used in the original context for which it was designed, otherwise the HTML will probably not match up properly. That makes re-using your taglibs pretty difficult, at least without re-writing the HTML within each time. On the other hand, if you don't care about cross-project reusability, then embedding HTML into a tag isn't such a bad idea since you only care about it for the current project and current needs. Personally, I think it's ideal to generate the minimalist amount of generic HTML as possible in a tag and then wrap it in HTML on the JSP when you use the tag. Again, that's only if you're going for maximum reusability. Right now, I've got some HTML embedded in our tags, but it's very generic HTML that can be used again and again without much actual change to the Java code itself. :) -Chris -Original Message- From: Tim Colson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 9:20 PM To: [EMAIL PROTECTED] Subject: RE: some comparision between JSP/struts and velocity Niall Pemberton suggested ...if the Struts tags dont do what you want then write your own. Then you dont have to use scriptlets, you have a re-useable bit of functionality, the web designers are happy and you dont have to use Velocity. While a custom tag is an option; this bit of functionality would have required embedding javascript code and html inside the custom tag lib. To me, putting view specific code like inside a tag library is also a slippery slope in the quest to keep thing separated. Cheers, Timothy
RE: DTD Reference Problem Encountered while exercise the Struts Employeelist Example in VAJ WTE 3.5.3
Just for the sake of getting it working and at the expense of hard-coding, extract the DTD's to some location on your drive and make the doctype declaration look like: !DOCTYPE struts-config SYSTEM file:/c:/etc/etc/etc/struts-config_1_0.dtd Chris -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 4:31 PM To: [EMAIL PROTECTED] Subject: DTD Reference Problem Encountered while exercise the Struts Employeelist Example in VAJ WTE 3.5.3 Hi, I tried to exercise the employeelist example in my VAJ 3.5.3 environment. I encountered a problem of locating a DTD file while starting Servlet Engine listed below: (1) When I used !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; within the struts-config.xml I got error message of .. External entity not found:http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd;. (2) When I tried to use !DOCTYPE struts-config SYSTEM http://localhost:8080/WEB-INF/struts-config_1_0.dtd; or !DOCTYPE struts-config SYSTEM struts-config_1_0.dtd within the struts-config.xml I got error message of .. Relative URI /WEB-INF/struts-config_1_0.dtd; cannot be resolved without a document root URI. If someone can give me solutions or suggestions on how to fix this problem, it will be appreciated. Rongbin Cai [EMAIL PROTECTED]
RE: some comparision between JSP/struts and velocity
If I gave the impression that I thougth otherwise, I apologize - but I agree! :) My point was really in response to Niall (I think), in the vein of thought that, depending on the purpose, you should probably be careful how much hard-coded HTML you put in the taglib if you intend to reuse the taglib in many different designs; that's why as an overall practice it may be better to pull as much HTML out as possible (or necessary) and leave the tag as atomic as possible! In regard to Struts' HTML tags, I think they serve their purpose quite well, if not perfectly. :) Chris -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 5:08 PM To: [EMAIL PROTECTED] Subject: Re: some comparision between JSP/struts and velocity One thing to consider here is the partitioning of functionality across tag libraries. For example, Struts currently has four taglibs - bean, html, logic and template. The tags in the html taglib are the only ones that generate HTML. This was a deliberate design decision, and allows the remaining taglibs to be reused in non-HTML situations. On the ToDo list for Struts 1.1 is a WML taglib. Once that exists, people will be able to create HTML output using the html taglib, or WML output with the wml taglib, and in either case they can continue to use the tags from the bean, logic and template taglibs. I don't think it's a question of whether or not generating HTML from custom tags is a bad thing. It's more a case of ensuring that the tags - and more specifically the tag libraries - are well designed for their intended purpose. -- Martin Cooper - Original Message - From: Assenza, Chris [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 6:28 AM Subject: RE: some comparision between JSP/struts and velocity I tend to agree with Tim here, but only in certain circumstances. If you place very specific HTML code in your tag library then that tag library has become very restricted in its use - basically it can only be used in the original context for which it was designed, otherwise the HTML will probably not match up properly. That makes re-using your taglibs pretty difficult, at least without re-writing the HTML within each time. On the other hand, if you don't care about cross-project reusability, then embedding HTML into a tag isn't such a bad idea since you only care about it for the current project and current needs. Personally, I think it's ideal to generate the minimalist amount of generic HTML as possible in a tag and then wrap it in HTML on the JSP when you use the tag. Again, that's only if you're going for maximum reusability. Right now, I've got some HTML embedded in our tags, but it's very generic HTML that can be used again and again without much actual change to the Java code itself. :) -Chris -Original Message- From: Tim Colson [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 9:20 PM To: [EMAIL PROTECTED] Subject: RE: some comparision between JSP/struts and velocity Niall Pemberton suggested ...if the Struts tags dont do what you want then write your own. Then you dont have to use scriptlets, you have a re-useable bit of functionality, the web designers are happy and you dont have to use Velocity. While a custom tag is an option; this bit of functionality would have required embedding javascript code and html inside the custom tag lib. To me, putting view specific code like inside a tag library is also a slippery slope in the quest to keep thing separated. Cheers, Timothy
custom XSL struts taglib (was: Re: Taglibs decrease the separation between designer and developer?)
Thought I'd put a plug in for my own custom XSL taglib I use in my STRUTS apps...it helps me clean up the whole scriplet/custom tag thing by letting me use plain 'ol XSLT templates to output my forms with pre-filled values, etc...from my EJB's...i also use the struts form tags and a custom property copier that copies things from my ejb to my form, but this is considerably slower than using my session bean to extract raw xml from a sql statement, then transform it into a list or form... this XSL tag caches the compiled stylesheet into the application scope, keyed on the filename...this to increase performance, which it does well... you can nest xml tags and scriptlets in the body of the tag to get dynamic xml (you could theoretically do a full page of xml this way, with no HTML whatever...i just haven't migrated that far yet to have my app do that), or you can get your xml from an attribute...and transform *into* an attribute, if you wish... i'm quite pleased with the results of incorporating my xsl into struts this way...this might also help some out there that would like to try it too...email me if you want the source code and .tld file... Jon Brisbin www.jbrisbin.net Lamar, MO - Original Message - From: Greg Maletic [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 3:07 PM Subject: RE: Taglibs decrease the separation between designer and developer? Hi, Bill-- I completely agree that Struts Taglibs are much cleaner than the pure HTML alternative, so I concur that your select box example is very simple and nice. I love all of the Struts form input tags, all of which are a real pain to implement with pure HTML and JSP. But I don't think I'm exaggerating very much when I say that the Struts taglibs are a new language: they include tags to define variables, looping constructs, and if-then-else constructs, none of which correspond to actual HTML tags, and all of which I'll need to employ if I'm to completely rid my JSPs of scriptlets. I view that as pretty much a complete language. So my novice reaction to the Struts taglibs is that I've swapped a language that I know (Java) for a language that I don't know (Struts taglibs), and my designer has swapped a language that he knows (pure HTML) for a language he doesn't know (Struts taglibs), at the benefit of giving the designer the potential to write virtual code when I know that he--and at least 95% of the designers I've worked with--won't write view code that I would trust no matter what the language is. (I'm not claiming they're stupid. My experience has been similar to Chris's earlier post, where I let them control the look and feel and I write the view code.) I'm not saying that the Struts taglibs are useless by any stretch of the imagination. But the real benefit I see with taglibs is to clean up the JSPs, not usher in a new age of empowered designers capable of building views with no developer assistance. I should have prefaced my comments by saying that I'm quite new to Struts, am not an expert, so my comments should be taken in that light. I am impressed with Struts and am absolutely not giving up on it. My beef isn't so much with Struts as it is with the whole concept of taglibs being the solution to the MVC separation problem. The only solution to this problem is to keep business logic out of the view, period. Scriptlets don't solve the problem, but I don't think taglibs do either. The only real solution I see is developer restraint. --Greg == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg]On Behalf Of Bill Clinton Sent: Wednesday, August 01, 2001 12:10 PM To: [EMAIL PROTECTED] Subject: Re: Taglibs decrease the separation between designer and developer? Greg, I think you are exagerating a bit when you say that Struts taglibs--and other taglibs--introduce, in essence, yet another language that we all have to learn. Comparing a handful of scripting tags that, for the most part, correspond directly to existing html tags to the learning of a language is a bit much. That said, if your designer is unable to understand struts tags, I would recommend that you ask him not to touch them. I don't understand why you would feel the need to teach a designer the ins and outs of Struts tags. Maybe you could try something like this: design the app, using completely stripped jsp pages. Ask your designer to do the interface, then put the tags in his interface. If the designer needs control of the presentation of html
Struts and Tomcat 4.0 Beta 6
Hey guys, Has anybody tried the Struts with the latest Tomcat 4.0 Beta 6? Are there any issues/ problems? thanks, Nicky
FW: Wrong ordering of rendered html elements when using templates under WAS 3.5.x
Title: FW: Wrong ordering of rendered html elements when using templates under WAS 3.5.x Hello personable people, We've got a live one over here - I've dug up an issue when using templates under WebSphere 3.5.4 (don't ask) with struts 1.0 (plus a fix or two that is required to get struts functioning properly under WAS3.5.x). The issue is that my JSP produces misordered html snippets. Here's what I mean: Actors: --- Home.jsp Home_content.jsp Home_template.jsp Home.jsp: - [%@ taglibs here % ] !-- home.jsp:My Title -- template:insert template=home_template.jsp template:put name=title direct=trueMy Title/template:put template:put name=content content=home_content.jsp / /template:insert Home_content.jsp: -- [%@ taglibs here % ] table width=100% border=0 cellspacing=0 cellpadding=0 tr tdfoo/td /tr /table Home_template.jsp -- [%@ taglibs here % ] html:html locale=true head titletemplate:get name=title / /title /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 table width=100% border=0 cellspacing=0 cellpadding=0 height=24 tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- template:get name=content / !-- end content -- /body /html:html Output of glorious home.jsp hosted by WAS3.5.x (notice out of order rendering!): - table width=100% border=0 cellspacing=0 cellpadding=0 tr tdfoo/td /tr /table html lang=en head title My Title /title /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 table width=100% border=0 cellspacing=0 cellpadding=0 height=24 tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- !-- end content -- /body /html !-- home.jsp:My Title -- See the problem? :-) I'd appreciate anyone with a clue to send me one. Thanks, Nik -- Nik Malenovic mailto:[EMAIL PROTECTED]
RE: JBuilder w/Struts Support
By eliminating step 2, step 7 becomes unnecessary but what about step 8? It's not clear to me. BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:55 PM To: '[EMAIL PROTECTED]' Subject: RE: JBuilder w/Struts Support Only steps 7 and 8 are effected by this. -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:52 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Hi Anthony, This might explain why the .TLD files weren't moving over. If this is true then are your instructions for steps 3 through 11 still valid? BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:16 PM To: '[EMAIL PROTECTED]' Subject: RE: JBuilder w/Struts Support Regarding step 1, you are correct. I had it wrong. The jar files must be used. This might explain why the .TLD files weren't moving over. If this is correct, step 2 may not be necessary. But to clarify, Step 2 had a typo, and wasn't clear to begin with. Sorry about that. It should read: 2. Move: o strutsblank\WEB-INF\classes\*.* to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src Again, the purpose of moving the .tld into src was to make sure they got included in the .war. If I had the open tools wrong, this would explain it. Anthony -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:06 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Anthony, I am trying to implement your solution and need some clarification on steps 1 and 2. Step 1 question - The instruction that come with the downloaded files from Borland (Nostruts.zip webinfextension.zip) indicate that the JAR files need to be placed into c:/jbuilder5/lib/ext which is different from your instructions which say to place the ZIP files in the directory. I have the ZIP files in the directory but I am wondering if I missed something here? Step 2 question - The instruction Move: strutsblank\WEB-INFclasses to strutsblank\src. So I created strutsblank\ and strutsblank\src directories under C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/, then extracted (unzipped) the struts-blank.war to the strutsblank\ directory. Next, I moved \strutsblank\WEB-INF\classes to \strutsblank\src\classes, is this correct? Thanks, BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:15 AM To: [EMAIL PROTECTED] Subject: JBuilder w/Struts Support Here is my recipe for JBuilder5 w/Struts Support. These steps are a culmination of a variety of posts found on a variety of groups. Thanks to all who contributed to this, for there are many. I hope these steps work for everyone. And I hope Borland eventually adds better support for JB5 w/Struts in the near future. The .TLD is the biggest problem, and it's not even a Struts specific requirement. Ingredients: o Borland JBuilder5 Enterprise (not tested on other versions) o Struts Support Addin Nostruts.zip webinfextension.zip http://codecentral.borland.com/ goto JB5 x OpenTools o Struts Blank .war file struts-blank.war http://jakarta.apache.org/struts goto downloads Steps: 1. Download/Install the above: o Extract the Struts Support Addin files to the open tools directory. Usually it's c:/jbuilder5/lib/ext on Windows. o Extract the Struts Blank file to your webapps directory. This allows it to run outside JB5 For example, the path would likely be C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank on Windows. You can call it whatever you want, but JB5 doesn't like dashes in the project .jpx, so I took it out. 2. Move: o strutsblank\WEB-INFclasses to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src o You'll see... 3. In JB5, set up Struts Support Addin o Tools | Configure Libraries... o New... o Name: Struts Support Addin o Location: User Home (default) o Add... c:/jbuilder5/lib/ext/Nostruts.zip o Add... c:/jbuilder5/lib/ext/webinfextension.zip o Click OK 4. Set Up Struts (still in Configure Libraries) o New... o Name: Struts v1.0 Release (or whatever version you have) o Location: User Home (default) o Add... path.to.struts.jar o Click OK o Click Required Libraries Tab o Add... Struts Support Addin o Click OK 5. Start a new project in JB5. o File | New | Project o Project name: strutsblank o Root path: C:/jbuilder5/jakarta-tomcat-3.2.1/webapps o Project directory name: strutsblank (default) o Source directory name: src (default) o Backup directory name: bak (default) o Documentation directory name: src (default) o Output directory
RE: JBuilder w/Struts Support
When I get a moment, I'll re-write them to reflect the correct open tools steps, and update the rest to follow suit. However, if you do what my steps say, and incorrectly install the open tools as zip files like I show, it does work. I think this is partially due to the fact that JB5 opens the .zip and finds the /src directory and compiles it, but that's just a guess. The disadvantage is, you'll just have your .tld files in the wrong place and the struts.jar loaded in the context. But at least the project will build and deploy. Anthony -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 3:44 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support By eliminating step 2, step 7 becomes unnecessary but what about step 8? It's not clear to me. BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:55 PM To: '[EMAIL PROTECTED]' Subject: RE: JBuilder w/Struts Support Only steps 7 and 8 are effected by this. -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:52 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Hi Anthony, This might explain why the .TLD files weren't moving over. If this is true then are your instructions for steps 3 through 11 still valid? BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:16 PM To: '[EMAIL PROTECTED]' Subject: RE: JBuilder w/Struts Support Regarding step 1, you are correct. I had it wrong. The jar files must be used. This might explain why the .TLD files weren't moving over. If this is correct, step 2 may not be necessary. But to clarify, Step 2 had a typo, and wasn't clear to begin with. Sorry about that. It should read: 2. Move: o strutsblank\WEB-INF\classes\*.* to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src Again, the purpose of moving the .tld into src was to make sure they got included in the .war. If I had the open tools wrong, this would explain it. Anthony -Original Message- From: Bill G [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:06 PM To: [EMAIL PROTECTED] Subject: RE: JBuilder w/Struts Support Anthony, I am trying to implement your solution and need some clarification on steps 1 and 2. Step 1 question - The instruction that come with the downloaded files from Borland (Nostruts.zip webinfextension.zip) indicate that the JAR files need to be placed into c:/jbuilder5/lib/ext which is different from your instructions which say to place the ZIP files in the directory. I have the ZIP files in the directory but I am wondering if I missed something here? Step 2 question - The instruction Move: strutsblank\WEB-INFclasses to strutsblank\src. So I created strutsblank\ and strutsblank\src directories under C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/, then extracted (unzipped) the struts-blank.war to the strutsblank\ directory. Next, I moved \strutsblank\WEB-INF\classes to \strutsblank\src\classes, is this correct? Thanks, BG... -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:15 AM To: [EMAIL PROTECTED] Subject: JBuilder w/Struts Support Here is my recipe for JBuilder5 w/Struts Support. These steps are a culmination of a variety of posts found on a variety of groups. Thanks to all who contributed to this, for there are many. I hope these steps work for everyone. And I hope Borland eventually adds better support for JB5 w/Struts in the near future. The .TLD is the biggest problem, and it's not even a Struts specific requirement. Ingredients: o Borland JBuilder5 Enterprise (not tested on other versions) o Struts Support Addin Nostruts.zip webinfextension.zip http://codecentral.borland.com/ goto JB5 x OpenTools o Struts Blank .war file struts-blank.war http://jakarta.apache.org/struts goto downloads Steps: 1. Download/Install the above: o Extract the Struts Support Addin files to the open tools directory. Usually it's c:/jbuilder5/lib/ext on Windows. o Extract the Struts Blank file to your webapps directory. This allows it to run outside JB5 For example, the path would likely be C:/jbuilder5/jakarta-tomcat-3.2.1/webapps/strutsblank on Windows. You can call it whatever you want, but JB5 doesn't like dashes in the project .jpx, so I took it out. 2. Move: o strutsblank\WEB-INFclasses to strutsblank\src o strutsblank\WEB-INF\*.tld to strutsblank\src o You'll see... 3. In JB5, set up Struts Support Addin o Tools | Configure Libraries... o New... o Name: Struts Support Addin o Location: User Home (default) o Add... c:/jbuilder5/lib/ext/Nostruts.zip o Add... c:/jbuilder5/lib/ext/webinfextension.zip o Click OK
Re: Wrong ordering of rendered html elements when using templates under WAS 3.5.x
Title: FW: Wrong ordering of rendered html elements when using templates under WAS 3.5.x I don't know if this helps, but I use something like this: html:html locale="true" template:insert template="templates/head.jsp" template:put name="title" direct="true" bean:message key="title.sometitle"/ /template:put /template:insert template:insert template="templates/body_begin.jsp"/ !-- PUT YOUR CONTENT HERE -- template:insert template="templates/body_end.jsp"/ /html:html - Original Message - From: Nik Malenovic To: [EMAIL PROTECTED] Sent: Thursday, August 02, 2001 1:11 AM Subject: FW: Wrong ordering of rendered html elements when using templates under WAS 3.5.x Hello personable people, We've got a live one over here - I've dug up an issue when using templates under WebSphere 3.5.4 (don't ask) with struts 1.0 (plus a fix or two that is required to get struts functioning properly under WAS3.5.x). The issue is that my JSP produces misordered html snippets. Here's what I mean: Actors: --- Home.jsp Home_content.jsp Home_template.jsp Home.jsp: - [%@ taglibs here % ] !-- home.jsp:My Title -- template:insert template="home_template.jsp" template:put name="title" direct="true"My Title/template:put template:put name="content" content="home_content.jsp" / /template:insert Home_content.jsp: -- [%@ taglibs here % ] table width="100%" border="0" cellspacing="0" cellpadding="0" tr tdfoo/td /tr /table Home_template.jsp -- [%@ taglibs here % ] html:html locale="true" head titletemplate:get name="title" / /title /head body bgcolor="#FF" text="#00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" table width="100%" border="0" cellspacing="0" cellpadding="0" height="24" tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- template:get name="content" / !-- end content -- /body /html:html Output of glorious home.jsp hosted by WAS3.5.x (notice out of order rendering!): - table width="100%" border="0" cellspacing="0" cellpadding="0" tr tdfoo/td /tr /table html lang="en" head title My Title /title /head body bgcolor="#FF" text="#00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" table width="100%" border="0" cellspacing="0" cellpadding="0" height="24" tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- !-- end content -- /body /html !-- home.jsp:My Title -- See the problem? :-) I'd appreciate anyone with a clue to send me one. Thanks, Nik -- Nik Malenovic mailto:[EMAIL PROTECTED]
Re: newbie: initial values
If the new parameter is fixed, you can put this into the foward entry in struts-config like this: forward name=success path=/editthing.do?id=BLA / If the parameter value is dynamic, and needs to be set by the action, how about this: ActionForward fwd = mapping.findForward(success); return new ActionForward(fwd.getPath() + ?id=BLA, fwd.getRedirect()); Notes: 1) This assumes that the path for the forward in struts-config does not include a query string. To be more robust, you should really check for that before appending your new parameter. 2) If you know that the forward is a 'forward' or a 'redirect', you can simplify the above by using ForwardingActionForward or RedirectingActionForward instead of ActionForward. However, it's safer to not make any assumptions, and use the code fragment above. Hope this helps. -- Martin Cooper - Original Message - From: ecn11 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 4:53 AM Subject: AW: newbie: initial values Hi. Thank you very much. The way you have described works really fine... But now I have another problem: After saving the form my ActionForward perform(...) returns mapping.findForward(success); Is there a way of generating the editthingdifferent.do?id=BLA again - that is adding a ?id=BLA to the mapping that the findForward generated... I have to edit further properties of the same somthing in the next form. Dominic -Ursprüngliche Nachricht- Von: Gregor Rayman [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 25. Juli 2001 14:58 An: [EMAIL PROTECTED] Betreff: Re: newbie: initial values ecn11 [EMAIL PROTECTED] writes: Hi. I apologize for this probably really stupid question, but I was not able to find a suitable answer anywhere, yet... In my user management I want to provide a way that the users can change their address (they are already stored in a database). Thus I need a form with the old address as initial values. In other words: There is a session variable UserId. How can the form bean that is used by edituser.jsp access this userid to adjust it's initial values. Dont do it this way. Implement an Action which fills the form with values. What I usually (I use struts one month :-) do in such edit something situations: I create I an EditTgingActionForm with properties a) the key properties b) the dependent properties c) optional - a boolean indicator isEditing I create an EditThingAction which: d) checks to see, whether the form has been filled from HTTP (which means: b) properties are filled and c) is true) if so, then it performs the updates. If not, no updates. e) fills the properties b) from the database using the key properties a). In my JSP which leads to that action, i use parametrized link: a href=editthing.do?id=BLA (generated with html:link) As you see, properties b) or c) are not supplied, so the Action knows, there is nothing to be updated, it just retrieves the data. editthing.do then forward to a JSP, which displays the retrieved data and when submitted (again to editthing.do) EditThingAction know, it has to update the data. -- gR
Re: custom XSL struts taglib (was: Re: Taglibs decrease theseparation between designer and developer?)
Jakarta TagLibs also have a taglib that does XSL, have you thought about merging your result with theirs? What I think is the big disadvantage with using XSL it is very complex to use, especially if you want to take advantage of its more powerful features. If designers are going to have problems understanding scriplets and velocity, they're not going to fair much better with XSL (probably worse, in fact). One good thing about having model data as XML, however, is that you can utilize the xpath to access the XML data if you don't need all the bells and whistles of XSL (fortunately Jakarta TagLib also provides a taglib that does this). Calvin On 01 Aug 2001 16:10:02 -0500, Jon Brisbin wrote: Thought I'd put a plug in for my own custom XSL taglib I use in my STRUTS apps...it helps me clean up the whole scriplet/custom tag thing by letting me use plain 'ol XSLT templates to output my forms with pre-filled values, etc...from my EJB's...i also use the struts form tags and a custom property copier that copies things from my ejb to my form, but this is considerably slower than using my session bean to extract raw xml from a sql statement, then transform it into a list or form... this XSL tag caches the compiled stylesheet into the application scope, keyed on the filename...this to increase performance, which it does well... you can nest xml tags and scriptlets in the body of the tag to get dynamic xml (you could theoretically do a full page of xml this way, with no HTML whatever...i just haven't migrated that far yet to have my app do that), or you can get your xml from an attribute...and transform *into* an attribute, if you wish... i'm quite pleased with the results of incorporating my xsl into struts this way...this might also help some out there that would like to try it too...email me if you want the source code and .tld file... Jon Brisbin www.jbrisbin.net Lamar, MO - Original Message - From: Greg Maletic [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 3:07 PM Subject: RE: Taglibs decrease the separation between designer and developer? Hi, Bill-- I completely agree that Struts Taglibs are much cleaner than the pure HTML alternative, so I concur that your select box example is very simple and nice. I love all of the Struts form input tags, all of which are a real pain to implement with pure HTML and JSP. But I don't think I'm exaggerating very much when I say that the Struts taglibs are a new language: they include tags to define variables, looping constructs, and if-then-else constructs, none of which correspond to actual HTML tags, and all of which I'll need to employ if I'm to completely rid my JSPs of scriptlets. I view that as pretty much a complete language. So my novice reaction to the Struts taglibs is that I've swapped a language that I know (Java) for a language that I don't know (Struts taglibs), and my designer has swapped a language that he knows (pure HTML) for a language he doesn't know (Struts taglibs), at the benefit of giving the designer the potential to write virtual code when I know that he--and at least 95% of the designers I've worked with--won't write view code that I would trust no matter what the language is. (I'm not claiming they're stupid. My experience has been similar to Chris's earlier post, where I let them control the look and feel and I write the view code.) I'm not saying that the Struts taglibs are useless by any stretch of the imagination. But the real benefit I see with taglibs is to clean up the JSPs, not usher in a new age of empowered designers capable of building views with no developer assistance. I should have prefaced my comments by saying that I'm quite new to Struts, am not an expert, so my comments should be taken in that light. I am impressed with Struts and am absolutely not giving up on it. My beef isn't so much with Struts as it is with the whole concept of taglibs being the solution to the MVC separation problem. The only solution to this problem is to keep business logic out of the view, period. Scriptlets don't solve the problem, but I don't think taglibs do either. The only real solution I see is developer restraint. --Greg == Greg Maletic Chief Technical Officer Zero G Software, Inc. 514 Bryant Street San Francisco, CA 94107 tel: +1.415.512.7771 x303 fax: +1.415.723.7244 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.ZeroG.com http://www.ZeroG.com The leading provider of multi-platform software deployment solutions. == -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg]On Behalf Of Bill Clinton Sent: Wednesday, August 01, 2001 12:10 PM To: [EMAIL PROTECTED] Subject: Re: Taglibs decrease the separation between designer and
inject another jsp/html page onto a flow
Hello: I have a license.jsp or it could be a license.html that i want to insert after my form's validate() is called. If the validation of the user inputs is successful, i want the license.jsp/license.html to pop up and the user has to click on the accept license agreement button before the flow to the action class can continue. I want to do this within one single action. This adds another page to the Strut workflow and i can't seem to how to get it to work within the Struts framework. I believe Struts can't do this. Am i wrong? Help please on how to do this? Thanks in advance! Simon This message is intended only for the use of the Addressee(s) and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify [EMAIL PROTECTED] immediately.
Re: Included Actions
Gregorsays:Output of an "included action" in a JSP. I think I understand this. I do something like it for my "Struts Inside of Struts" project. In doing so Iam pushing the FormBean concept to its logical (and absurd) conclusion. My FormBean contains only a StringBuffer attribute. The View JSP for this is extirely empty (almost)except for the expression of the StringBuffer. The function of my (outer) Action is to just invoke an HTTP session on an inner Action (a Struts Action in some other application on some other server), thento capturethe HTML output of that HTTP session, to modify some of its critical tag attributes and, finally, tostuffthat HTML character streaminto the StringBuffer of the ActionForm. I really thought that this would have horrible display latency before I tried it. Not really. Its almost bearable. But don't try it 3 deep. Dan Connelly (who is not Dan Connolly) PS. By the way, Struts works nicely for this absurd usage. I will still claim I honored MVC, although my View isvacuous and the Model knows damn well how it is to be rendered (almost).One disappointment in all this isjava.net.HTTPSession. It doesn't deal cookies, so this implementation has problems for Session Tracking under Struts. I am not the only person displeased by java.net.HTTPSession.There are alternative classes that produce can transfer cookie values (from Tigris, for example). Ijust haven't triedany of them yet. N.B., however, with respect to Struts, that ifmyaction form's(viewable) textis really huge,StringBuffer is not goint to work out. Struts would have to be re-architected into producer-consumer threads for the Model logic and the View (rendering) logic, respectively. This is an interesting thought. - Original Message - From: "Gregor Rayman" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 31, 2001 1:03 PM Subject: Included Actions Hi all, is it somehow possible to include the output of an action in one JSP? Now, when I try to include a *.do page, the server complains, it cannot forward to the action's jsp (of course, since I don't want to forward, I want to inlcude). The only "solution" I've found, is to len the Action's perform method return null and include the action (*.do) as well as the jsp. (Which I really do not like, since then the including page plays the role of the controller) Where should I start if I wanted to change the Action servlet, to include instead of forward? (I include actions' output in my templates. Where one part is the content and another part is the in an action generated menu) -- gR
Re: Struts and Tomcat 4.0 Beta 6
i haven't successfully got a struts app working in catalina...i have numerous classloader issues...i can't even get the example app to work right...i also use xsl, so that's an issue for me, but the basic app itself doesn't like catalina's classloading very well...not sure on the specifics... if you get it working, though, please let me know so i can try it again :-) Jon Brisbin www.jbrisbin.net - Original Message - From: Nicky Eshkenazi To: [EMAIL PROTECTED] Sent: Wednesday, August 01, 2001 4:51 PM Subject: Struts and Tomcat 4.0 Beta 6 Hey guys, Has anybody tried the Struts with the latest Tomcat 4.0 Beta 6? Are there any issues/ problems? thanks, Nicky
Re: [LONG] Re: action-mapping: why must the action-Attributepath be equivalent to the name of the jsp?
Thanks, Ted. -- John At 08:01 AM 8/1/2001 -0400, you wrote: John Yu wrote: I'm wondering if it makes sense to extend Struts' mapping architecture so that it will also look into a 'magic' url parameter and dispatch accordingly. For example, if the URL is MyAction.do?subAction=Create the ActionServlet will dispatch the request to the MyActionCreate class given the following (enhanced) action mapping. action path=MyAction subAction=Create type=MyActionCreate .../ Actions can forward to other ActionMappings, if the mappings are exposed as ActionForwards. If that's something you would like to do, you can use a generic dispatcher that would look for the subaction parameter and return the appropriate forward to another mapping. Here's an example perform() that can forward anywhere given /do/Dispatch?forward=forwardName. // -- Locals ActionForward thisForward = null; String wantForward = null; // -- Check check request for forward wantForward = request.getParameter(forward); // -- If found, consult mappings if (wantForward!=null) thisForward = mapping.findForward(wantForward); // -- If anything not found, dispatch error if (thisForward==null) { thisForward = mapping.findForward(error); ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(action.missing.parameter)); saveErrors(request, errors); } return thisForward; Here's a simple Hello World action to test it: response.setContentType(text/plain); PrintWriter writer = response.getWriter(); writer.println(Hello from: + mapping.getPath()); return(null); And some sample mappings: !-- Dispatcher action mapping -- action path=/Dispatch type=ext.http.DispatchForward scope=request validate=false forward name=test1 path=/do/Test1/ forward name=test2 path=/do/Test2/ /action action path=/Test1 type=ext.http.Test1 scope=request validate=false /action action path=/Test2 type=ext.http.Test1 scope=request validate=false /action If you ask for do/Dispatch?task=test1 you get Hello from test1 if you open do/Dispatch?task=test2 you get Hello from test2. (Note that an Action knows which path is used to call it, which is another way you can have Actions do different things based on the mapping context.) I only just wrote this, and it seems OK, but be warned that it is alpha code ;o) A couple of things to keep in mind: + You never really call an Action. You reference an ActionMapping, and the Controller calls the Action from that. + The ActionForms are populated from the request when the controller invokes the Action for a mapping. So if you forward the request to another mapping, it would populate the form for that mapping from the forwarded request. + Actions are not bound to ActionForms. The form is bound by the ActionMapping, and an Action can be used in any number of mappings. + Many times developers use the same or related names for an Action and the path to an ActionMapping. That is only a convenience. In Struts, you can only specify a logical path to an ActionMapping. What is behind that mapping is determined by the configuration file, and therefore belongs to the controller layer. Meanwhile ... a similar thing to the DispatchForward class given above can be done using the optional DispatchAction class in Struts 1.0 (org.apache.struts.actions.DispatchAction). Here you can create alternate perform methods in a single action, and call one or the another in the request. So you could have public ActionForward retrieve(ActionMapping mapping, ... public ActionForward update(ActionMapping mapping, ... and then call one or the other using myDispatchAction?method=retrieve or myDispatchAction?method=update. See the Struts JavaDoc for details. Very neat, really. -Ted. -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610
Re: PropertyUtils.copyProperties and session forms
On Thu, 19 Jul 2001, Matt Raible wrote: If I configure a form to be stored in the session for both an EditAction and SaveAction, should I have to do the following? PropertyUtils.copyProperties(sessionForm, editForm); You can do this. Or, if the data is literally the same, you might just consider using the same form bean for both actions. Thanks, Matt Craig
RE: struts-config parameter
On Thu, 19 Jul 2001, Martin, Margaret wrote: in your action code you can retrieve it from the ActionMapping passed in to the perform method via: mapping.getParameter(); We are using this parameter to indicate the method name to invoke from perform, so that we have a handful of action classes with many methods on them rather than a lot of very thin action classes. For the particular case of dispatching to a method (so you can combine lots of similar things into the same Action class), you can also check out the standard action that does exactly this: org.apache.struts.actions.DispatchAction The Javadocs for this class include an example of how to use it. This class uses the parameter attribute slightly differently than Margaret does -- it names the request parameter that will contain the name of the method to be called. It's quite convenient to include the method name as a hidden field on an input form. good luck - Margaret Craig McClanahan
Re: Struts Design patterns
On Mon, 23 Jul 2001, Ted Husted wrote: I would, yes. I use one Action class for all four CRUD operations on a table (or logical view), along with any special retrievals. Are you mapping this to four different actions? if so, you've got four instances of the Action class (even though it's all the same class, so your source code maintanence load is lower). One way to eliminate this small amount of overhead would be to try the dispatch standard action (org.apache.struts.actions.DispatchAction). This lets you (in effect) give a single Action class more than one perform method, selected by a request parameter. This can be very helpful in situations where different Actions logically fit together, like CRUD maintenance transactions. Craig McClanahan
RE: Wrong ordering of rendered html elements when using templates under WAS 3.5.x
Title: RE: Wrong ordering of rendered html elements when using templates under WAS 3.5.x All right amiable people, I've found what's been causing me grief. It's sucky servlet engines that's what it is. From J2EE 1.2.1 specs API documentation: javax.servlet.jsp Class PageContext public abstract void include(java.lang.String relativeUrlPath) throws ServletException, java.io.IOException [...] The current JspWriter out for this JSP is flushed as a side-effect of this call, prior to processing the include. [...] So go figure - if you issue pageContext.getOut().flush(); before pageContext.include() and it will work as advertised... I believe that WebFear is using an old JSP Servlet container implementation that just forgot to implement this piece of the spec. however, my problem can be fixed WITHOUT any code changes - I have to do two things: 1. put no code (other then template:include /) in home.jsp 2. use template:get flush=true / I hope others will learn from my misfortune. Thanks for other for chipping in with advice. Fare well, Nik -- Nik Malenovic mailto:[EMAIL PROTECTED] -Original Message- From: Nik Malenovic [mailto:[EMAIL PROTECTED]] Sent: Monday, July 30, 2001 7:00 PM To: [EMAIL PROTECTED] Subject: Wrong ordering of rendered html elements when using templates under WAS 3.5.x Hello personable people, We've got a live one over here - using templates under WebSphere 3.5.4 (don't ask) with struts 1.0 (plus a fix or two that is required to get struts functioning properly under WAS3.5.x) produces misordered rendered html elements. Here's what I mean: Actors: --- Home.jsp Home_content.jsp Home_template.jsp Home.jsp: - [%@ taglibs here % ] !-- home.jsp:My Title -- template:insert template=home_template.jsp template:put name=title direct=trueMy Title/template:put template:put name=content content=home_content.jsp / /template:insert Home_content.jsp: -- [%@ taglibs here % ] table width=100% border=0 cellspacing=0 cellpadding=0 tr tdfoo/td /tr /table Home_template.jsp -- [%@ taglibs here % ] html:html locale=true head titletemplate:get name=title / /title /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 table width=100% border=0 cellspacing=0 cellpadding=0 height=24 tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- template:get name=content / !-- end content -- /body /html:html Output of glorious home.jsp hosted by WAS3.5.x (notice out of order rendering!): - table width=100% border=0 cellspacing=0 cellpadding=0 tr tdfoo/td /tr /table html lang=en head title My Title /title /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 table width=100% border=0 cellspacing=0 cellpadding=0 height=24 tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- !-- end content -- /body /html !-- home.jsp:My Title -- See the problem? :-) I'd appreciate anyone with a clue to send me one. Thanks, Nik -- Nik Malenovic mailto:[EMAIL PROTECTED]
Re: still no luck with struts in tomcat 4 (was: Re: iPlanet - Cannotfind message resources u/key)
Tomcat 4 does not expose an XML parser to web applications. Thus, you'll need to do one of the following: * Stick an XML parser into the $CATALINA_HOME/lib directory to make it available to all web apps, or * Stick an XML parser into the /WEB-INF/lib directory of your web app. Note that the struts-example.war shipped with Struts does *not* have a parser in it. Craig On Tue, 24 Jul 2001, Jon Brisbin wrote: i get this same error on the plain binary download of tomcat 4 and try to fire the struts example... jb - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, July 23, 2001 3:26 PM Subject: Re: iPlanet - Cannot find message resources u/key All, Has anyone with iPlanet Webserver 4.x, 6.x been able to get Struts to work? If so, have you run into the: javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE error? If so, how were you able to fix it? Thanks, Brian Brian.Duchouquette@tran splace.com To: [EMAIL PROTECTED] cc: 07/23/2001 02:50 PMSubject: Re: iPlanet - Cannot find message resources u/key Please respond to struts-user Does iPlanet Webserver 6.0 know how to use web.xml? Or is it like iPlanet Webserver 4.2 which uses rules.properties to handle essentially the same thing? (I have a call into iPlanet technical support for this question since I think I am getting too much into the container implementation of a particular vendor. However if someone has already solved this problem with iPlanet, then please feel free to let me know!). I did have the mapping in my Web.xml file from your last message, but I think that the iPlanet servlet container doesn't know how to use it. This is just a guess... Maybe there is some other configuration I need to do in the administration console for iPlanet Webserver 6.0 to map to a servlet directory to get this to work? Brian Matt Raible matt_raible@To: [EMAIL PROTECTED] yahoo.com cc: Subject: Re: iPlanet - Cannot find message resources u/key 07/23/2001 02:25 PM Please respond to struts-user Make sure your web.xml has the following entry for the action class: servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param --- [EMAIL PROTECTED] wrote: Matt, Oops, I suppose I should have specified Webserver or Appserver. I'm using iPlanet Webserver 6.0. My classpath points to the directory containing ApplicationResources.properties which is: c: \iPlanet\Servers\docs\webapps\struts\WEB-INF\classes\ApplicationResources.pr operties This does not seem to work even after updating the server startup classpath in jvm12.conf. Here is that entry in jvm12.conf: jvm.classpath=c: \iPlanet\Servers\docs\webapps\struts\WEB-INF\lib\struts.jar;c: \iPlanet\Servers\docs\webapps\struts\WEB-INF\;c: \iPlanet\Servers\docs\webapps\struts\WEB-INF\lib;c: \iPlanet\Servers\docs\webapps\struts\WEB-INF\classes;c: \iPlanet\Servers\docs\WEB-INF\classes\beanutils.jar; c: \iPlanet\Servers\docs\WEB-INF\classes\collections.jar;c: \iPlanet\Servers\docs\WEB-INF\classes\digester.jar;C:/iPlanet/Servers/plugin s/servlets/examples/legacy/beans.10/SDKBeans10.jar Thanks, Brian Matt Raible matt_raible@To: [EMAIL PROTECTED] yahoo.com cc: Subject: Re: iPlanet - Cannot find message resources u/key 07/23/2001 02:08 PM Please respond to struts-user iPlanet Web Server or App Server? The fix on the appserver is a classpath thing - probably the same on Web Server. --- [EMAIL PROTECTED] wrote: All, Can someone please post their iPlanet 6x configuration files for the struts_example.war web application? I'm sure the answer to my problem is entering the descriptor xml to point to the location of the resources file, but since iPlanet does not support Webapps and WAR files, this is not a straightforward
Re: Tomcat/Struts Design Issues and Questions
There is a really valid technical reason for the servlet spec's constraint about sessions not being shared across web apps -- each web app is loaded from a different class loader, so they cannot see each other's bean classes. So, even if you hacked Tomcat to allow shared sessions, beans created in webapp 1 would not be accessible in webapp 2. The best way to share state information across web apps is to use external mechanisms (databases, EJBs, etc.) and pass the record key or whatever through the query string. To avoid session timeouts while the user is gone, one thing you can do is call session.setMaxInactiveInterval() on the originating session to some very large value when they leave, and set it back again when they come back. Craig On Tue, 24 Jul 2001, Becky Moyer wrote: Struts-users! Sorry if this is not the best forum for this; I am asking this here becuase I think Struts factors into my question. I am creating a web site that allows for the future addition of new webapps to extend the original site. I would like to allow users to make their add on as a full webapp, and I'll store the link to the new webapp in my database. One of the requirements I have is that I need to pass my session onto the new webapp. But, oops, you can't do that. Tomcat (and the Servlet API) doesn't let you pass a session to a new webapp - as far as I can tell. I could pass the important tidbits as strings along in the URL and recreate a session once I get to the new webapp, but that has its own set of problems...it's insecure (no matter how i encode the URL), and it completely messes up the first webapp, becuase when I return to that webapp the session will probably have timed out. Does anyone know of a way that I can maintain a list of trusted webapps which I can pass session between? How about if there is a way to deploy an entire webapp within the context of another? I don't want future developers to need to mess with my code to get their apps into my context. And here is the STRUTS part of my question. If I allow future developers to simply put all of their JSPs/images/templates/etc. into a subdirectory in my webapp, is there a way to allow them to either add their own struts-config.xml file or make struts reread the struts-config.xml file while Tomcat is still running? I also have a requirement of leaving the server running while i deploy so that i don't lose sessions. Any thoughts would be welcome and appreciated. I have looked through archives for Tomcat and Struts and can't seem to find an answer. Thanks in advance! Becky _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Re: Use of form beans - design issue...
But to gather information for use on a JSP, the bean must know how to gather that data from the business layer (model). BAD!! This is incorrect. The bean doesn't do anything by itself. The Controller (Action) communicates with the Model to provide whatever information will be required by the View. The View (e.g. JSP) just picks up the relevant information (from the request or session or elsewhere) and displays it. The handler should configure the bean BEFORE dispatching to the JSP. This way, the bean remains dumb and the handler centralizes all knowledge of the business layer. It does. In this context, the handler is the Action class. As part of the Controller, the Action class is responsible for setting up the data so that it can be displayed by the View. -- Martin Cooper - Original Message - From: Burleson, Thomas [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 26, 2001 1:58 PM Subject: Use of form beans - design issue... Good point. And default/auto construction issue illuminates a design concern. Currently -- as I understand it -- the ActionForm (bean) is populated by the ActionServlet using introspection. And the Bean is then used by the Action (handler) to modify/update the business layer or model data. Then the actionForward is used to indicate which JSP the Servlet should forward/dispatch to. The page (which could be a different JSP page or the same used for the request) then searches for the ActionForm (bean) and creates one if it does not exist in the request scope. So (finally) here is the issue: The controller and handler uses a dumb bean to modify the model (MVC). Cool! But to gather information for use on a JSP, the bean must know how to gather that data from the business layer (model). BAD!! The handler should configure the bean BEFORE dispatching to the JSP. This way, the bean remains dumb and the handler centralizes all knowledge of the business layer. Struts seems to use 2 different patterns/approaches: the incoming processing is very different than the processing used during display of the JSP. Is my understanding correct? ThomasB Calmwater Software ThomasB@Calmwaters -Original Message- From: Andreas Amundin [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 3:22 PM To: '[EMAIL PROTECTED]' Subject: RE: Creation of form bean It is created by struts if it does not already exist. This is why the form beans has to have a default constructor. If one exists it will be used to populate the form with default values. Rgs, Andreas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 26, 2001 1:18 PM To: [EMAIL PROTECTED] Subject: Creation of form bean Hi. Just a quick question - if I link directly to a jsp which contains an html:form tag with a formbean specified which I use on submit, is the formbean created by Struts? Or do I need to go through an empty action just to create it? thanks, Dave