RE: Javascript Validation
GREAT! THATS EXACTLY HOW I FEEL, thanx, now i'm getting that good feeling again that what i've done is ok... -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 10, 2001 2:04 AM To: '[EMAIL PROTECTED]' Subject: RE: Javascript Validation On Fri, 8 Jun 2001, Dudley Butt@i-Commerce wrote: i just find it sometimes easier to move all validation off the jsp, and hence all java off the jsp. I think its just basically a personal preference. This way I'm making full use of the struts error handling model and keep all my java in one place. There always seems to be more than one way to do things, just depends on what u need to do and whats your preference Thanx for all the help guys In future versions of Struts we will be integrating the ability to create client side validations. In my mind, the purpose of these validations is to improve the quality of the user interface -- in this case, by catching errors that can be caught inside the page (such as required fields and invalid number formats) without wasting the time needed to submit the form and get the errors back. However, it is important to understand that you should *ALWAYS* perform these validations again on the server side. Consider the following cases: * The client turns off JavaScript * The client does not support JavaScript * The user is actually typing a URL (with request parameters) directly into the location line of the browser. Basically, never trust the client to do any validations. Craig McClanahan
RE: Can anyone help with solving the BACK button problem, in th e browser?
thanx, appreciate the suggestion -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 10, 2001 1:47 AM To: '[EMAIL PROTECTED]' Subject: RE: Can anyone help with solving the BACK button problem, in th e browser? On Fri, 8 Jun 2001, Dudley Butt@i-Commerce wrote: yes, but this is a form that is being filled in like a wizard type of thing, i need the form to be session any ideas, for an alternative? The alternative approach is to have *all* of the input fields for the entire wizard included on every page -- but the ones you are not displaying on the current page would be created with html:hidden instead of html:text or whatever. Craig
forward attribute
HI, How do i forward attributes from Action class, which can be accessed in the jsp page. so that specific error can be displayed mapping.findForward("failure"); forward name="failure" path="/examp/logon.jsp" / thanks rajiv
Re: uploading file requires immediate serialization location?
Sorry, I should have said If the bean goes away, then so does the only reference you'll get to the file that holds the uploaded data. The FormFile object, which contains the relevant information, will go away when the bean goes away (unless you have another reference to it, of course). The FormFile does not contain the actual uploaded data, just the name of the file it was saved in. -- Martin Cooper - Original Message - From: Jonathan Asbell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 10, 2001 11:16 PM Subject: Re: uploading file requires immediate serialization location? You wrote... The uploaded data is stored in a temporary file somewhere on disk.The bean is in either request or session scope. If the bean goes away, then so does the file that holds the uploaded data. I thought you said the file was written to disk? Thus the binary is not in the bean. Or is it that the FormFile has all this data and IT is in the bean. So I end up with a file on disk that is in a state of not be associated with anything yet, and whos filename and input field names I have lost when the bean went away. Is that it? If we are keeping the FormFile in the bean, in the session and the FormFile indeed does contain the binary, than this is a bad thing. We should at theleast kill the binary from the FormFile object so we CAN safely put it in the session. (Dont know if I mentioned by weblogic croaks/freaks if the session has too much k in it. - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Jonathan Asbell [EMAIL PROTECTED] Sent: Monday, June 11, 2001 1:55 AM Subject: Re: uploading file requires immediate serialization location? String parameters are not written to a file. Only the bodies of file upload parts are written to disk, and each one to a separate file. The files are written as the input stream (i.e. the request) is processed. Let's say your form has two fields, a textarea called 'myText' and a file input called 'myFile'. After you submit it, and Struts has populated your form bean, you will have: 1) The text from the textarea field is stored in the bean's 'myText' property as a String. 2) The uploaded data is stored in a temporary file somewhere on disk. 3) The 'myFile' property on your bean, which has type FormFile, contains information about the uploaded data (e.g. file name, content type, etc.). The bean is in either request or session scope, as you defined it in your struts-config.xml file. If the bean goes away, then so does the file that holds the uploaded data. Hope this helps. -- Martin Cooper - Original Message - From: Jonathan Asbell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 10, 2001 10:48 PM Subject: Re: uploading file requires immediate serialization location? So do you simultaneously write to a file while reading a String parameter when you process a form? What parts of the multipart request do we save in the bean, and in what scope? - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Jonathan Asbell [EMAIL PROTECTED] Sent: Monday, June 11, 2001 1:23 AM Subject: Re: uploading file requires immediate serialization location? Yes, I think you've got it. Just to be clear, though, when you say we need to examine the sections in the header ..., the we here is Struts - you don't need to do anything in your application. Struts makes getParameter() et all work for multipart requests as well as regular requests. What you are seeing in the packages you've looked at is the parsing of a MIME part. The fields in a multipart/form-data request each conform to the specification for a MIME part, and they are separated by a boundary, which is a line containing a pattern defined in a header at the top of the request. Each MIME part consists of a sequence of MIME headers, followed by a blank line, followed by the data for that MIME part, known as the body. A MIME header takes the form header-name: value - for example, Content-type: text/plain. The body is just a bunch of data that conforms to the statements made about it in the headers. Every field in a multipart request is encoded this way. So where a regular query using GET might contain a query string like this: ...author=Martin... a multipart request would represent the same query parameter like this: -0123456789-- Content-disposition: form-data; name=author Martin -0123456789-- For a file upload, the difference is only that the Content-disposition header will include a file name, and the data can be binary if necessary. When a multipart handler processes a request, it is reading the data from an
User management?
I've try struts and impressed by its MVC framework. But I found that there isn't a good solution for user management. Would anybody suggest a solution to solve following problem? role based security system user registration Maybe some open source project which can cooperate whith struts. _ Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn ¾Û½¹²Æ¾Èȵ㣬¾¡À¿É̺£·çÔÆ£¡¡ª¡ª ÑÅ»¢²Æ¾È«Ð¸İæ! http://cn.finance.yahoo.com
Where should I use .do and where .jsp for the same file
Hi Here is a small doubt. Please inform me where should I call a file with .do extension and where should I call the same file with .jsp extension. Looking forward SrinivasDo You Yahoo!? Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.
Re: how does one invoke cascasde style sheets
Hi, The struts-template worked as i placed all my companies html elements pages in the stuuts-template(web app) i dont think that was the norm. Anyway i am going to try your advice. Cheers Chuck. William Jaynes wrote: I put my style sheets in a directory at the top level of my web application. For example in /tomcat/webapps/myapp/css. Then in the jsp I reference it simply as link rel=stylesheet href=css/templates.css charset=ISO-8859-1 type=text/css - Original Message - From: kuma.cra [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 05, 2001 8:00 PM Subject: how does one invoke cascasde style sheets Hi ,folks thru struts i have been able to create / modify a taglib from within netbeans v3.2 tomcat as the container (win98 OS )and connect to a postgresql test database on lunix thanks all , anyway as a newbie please could you point me in the right direction to how and where i set up my companies cascade style sheets for our look and feel on the jsp's as i preparing a project benchmark . 1) do i create a resource directory beneath my webapps/WEB-INF dir. 2) do i have to map it within the tld . Any suggestions welcomed as so far i have had excellant feedback from this community. Cheers all Chuck -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi. begin:vcard n:amadi;chuck tel;cell:07970 972534 tel;fax:01874 622574 tel;home:[EMAIL PROTECTED] tel;work:Brecon Beacons National Park x-mozilla-html:FALSE url:http://www.breconbeacons.org org:Brecon Beacons National Park;I.T version:2.1 email;internet:[EMAIL PROTECTED] title:I.T Systems Programmer adr;quoted-printable:;;7 Glamorgan Street=0D=0ABrecon=0D=0APowys;Brecon;Powys;LD3 7DP;Wales (United Kingdom) fn:chuck amadi end:vcard
RE: File Upload Corrupting Zip File
The file it errors out on is an image .GIF file. The ZipException is: java.util.zip.ZipException: invalid entry size (expected 18861 but got 18862 bytes) at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:355) at java.util.zip.ZipInputStream.read(ZipInputStream.java:144) at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:93) at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:71) at com.wellcert.util.ZipUtil.listEntries(ZipUtil.java:105) so it's throwing an extra byte in there during the upload. Unfortunately I'm working on Win2000 right now and my DOS fc utility doesn't do a good job of telling me what the errant byte is. Basically I know it's exactly one byte longer. thanks for any help, Darryl -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: 10 June 2001 06:43 To: [EMAIL PROTECTED] Subject: Re: File Upload Corrupting Zip File Do you have a binary diff utility that you could use to see what changed in the uploaded file? That would be very helpful. Also, if you can tell me how many bytes were added to the file, and what type of file it was that caused the problem, that might help too. Thanks. -- Martin Cooper - Original Message - From: Darryl Pentz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 08, 2001 7:31 AM Subject: File Upload Corrupting Zip File Hi all, Something happens to corrupt a file I'm uploading from a multipart form. If I run a ZIP file through my unzip utility targeting the actual ZIP file, it unzips just fine. If I point my unzip utility at the temporary file in the deployments temp directory of Orion Server (the app server I'm using), the utility fails with a ZipException indicating it expected x bytes but got x+ bytes on one of the zip entries. I did the same with WinZip and it worked on the original ZIP and also failed on the uploaded temp file. It seems to me that the problem most likely lies with Struts, particularly the DiskMultipartRequestHandler.java but there's nothing in there that appears suspicious. Does anyone have any insight on this or has anyone perhaps had this same problem? Interestingly though, I unzipped the file, removed the entry that was causing the problem, rezipped it and everything worked fine. That doesn't however exonerate Struts however, since both my zip utility AND WinZip worked on the original ZIP. The problem only occurs after Struts has uploaded the file. Here is the output that WinZip gave me when it failed to unzip the temp file: Extracting to C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ Use Path: no Overlay Files: yes warning [C:/orion/application-deployments/wellcert/wellcert-web/temp/strts34531.tmp] : extra 1 bytes at beginning or within Zip file (attempting to process anyway) Error in file #1: bad Zip file offset (Error local header signature not found): 409756 (attempting to re-compensate) Extracting Image36.gif Error: unexpected end of file encountered Error: invalid compressed data to inflate thanks in advance, Darryl Pentz
RE: Where should I use .do and where .jsp for the same file
Hi Eda, This all depends on your web.xml and your struts config. The do extension is the default used by struts and configured in your web.xml to invoke the action servlet. This will then work out which action bean to invoke. So if your want to run an action bean directly you would invoke .do in your form action or link. If you need to render some information, collect user input then do something you would include the name of a form bean in your form tag. If you don't wish to collect data, just render it you would use a .jsp extension to simply forward to a jsp (although I always recommend the use of a global forward). Hope this helps, Jon. -Original Message- From: Eda Srinivasareddy Eda [mailto:[EMAIL PROTECTED]] Sent: 11 June 2001 08:40 To: [EMAIL PROTECTED] Subject: Where should I use .do and where .jsp for the same file Hi Here is a small doubt. Please inform me where should I call a file with .do extension and where should I call the same file with .jsp extension. Looking forward Srinivas Do You Yahoo!? Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.
Good 'ol missing message for key...?
Hi here! Being somewhat new to struts in general and in combination with Websphere Application Server (WAS) in particular I have the following questions for you: Is it correct that only the struts-1.0-b1 distribution will work with WAS? I have deployed struts-example.war and converted it to my own application. Everything works fine except that it can't find my ApplicationResource.properties file. Searching this forum I can see that people emphasize that struts.jar should *not* be in the web apps classpath but if I try to put any other place I get the error: Application unavailable for service. Also, people suggest that it should be in the lib directory but I can find no lib directory using the struts-1.0-b1 distribution. Checking the web.xml file(s) I can see that the path for the ApplicationResources.properties is correct. Nevertheless, I get the error: Missing key for message index.title Why the flaming heck can't it find the friggin file? brgds, S. Bro _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
RE: Exception handling in the ActionServlet
-Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: 10 June 2001 02:00 To: [EMAIL PROTECTED] Subject: Re: Exception handling in the ActionServlet On Sat, 9 Jun 2001 [EMAIL PROTECTED] wrote: Hi, I would like to catch all of our project specific exceptions in one place (as a last resort, if nobody else catches them earlier on) and handle them in a generic way. The obvious way to do this, I think, is by overriding processActionPerform in our own ProjectActionServlet and catch ProjectException's (superclass for all our own exceptions) there. But the Action.perform method only throws IOException ServletException, so either all our own exceptions will have to inherit from either of those two classes (can't be the right thing to do), or I will have to change the Action.perform definition to also throw our ProjectException's (doesn't seem right either, I'd prefer not to have to alter any struts code)? What should I do? How about having the base class for you project exceptions be a subclass of ServletException? That way, you can throw it if you really want to. Then you could declare an error-page element in your web.xml file to define common handling (if you don't the default will be an ugly stack trace on most containers). Alternatively, if you have a project exception in your Action.perform method, you could just wrap it up in a ServletException and throw that. E.g; try { . } catch (ProjectException e) { throw new ServletException(Some text, e); } Then in your subclassed processActionPerform method you get at your original exception by calling the getRootCause() method of ServletException. This avoids having to base your exceptions on any particular subclass. This actually brings me to another problem that doesn't have anything to do with struts, but is more a general Java question. Anyway, maybe somebody here has an elegant solution to it: Assume the problem above is solved and furthermore that some of the project specific exceptions have to inherit from other existing exception classes (e.g. ServletException, IOException, etc.). Since we don't have multiple inheritance, I can't have a ProjectException that is a superclass to all my own exceptions. I still want to catch all our own exceptions (but no others) in one place. My first though was of course to define a ProjectException interface and let all our own exceptions implement this interface, thus being able only to catch ProjectException's. But Throwable is not an interface (why not? What's the idea behind this design?) that ProjectException could inherit from and thus this approach doesn't work, as the try{}catch(){} statement expects a Throwable object as parameter (try{}catch(ProjectException e){} doesn't compile). Well, as a kind of a hack I then thought I'll catch all exceptions, check if it is a project specific one (ProjectException.class.isInstance(anException)), and if not throw it again, but that can't be right, because the method where this happens then will have to be declared to throw Exception (to generic). I'll appreciate any help, thanks in advance and the best satisfactory answer wins a free beer in Zurich ;-) I'd investigate extending ServletException for your application exception classes. Another off-the-wall idea would be to extend RuntimeException instead -- you can throw such an exception without it being listed in the throws clause. This is how things like IllegalArgumentException and NullPointerException work. Klaus Bucka-Lassen Craig
RE: User management?
Hi, User management is a tricky one, have you looked at form base authentication? See Section 11.5.3 of the Servlet 2.2 spec. This works with most containers, but the setup mechanism will be different. What container are you using? You may still wish to create a user object based on info looked up, you would have to code this and place it in a session. Jon. -Original Message- From: [mailto:[EMAIL PROTECTED]] Sent: 11 June 2001 08:19 To: [EMAIL PROTECTED] Subject: User management? I've try struts and impressed by its MVC framework. But I found that there isn't a good solution for user management. Would anybody suggest a solution to solve following problem? role based security system user registration Maybe some open source project which can cooperate whith struts. _ Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn ¾Û½¹²Æ¾Èȵ㣬¾¡À¿É̺£·çÔÆ£¡¡ª¡ª ÑÅ»¢²Æ¾È«Ð¸İæ! http://cn.finance.yahoo.com
Dynamic action mapping
I am looking for a way to invoke different Actions from one form depending on the button clicked by the user. Is there a simple way of configuring Struts to do this? Corneil du Plessis AFA Systems Tel: +27 11 886-6938 Fax: +27 11 789-4907 Cell: +27 82 802-5768
Re: HOW TO INCLUDE JAVASCRIPT FILE.js in your struts jsp page?
Hi, there folks , Firstly regarding Cascade Style Sheets it worked by moving it to were web apps was looking at top level. My next problem i have scripted a infoscroll script (window status in JavaScript for our Index.jsp , thus it works on my personnal site albeit not my conpanies prototype. I have scripted before with JavaScript in html elements only and works fine any suggestions html> !--Below is a JSP expression that is not hidden from browser--> !-- JSP Name:index.jsp Written by Chuck Amadi IT Systems Programmer.This page was executed on %=new java.util.Date()%>--> head> title>Brecon Beacons National Park/title> body background="#ff"> meta name="generator" content="Brecon Beacons National Park Authority site generator"> meta name="keywords" content="brecon beacons national park recreation travel walking climbing access"> !-- reference standard bbnpa cascade style sheet --> link rel="stylesheet" href="css/bbnpa.css" charset="ISO-8859-1" type="text/css"> //create scrolling window status script LANGUAGE="JavaScript"> !-- hide js code function infoscroll(seed,looped) { dont need to bore u with the rest of the body script!!! } // end js code --> !-- infoscroll(100,1) // --> /script> cheers chuck "Dudley Butt@i-Commerce" wrote: Does anyone have an example of this? -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilwch bob copi.
How to include javascript within a jsp !!
i, there folks , Firstly regarding Cascade Style Sheets it worked by moving it to were web apps was looking at top level. My next problem i have scripted a infoscroll script (window status in JavaScript for our Index.jsp , thus it works on my personnal site albeit not my conpanies prototype. I have scripted before with JavaScript in html elements only and works fine any suggestions html !--Below is a JSP expression that is not hidden from browser-- !-- JSP Name:index.jsp Written by Chuck Amadi IT Systems Programmer.This page was executed on %=new java.util.Date()%-- head titleBrecon Beacons National Park/title body background=#ff meta name=generator content=Brecon Beacons National Park Authority site generator meta name=keywords content=brecon beacons national park recreation travel walking climbing access !-- reference standard bbnpa cascade style sheet -- link rel=stylesheet href=css/bbnpa.css charset=ISO-8859-1 type=text/css //create scrolling window status script LANGUAGE=JavaScript !-- hide js code function infoscroll(seed,looped) { dont need to bore u with the rest of the body script!!! } // end js code -- !-- infoscroll(100,1) // -- /script cheers chuck -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.
RE: User management?
Hi, thanks a lot for your response. --- Jon.Ridgway [EMAIL PROTECTED] wrote: Hi, User management is a tricky one, have you looked at form base authentication? See Section 11.5.3 of the Servlet 2.2 spec. Yes,I have looked at form base authentication and section 11.5.3 of servlet 2.2 spec. This works with most containers, but the setup mechanism will be different. What container are you using? I use tomcat. You may still wish to create a user object based on info looked up, you would have to code this and place it in a session. It is the problem.Although tomcat provides methods to do authentication,we have code much to store user data.If your web side need many collaboration features,it will be a hard work. May be there is some way to make this more easy when building web applications with struts? __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Form with request scope
I am trying to create a form which has request scope, so that it can be autopopulated when the form is displayed. However, when I go to the jsp the fields are not filled in and if I put debug statements in FormTag.doStartTag() I realize that the form is tied to a session scope. The following is the code I am using. Any thoughts? %@page language=java % %@taglib uri=/WEB-INF/struts-html.tld prefix=html % %@taglib uri=/WEB-INF/struts-bean.tld prefix=bean % html:form name=frmVendor action=processN1.do scope=request type =com.aholdusa.struts.view.N1Form html:errors / TABLE border=0 cellPadding=1 cellSpacing=1 id=smallfont TR TD colspan=2H1 class=blackVENDOR INFORMATION/H1/TD /TR /tableBR table id=smallfont tr td id=captionbar colspan=4Company Information/td /trTR TDVENDOR NUMBER/TD TDhtml:text property=vendorNumber maxlength=11 size=11 //TD /TRTR TDA/P NUMBER/TD TDhtml:text property=apNumber maxlength=11 size=11 //TD /TRTR TDCOMPANY NAME/TD TDhtml:text property=companyName maxlength=75 size=75 //TD/tr /tableBR table id=smallfont tr td id=captionbar colspan=6Contact Information/td /trTR valign=bottom TD valign=centerCONTACT FIRST NAME/TD TD colspan=5html:text property=contactFirstName maxlength =36 size=75 //TD /TRTR TD valign=centerCONTACT LAST NAME/TD TD colspan=5html:text property=contactLastName maxlength =36 size=75 //TD /TRTR TDADDRESS/TD TD colspan=5html:text property=vendorStreetAddress1 maxlength=36 size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCSTREET ADDRESS LINE 1/FONT/TD /TRTR TD/TD TD colspan=5html:text property=vendorStreetAddress2 maxlength=36 size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCSTREET ADDRESS LINE 2/FONT/TD /TRTR TD/TD TDhtml:text maxlength=35 property=vendorCity size=36 //TD TDhtml:text maxlength=3 property=vendorState size=3 //TD TDhtml:text maxlength=7 property=countryCode size=7 value=USA //TD TDhtml:text maxlength=10 property=vendorZip size=10 //TD /TRTR TD/TD TDFONT ID=DESCCITY/FONT/TD TDFONT ID=DESCREGION/STATE/FONT/TD TDFONT ID=DESCCOUNTRY/FONT/TD TDFONT ID=DESCPOSTAL CODE/FONT/TD /TRTR TDPHONE/TD TD colspan=5html:text maxlength=12 property=vendorPhone size=12 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCXXX-XXX-/FONT/TD /TRTR TDEMAIL/TD TD colspan=5html:text maxlength=128 property =vendorEmailAddress size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESC[EMAIL PROTECTED]/FONT/TD /TR TR TDITEM LEAD TIME (IN DAYS)/TD TD colspan=5html:text property=poFloat size=2 maxlength =2 / html:text property=busDays value=BUSINESS DAYS //TD /TR /TABLE /html:form
RE: Can you do this with internationalisation.
If you check out http://developer.bluestone.com (look under demos - internationalization), you will see a sample application that does essentially what you want to do. The application has been localized to Spanish, Chinese and English. The language is selectable in a drop down. In addition, your language preference can be set in your user profile as well as detected through your browser preferences (ACCEPT_LANGUAGE header). The source is also available for download. Erik PS - we don't use flags for the reason outlined by Craig. -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 09, 2001 7:42 PM To: Struts Subject: Re: Can you do this with internationalisation. On Thu, 7 Jun 2001, Alex Colic wrote: Hi, my boss wants me to set up one of my apps written using struts for a demo. He wants to have a web page with a couple of flags. The use clicks on of the flags and enters the program using the language they selected. Not having gone down this road before any idea what that would entail. I know I would have to create multiple localisation files for the languages. But how do I specify for each user what file to use and can you have multiple users all accessing your program concurrently viewing it in different languages. Some insight into the above is appreciated. Alex The technical information on how to do this (modify the Locale in the user's session) is correct -- I just wanted to make a social comment on your boss's request. When I built an app in Europe a couple of years ago (which is where a lot of the basic ideas for Struts came from :-), I was told that the use of flags to select languages was pretty offensive to people living in countries that were officially multilingual -- such as Belgium, where large portions of the population speak Dutch and French. Using flags for The Netherlands and France would not really have been appropriate. I ended up using a little SELECT element listing all of the languages that were supported by the app, with a little JavaScript onchange handler that submitted it whenever a change was made. This also took lots less space on the screen. Craig McClanahan
Changing UI
Hi all I have created a project with Struts and now I want to change the User Interface of the jsp files in it. I want to change the positions of the components like label, textfields, combo boxes and their foreground and background colors. If I had not used struts, then I would have changed the UI in Dreamweaver which is very fast and quick. But now the jsp content is in html custom library tags of Struts. How can I change the UI in a fast and efficient way without going to the code of each and every jsp. Any ideas ??? Thanks Satish
Making over Half Million Dollars every 4 to 5 Months from your Home!!!
AS SEEN ON NATIONAL TV:Making over Half Million Dollars every 4 to 5 Months from your Home for an investment of only$25 U.S. Dollars expense one timeTHANK'S TO THE COMPUTER AGE AND THE INTERNET!==BE A MILLIONAIRE LIKE OTHERS WITHIN A YEAR!!!Before you say ''Bull'', please read the following.This is the letter you have been hearing about on the news lately. Due to the popularityof this letter on the Internet, a national weekly news program recently devoted an entireshow to the investigation of this program described below, to see if it really can makepeople money. The show also investigated whether or not the program was legal. Their findingsproved once and for all that there are ''absolutely NO Laws prohibiting the participation inthe program and if people can follow the simple instructions, they are bound to make somemega bucks with only $25 out of pocket cost''. DUE TO THE RECENT INCREASE OF POPULARITY RESPECT THIS PROGRAM HAS ATTAINED, IT IS CURRENTLY WORKING BETTER THAN EVER.This is what one had to say: ''Thanks to this profitable opportunity. I was approached many times beforebut each time I passed on it. I am so glad I finally joined just to see what one could expectin return for the minimal effort and money required. To my astonishment, I receivedtotal $610,470.00 in 21 weeks, with money still coming in." Pam Hedland, Fort Lee, New Jersey.===Here is another testimonial: "This program has been around for a long time but I never believedin it. But one day when I received this again in the mail I decided to gamble my $25 on it. Ifollowed the simple instructions and 3 weeks later the money started to come in.First month I only made $240.00 but the next 2 months after that I made a total of $290,000.00.So far, in the past 8 months by re-entering the program, I have made over $710,000.00 and I amplaying it again. The key to success in this program is to follow the simple steps and NOT changeanything.'' More testimonials later but first,= PRINT THIS NOW FOR YOUR FUTURE REFERENCE ==$If you would like to make at least $500,000 every 4 to 5 months easily And comfortably, pleaseread the following...THEN READ IT AGAIN and AGAIN!!!$FOLLOW THE SIMPLE INSTRUCTION BELOW AND YOUR FINANCIAL DREAMS WILL COME TRUE,GUARANTEED!INSTRUCTIONS:=Order all 5 reports shown on the list below =For each report, send $5 CASH, THE NAME NUMBER OF THE REPORT YOU ARE ORDERING andYOUR E-MAIL ADDRESS to the person whose name appears ON THAT LIST next to the report.MAKE SURE YOUR RETURN ADDRESS IS ON YOUR ENVELOPE TOP LEFT CORNER in case of any mailproblems.=== When you place your order, make sure you order each of the 5 reports.You will need all 5 reports so that you can save them on your computer and resell them.YOUR TOTAL COST $5 X 5=$25.00.Within a few days you will receive, vie e-mail, each of the 5 reports from these 5 different individuals.Save them on your computer so they will be accessible for you to send to the 1,000's of peoplewho will order them from you. Also make a floppy of these reports and keep it on your desk incase something happen to your computer.IMPORTANT - DO NOT alter the names of the people who are listed next to each report, ortheir sequence on the list, in any way other than what is instructed below in step'' 1 through 6 '' or you will lose out on majority of your profits. Once you understandthe way this works, you will also see how it does not work if you change it. Remember, thismethod has been tested, and if you alter, it will NOT work !!! People have tried to put theirfriends/relatives names on all five thinking they could get all the money. But it does notwork this way. Believe us, we all have tried to be greedy and then nothing happened. So Do Nottry to change anything other than what is instructed. Because if you do, it will not work foryou. Remember, honesty reaps the reward!!!1 After you have ordered all 5 reports, take this advertisement and REMOVE thename address of the person in REPORT # 5. This person has made it through the cycle andis no doubt counting their fortune.2 Move the name address in REPORT # 4 down TO REPORT # 5.3 Move the name address in REPORT # 3 down TO REPORT # 4.4 Move the name address in REPORT # 2 down TO REPORT # 3.5 Move the name address in REPORT # 1 down TO REPORT # 26 Insert YOUR name address in the REPORT # 1 Position.PLEASE MAKE SURE you copy every name address ACCURATELY!== Take this entire letter, with the modified list of names, and save it on your computer.DO NOT MAKE ANY OTHER CHANGES.Save this on a disk as well just in case you lose any data. To assist you with
RE: Form with request scope
The scope in which the ActionForm class is placed is defined by the *scope* attribute of the action mapping within struts-config.xml. The following should work, but I don't know if it's what you're after. In struts-config.xml form-bean name=frmVendor type=com.aholdusa.struts.view.N1Form/ and action path=/processN1.do type=your.action.Type name=frmVendor scope=request validate=true input=yourInput.jsp/action and then in the form tag, just do htm:form action=/processN1.do HTH Dave -Original Message- From: Timothy Hicks [mailto:[EMAIL PROTECTED]] Sent: 11 June 2001 13:10 To: [EMAIL PROTECTED] Subject: Form with request scope I am trying to create a form which has request scope, so that it can be autopopulated when the form is displayed. However, when I go to the jsp the fields are not filled in and if I put debug statements in FormTag.doStartTag() I realize that the form is tied to a session scope. The following is the code I am using. Any thoughts? %@page language=java % %@taglib uri=/WEB-INF/struts-html.tld prefix=html % %@taglib uri=/WEB-INF/struts-bean.tld prefix=bean % html:form name=frmVendor action=processN1.do scope=request type =com.aholdusa.struts.view.N1Form html:errors / TABLE border=0 cellPadding=1 cellSpacing=1 id=smallfont TR TD colspan=2H1 class=blackVENDOR INFORMATION/H1/TD /TR /tableBR table id=smallfont tr td id=captionbar colspan=4Company Information/td /trTR TDVENDOR NUMBER/TD TDhtml:text property=vendorNumber maxlength=11 size=11 //TD /TRTR TDA/P NUMBER/TD TDhtml:text property=apNumber maxlength=11 size=11 //TD /TRTR TDCOMPANY NAME/TD TDhtml:text property=companyName maxlength=75 size=75 //TD/tr /tableBR table id=smallfont tr td id=captionbar colspan=6Contact Information/td /trTR valign=bottom TD valign=centerCONTACT FIRST NAME/TD TD colspan=5html:text property=contactFirstName maxlength =36 size=75 //TD /TRTR TD valign=centerCONTACT LAST NAME/TD TD colspan=5html:text property=contactLastName maxlength =36 size=75 //TD /TRTR TDADDRESS/TD TD colspan=5html:text property=vendorStreetAddress1 maxlength=36 size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCSTREET ADDRESS LINE 1/FONT/TD /TRTR TD/TD TD colspan=5html:text property=vendorStreetAddress2 maxlength=36 size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCSTREET ADDRESS LINE 2/FONT/TD /TRTR TD/TD TDhtml:text maxlength=35 property=vendorCity size=36 //TD TDhtml:text maxlength=3 property=vendorState size=3 //TD TDhtml:text maxlength=7 property=countryCode size=7 value=USA //TD TDhtml:text maxlength=10 property=vendorZip size=10 //TD /TRTR TD/TD TDFONT ID=DESCCITY/FONT/TD TDFONT ID=DESCREGION/STATE/FONT/TD TDFONT ID=DESCCOUNTRY/FONT/TD TDFONT ID=DESCPOSTAL CODE/FONT/TD /TRTR TDPHONE/TD TD colspan=5html:text maxlength=12 property=vendorPhone size=12 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCXXX-XXX-/FONT/TD /TRTR TDEMAIL/TD TD colspan=5html:text maxlength=128 property =vendorEmailAddress size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESC[EMAIL PROTECTED]/FONT/TD /TR TR TDITEM LEAD TIME (IN DAYS)/TD TD colspan=5html:text property=poFloat size=2 maxlength =2 / html:text property=busDays value=BUSINESS DAYS //TD /TR /TABLE /html:form 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 ***
more template:include/ questions
One of the problems I'm having with template:include/ and probably more with the XML nature of JSP is that html:XXX form elements have to be within html:form/html:form tags, and no in an include used by template:include/. I have common components that different forms use, but have to do either a cut-n-paste(tm) or use %@ include ... % instead? Any thoughts? -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
RE: How to use struts in the weblogic5.1
I had problemswith wls sp8. It worked with sp9. I'm using struts beta3. -Original Message-From: zhongqing [mailto:[EMAIL PROTECTED]]Sent: Thursday, June 08, 2000 11:34 PMTo: [EMAIL PROTECTED]Subject: How to use struts in the weblogic5.1 can somebody share some experiences in using struts in the weblogic5.1?
Re: Changing UI
Hi Satish, You can easily change the colors and the cells alignment by using different CSS files. HTH, Jean-Noël - Original Message - From: Satish Khanzode [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 11, 2001 2:11 PM Subject: Changing UI Hi all I have created a project with Struts and now I want to change the User Interface of the jsp files in it. I want to change the positions of the components like label, textfields, combo boxes and their foreground and background colors. If I had not used struts, then I would have changed the UI in Dreamweaver which is very fast and quick. But now the jsp content is in html custom library tags of Struts. How can I change the UI in a fast and efficient way without going to the code of each and every jsp. Any ideas ??? Thanks Satish
Re: HOW TO INCLUDE JAVASCRIPT FILE.js in your struts jsp page?
Hi, have i got to create a JavaScript (Resource Folder) at the same level as Cascade Style Sheets, thus each JavaScript code to be named separatly and given a .js extension, in order to include in .jsp pages. ie script language ="JavaScript" src="javascript(Resource Folder)/WindowScroll.js"> /script> Cheers Chuck# Satish Khanzode wrote: Thanks -Original Message- From: Chuck Amadi [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 4:37 PM To: Satish Khanzode Subject: Re: HOW TO INCLUDE JAVASCRIPT FILE.js in your struts jsp page? Hi , As requseted . !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> %@ page contentType="text/html"%> %@ page language ="java" %> %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> %@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> %@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %> html> !--Below is a JSP expression that is not hidden from browser--> !-- JSP Name:index.jsp Written by Chuck Amadi IT Systems Programmer.This page was executed on %=new java.util.Date()%>--> head> title>Brecon Beacons National Park/title> body background="#ff"> meta name="generator" content="Brecon Beacons National Park Authority site generator"> meta name="keywords" content="brecon beacons national park recreation travel walking climbing access"> !-- reference standard bbnpa cascade style sheet --> link rel="stylesheet" href="css/bbnpa.css" charset="ISO-8859-1" type="text/css"> script LANGUAGE="JavaScript"> // create scrolling status window function infoscroll(seed,looped) { var text1 = " W E L C O M E T O BRECON BEACONS NATIONAL PARK AUTHORITY PARC CENEDLAETHOL BANNAU BRYCHEINIOG. The Brecon Beacons National Park has some of the finest landscape in Wales. These walks and activities have been designed to help you discover this wonderful countryside around you. !!"; var text2 = " N O W OPEN TO THE PUBLIC "; var msg=text1+text2; var putout = " "; var c = 1; if (looped > 10) { window.status="Brecon Beacons National Park Authority - Parc Cenedlaethol Bannau Bryncheiniog"; } else if (seed > 100) { seed--; var cmd="infoscroll(" + seed + "," + looped + ")"; timerTwo=window.setTimeout(cmd,100); } else if (seed = 100 seed > 0) { for (c=0 ; c seed ; c++) { putout+=" "; } putout+=msg.substring(0,100-seed); seed--; var cmd="infoscroll(" + seed + "," + looped + ")"; window.status=putout; timerTwo=window.setTimeout(cmd,100); } else if (seed = 0) { if (-seed msg.length) { putout+=msg.substring(-seed,msg.length); seed--; var cmd="infoscroll(" + seed + "," + looped + ")"; window.status=putout; timerTwo=window.setTimeout(cmd,100); // 100 } else { window.status=" "; looped += 1; var cmd = "infoscroll(100," + looped + ")"; timerTwo=window.setTimeout(cmd,75); // 75 } } } // --> !-- infoscroll(100,1) // --> /script> /head> div class=textNav> [home] [up] a href="sitemap.jsp">[map]/a> a href="news.jsp">[news]/a> a href="contact.jsp">[contact]/a> a href="cym-index.jsp">[cymraeg]/a> a href="help.jsp">[help]/a> /div> img src="../css/graphics/bbnpahead.png" alt="Brecon Beacons National Park"> img src="../css/graphics/minibus.jpg" align="right" alt="Beacons Bus Service"> div class=storyWarning> Foot and mouth - see a href="fandm/index.jsp">here/a> for latest information /div> div class=storyContent> Beacons Bus / Bws y Bannau - service starts May 28th - advance details a href="bbus/index.jsp">here/a> p>National Park Visitor Centre, Libanus (Mountain Centre) is still CLOSED p>a href="fandm/visit.jsp">Places/a> you CAN visit and walks you CAN do! (updated with phone nos.) p>Volunteers' Newsletter a href="files/volnews1-01.pdf">Spring 2001/a> now available for download (320KB - PDF format) br>New National Park Officer appointed. Christopher Gledhill joins the Authority from the Clyde Muirshiel Regional Park, Renfrewshire in Scotland - see a href="pressrel/index.jsp#newnpo">press release/a> br>See a href="jobs/index.jsp">jobs/a> /div> div class=index> ul> li>a href="english/introduction.jsp">Introduction to the Park/a> li>a href="archaeology/index.jsp">Archaeology/a> li>a href="english/education-index.jsp">Education/a> li>a href="english/parkman-index.jsp">Park Management/a>,a href="english/wardens-index.jsp"> Warden Services/a> a href="english/wardens-volunteer.jsp">Volunteers/a> li>a href="english/planning-index.jsp">Planning/a> li>a href="english/commdevt-index.jsp">Community Development/a> li>a href="english/visitor-index.jsp">Corporate Services/a> li>a href="english/todo-index.jsp">Things to do in the Park/a> li>a href="english/resources-index.jsp">Free Resources Gallery/a> li>a href="english/kids-index.jsp">Kids Stuff!/a> li>a href="english/publications-index.jsp">Publications by post/a> li>a href="jobs/index.jsp">Job Opportunities/a> li>a href="pressrel/index.jsp">Press Releases/a> li>a href="links.jsp">Links to other
RE: User management?
Hi, You seem to facing the same problem that I am. I'm using tomcat to do form based auth. This way I can take advantage of container security features and use the struts role based templating. I invoke the form based auth by invoking an action class within a secured area. This way the user logs in then I collect user data/preferences etc from my db. There doesn't appear to be anything in struts that can help. Does anyone have a better way, i.e. extending tomcat login class, JAAS etc. What I'm really after is a mechanism that will work with all containers. Jon. -Original Message- From: Pan Li [mailto:[EMAIL PROTECTED]] Sent: 11 June 2001 13:01 To: [EMAIL PROTECTED] Subject: RE: User management? Hi, thanks a lot for your response. --- Jon.Ridgway [EMAIL PROTECTED] wrote: Hi, User management is a tricky one, have you looked at form base authentication? See Section 11.5.3 of the Servlet 2.2 spec. Yes,I have looked at form base authentication and section 11.5.3 of servlet 2.2 spec. This works with most containers, but the setup mechanism will be different. What container are you using? I use tomcat. You may still wish to create a user object based on info looked up, you would have to code this and place it in a session. It is the problem.Although tomcat provides methods to do authentication,we have code much to store user data.If your web side need many collaboration features,it will be a hard work. May be there is some way to make this more easy when building web applications with struts? __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
Re: XML Namspace Problem
Hello Sunil, You must place struts.jar to the WEB-INF/lib directory and cut it from CLASSPATH. And try to install latest jaxp1.1. Monday, June 11, 2001, 8:36:31 AM, you wrote: SPS Hi group, SPS I am trying to using the struts framework and trying to run one example. SPS I am getting the following problem. SPS org.xml.sax.SAXException: Namespace not supported by SAXParser SPS at SPS org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(Transform SPS erFactoryImpl.java:714) SPS at SPS org.apache.xalan.processor.TransformerFactoryImpl.newTransformer(Transfo SPS rmerFactoryImpl.java:601) SPS at XSLView.transform(XSLView.java:26) SPS at FileListingView.perform(FileListingView.java:37) SPS at SPS org.apache.struts.action.ActionServlet.processActionPerform(ActionServle SPS t.java:1775) SPS at SPS org.apache.struts.action.ActionServlet.process(ActionServlet.java:1574) SPS at SPS org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:490) SPS at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) SPS at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) SPS at SPS org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) SPS at org.apache.tomcat.core.Handler.service(Handler.java:286) SPS at SPS org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) SPS at SPS org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcher SPS Impl.java:194) SPS What could be the problem.. All the required jars are in the CLASSPATH.. SPS Please let me know at the earliest. SPS Regards, SPS sunil -- Best regards, Olegmailto:[EMAIL PROTECTED]
Thanks for all the internationalisation help.
Hi, Sorry I have not thanked everyone for all their help. Using everyone's suggestions I have created a web page which allows a user to select a different language for my web app. Once again thanks all. Alex
Is there a JavaScript extension for jsp ContentType=text\
To Ted Husted - Hi, have i got to create a JavaScript (Resource Folder) at the same level as Cascade Style Sheets, thus each JavaScript code to be named separatly and given a .js extension, in order to include in .jsp pages. ie script language ="JavaScript" src="javascript(Resource Folder)/WindowScroll.js"> /script> Thus is there a context declartion for javascript %ContextType="text\javascript" %> Cheers Chuck# Satish Khanzode wrote -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilwch bob copi.
RE: Changing UI
Hi Satish, It is possible to use struts with Dreamweaver UltraDev. I think details have been posted on this list in the past. See http://www.mail-archive.com/struts-user@jakarta.apache.org/ You might also want to look at the struts template tags. See the struts-template example provided with Struts. This simplifies layout changes etc. Jon. -Original Message- From: Satish Khanzode [mailto:[EMAIL PROTECTED]] Sent: 11 June 2001 13:11 To: '[EMAIL PROTECTED]' Subject: Changing UI Hi all I have created a project with Struts and now I want to change the User Interface of the jsp files in it. I want to change the positions of the components like label, textfields, combo boxes and their foreground and background colors. If I had not used struts, then I would have changed the UI in Dreamweaver which is very fast and quick. But now the jsp content is in html custom library tags of Struts. How can I change the UI in a fast and efficient way without going to the code of each and every jsp. Any ideas ??? Thanks Satish
help with embedding javascript within jsp.
Hi, Satish regarding your javascript , i assume that you created a javascript resource file and beaneath this file is CansysScript.js . Thus I am using Netbeans IDEv3.2 and tomact container i am not aware or know how you create a javascript extension also the fact i have always embedded my javascript code within the Head or Body depending on circumstances , and haven't required to create a javascript extension as JS is html embedded until your email. Sorry 4 keeping on but 2day i have tried everything 2 no avail. Regards Chuck. -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.
Re: User management?
Jon What is struts role based templating? Sounds good but I am not familiar with the technique. Thanks Tom Miller Jon.Ridgway wrote: Hi, You seem to facing the same problem that I am. I'm using tomcat to do form based auth. This way I can take advantage of container security features and use the struts role based templating. I invoke the form based auth by invoking an action class within a secured area. This way the user logs in then I collect user data/preferences etc from my db. There doesn't appear to be anything in struts that can help. Does anyone have a better way, i.e. extending tomcat login class, JAAS etc. What I'm really after is a mechanism that will work with all containers. Jon.
Pre populate
I need to pre-populate my form and do some business processes prior to load a page. Where would be the best place for this. I don't want to put it in the peform method of the from page. And doing business process at the form bean does not seen appropriate. thanks
Hacking HTML forms
Hello, I have created a javascript widget which lets users move options from one multi-select to another as input to a search. For example they can select one or many hardcoded options in an allowed select box and then click on an arrow to move the selected options into the selected-for-this-search select box. Just before the form is submitted, I also select all the options in all the selected-for-this-search boxes so that they are submitted. My question is, can Struts support this? From the messages on this list it seems like multi-select box values need to be kept in an Array but I think mine need to be in a HashMap thanks, matt.
Session handling with wml
I'm trying to get struts working with wml. Everything works fine beside the fact, that struts always thinks it is able to place a cookie at the browser (Nokia 6210). This seems not to be working, as nothing keeps stored in session. I can't reproduce this error with the blueprint from Nokia Toolkit, even if cookies are deactivated. Manual URL-encoding has no effect, as the session-id is never added to url if a cookie was set... Anybody solved similar problem? Thanx,Maik.
Re: more template:include/ questions
Hi, I think that inserting Components or Templates using html:xxx within html:form/html:form should work. For this to be possible, html:XXX tags should use request context rather than page context to store/pass bean. I have read in previous mails that all html:xxx tags are in the process to be changed in order to use request context. May be some are not fully changed, or may be you use an old Struts library ? Cedric Jim Richards wrote: One of the problems I'm having with template:include/ and probably more with the XML nature of JSP is that html:XXX form elements have to be within html:form/html:form tags, and no in an include used by template:include/. I have common components that different forms use, but have to do either a cut-n-paste(tm) or use %@ include ... % instead? Any thoughts? -- Kumera - a new Open Source Content Management System for small to medium web sites written in Perl and using XML http://www.cyber4.org/kumera/index.html
RE: User management?
Hi Tom, Struts provides the template tag, one of the options for this tag is 'role'. This uses request.isUserInRole (). User roles are setup by the containers security mechanism. I haven't found a way to programmatically set user roles. So if you want to use the 'role' option of the struts template tag you have to use container based security. See http://jakarta.apache.org/struts/api/org/apache/struts/taglib/template/packa ge-summary.html#package_description and http://jakarta.apache.org/struts/struts-template.html for further details. Jon -Original Message- From: Tom Miller [mailto:[EMAIL PROTECTED]] Sent: 11 June 2001 14:51 To: [EMAIL PROTECTED] Subject: Re: User management? Jon What is struts role based templating? Sounds good but I am not familiar with the technique. Thanks Tom Miller Jon.Ridgway wrote: Hi, You seem to facing the same problem that I am. I'm using tomcat to do form based auth. This way I can take advantage of container security features and use the struts role based templating. I invoke the form based auth by invoking an action class within a secured area. This way the user logs in then I collect user data/preferences etc from my db. There doesn't appear to be anything in struts that can help. Does anyone have a better way, i.e. extending tomcat login class, JAAS etc. What I'm really after is a mechanism that will work with all containers. Jon.
Re: forward attribute
Hello rajiv, Monday, June 11, 2001, 3:35:13 PM, you wrote: rm How do i forward attributes from Action class, which can be rm accessed in the jsp page. so that specific error can be displayed rm mapping.findForward(failure); rm forward name=failure path=/examp/logon.jsp / Add redirect attribute to the forward mapping to avoid true jump to the forward page - forward name=failure path=/examp/logon.jsp redirect=false/ In Action class create objects, store it in request context and return forward to the failure page. In failure page you can access all stored early objects via bean-access tags - struts related or jsp:useBean. -- Best regards, Olegmailto:[EMAIL PROTECTED]
Re: Where should I use .do and where .jsp for the same file
Hello Eda, Monday, June 11, 2001, 11:39:58 AM, you wrote: ESE Hi ESE Here is a small doubt. Please inform me where should I call a ESE file with .do extension and where should I call the same file ESE with .jsp extension. *.do is not file - web.xml maps all requests to this extension to the ActionServlet. ActionServlet uses information from struts-config to process such request and uses to this purpose Action classes - actionpath=/news type=com.sv.action.BaseViewAction/ Each Action class contains perform method. ActionServlet call this one and it returns ActionForward class to switch to appropriate page (*.jsp) to display result of processing or error page or another purpose page. Another words - *.do is mapping to the Action class to perform some activity at server and *.jsp is view to display result of such activity. -- Best regards, Olegmailto:[EMAIL PROTECTED]
RE: Pre populate
I do the following: 1. Let us say, you want to submit from 'fromPage' and want to do some pre-processing before you give out 'toPage'. 2. In all my Action objects, I have two methods - 'preprocess()' and 'postprocess()'. 3. I submit ALL the requests from 'fromPage' to the Action object corresponding to fromPage. Here, I do the postprocessing. In this, I update the beans (application state) using submitted form object. 4. Then I forward request to the Action object corresponding to the 'toPage'. 5. Here I do the preprocessing, in which I update the formBean corresponding to toPage using the business beans (application state) - this is like pre-population that you are referring to. 6. Now, I pass the control to the toPage.jsp. This uses the formObject pre-populated in earlier step. Hope this helps. Sujit -Original Message- From: Kiet Nguyen [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 10:06 AM To: Struts-User (E-mail) Subject: Pre populate I need to pre-populate my form and do some business processes prior to load a page. Where would be the best place for this. I don't want to put it in the peform method of the from page. And doing business process at the form bean does not seen appropriate. thanks
Re: Logic-Iterate not finding scope of Bean - bean:write error ???
Hi all, I have the same goal of Kat Luna.. and I have the same syntax. But for me, I think that the error come from the bean:write tag. This tag don't find the scope of the bean and then don't find the bean. I really don't know what I have to do.. I don't think so that use the standard jsp method is MVC compliant. Please is there a solution ? Thanks in advance, Geoffrey... - Original Message - From: Charlesworth, Chico [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 08, 2001 4:54 PM Subject: RE: Logic-Iterate not finding scope of Bean you can also have two separate action classes that use the same form, where you use the first action class when you first go into that page, then use the second when you are submitting or whatever in the form -Original Message- From: Luna, Kat [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 7:58 PM To: [EMAIL PROTECTED] Subject: Logic-Iterate not finding scope of Bean Hi all, me again with my afternoon question.. I have a UserAction class that extracts a list of Users from the database and stores them in an ArrayList. Success from this Action forwards to user.jsp which I want to display the list in table format. I have: %@ page language=java % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % html:html headtitle/title /head body table logic:iterate id=user name=UserAction property=userList type=com.test.User TR TDbean:write name=user property=username//TD TDbean:write name=user property=password//TD /TR /logic:iterate ..etc but this causes the UserAction to run again (essentially calling the database and building the ArrayList again). Is there a way to have this bean init() when the jsp page loads and then iterate through the ArrayList instead of calling the Action first and then displaying the page? And if so, do I need to add anything to struts-config.xml to tell the page where to find/identify the UserAction bean? Thanks, Kat Luna Web Developer, BCE Emergis [EMAIL PROTECTED] -- The content of this e-mail is confidential, may contain privileged material and is intended solely for the recipient(s) named above. If you receive this in error, please notify Software AG immediately and delete this e-mail. Software AG (UK) Limited Registered in England Wales 1310740 Registered Office: Hudson House, Hudson Way, Pride Park, Derby DE24 8HS
Re: Problem With Struts and Tomcat
Dan, Ok, I'll try that (even though I ordered 3.5.3but it'll be a while before I get it). Do you have the title of the article for integrating 3.2.1 into VAJ on VADD? The thing I'm curious about is in the IBM Tomcat Integration bundle, IBM has a Runner class that handles Tomcat startup and everything. Is it possible to use the 3.1.X runner (just tweak it for 3.2.1?) thereby pointing it at the new version? I haven't tried this Just a thought. -Tom Dan Miser [EMAIL PROTECTED] To: [EMAIL PROTECTED] com cc: Subject: Re: Problem With Struts and Tomcat 06/09/2001 11:10 AM Please respond to struts-user You don't *need* VAJ 3.5.3 to run 3.2.1. Of course, you need to do things yourself as opposed to using the IBM Tomcat integration offering. If you have specific problems with your config, post them here and I should be able to help out. Also, there's an article on VADD that outlines most of the things you need to do for Struts integration with VAJ. -- Dan Miser http://www.distribucon.com - Original Message - From: Thomas L Richards [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 08, 2001 4:47 PM Subject: Re: Problem With Struts and Tomcat I'm downloading Tomcat 3.2.1 now (can't get 3.2.2 for VAJ yet). Unfortunately, as it turns out, I need to upgrade VAJ to 3.5.3 since Tomcat 3.2.X won't work with VAJ 3.5.2. Go figure.
Re: Dynamic action mapping
Hi, I am looking for a way to invoke different Actions from one form depending on the button clicked by the user. Is there a simple way of configuring Struts to do this? not a very simple way. But you can write a dispatcher action that forwards to different actions depending on a request parameter. Ciao Thomas -- Machen Sie Ihr Hobby zu Geld bei unserem Partner 11! http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
Re: Pre populate
Many times pre-processing and post-processing are related, and it can be convenient to handle both in the same Action class. A good way to implement this is to have a seperate Action Mapping for each task (pre-process and post-process). Both mappings would point to the same Action but use different (virtual) paths. Like say /account/setup/pre and /account/setup/post . These may both use the same Action class, which could be package/account/setup.java . The Struts mappings accept an extra parameter property that you can easily test in the Action to see which mapping has been chosen. Your action can then process each task differently, and even go to separate locations if successfuly. By managing this all in the struts-config.xml, you gain a lot of flexbility. In struts-config: action path=/account/setup/pre type=package.account.Setup.java name=setupForm scope=request validate=false input=/WEB-INF/jsp/account/setup/Form.jsp parameter=pre forward name=success path=/WEB-INF/jsp/account/setup/Form.jsp/ /action action path=/account/setup/post type=package.account.Setup.java name=setupForm scope=request validate=true input=/WEB-INF/jsp/setup/Form.jsp parameter=post forward name=success path=/WEB-INF/jsp/account/setup/View.jsp/ /action In your Action: String task = mapping.getParameter(); // handle task for pre or task for post // ... // ... return (mapping.findForward(success)); -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/ Kiet Nguyen wrote: I need to pre-populate my form and do some business processes prior to load a page. Where would be the best place for this. I don't want to put it in the peform method of the from page. And doing business process at the form bean does not seen appropriate.
checkLogon issue, and ActionError substitution problem...
I'm trying to figure out how to pass a constant name/page to the example checkLogon tag. I created a Constants class, with - public final static String STAFF_LOGIN_KEY = test:staffloggedin; in my jsp I put - app:checkLogon name=% Contants.STAFF_LOGIN_KEY % / The issue is that it sets name in the checkLogon tag to the string % Contants.STAFF_LOGIN_KEY % not the value of that scriptlet (stafflogon.jsp). Any ideas? Also, I am trying to do substitution on an action error with the following - errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.login, test)); When this runs, the error message is - Login Error: [Ljava.lang.Object;@158bf9 Instead of Login Error: test This is with Struts 1.0B3. Thanks, Ryan Newbie Ryan Cornia Programmer Analyst Department of Community and Economic Development State of Utah
Re: Session handling with wml
On Mon, 11 Jun 2001 [EMAIL PROTECTED] wrote: I'm trying to get struts working with wml. Everything works fine beside the fact, that struts always thinks it is able to place a cookie at the browser (Nokia 6210). This seems not to be working, as nothing keeps stored in session. I can't reproduce this error with the blueprint from Nokia Toolkit, even if cookies are deactivated. Manual URL-encoding has no effect, as the session-id is never added to url if a cookie was set... Anybody solved similar problem? Thanx,Maik. In most servlet containers, you can turn off the use of cookies for session maintenance -- check the docs for your container on how. For URL rewriting to work, you need to remember the following: * You must URL-rewrite (i.e. call response.encodeURL()) every single hyperlink in the application. With Struts, the html:form and html:link tags do this for you automatically. * You must ensure that a session is created before the response is committed back to the client. In general, that means be sure that you call request.getSession() -- or call a JSP page -- before the first buffer-full of output has been committed. Craig
Re: Hacking HTML forms
On Mon, 11 Jun 2001, McShane, Matthew wrote: Hello, I have created a javascript widget which lets users move options from one multi-select to another as input to a search. For example they can select one or many hardcoded options in an allowed select box and then click on an arrow to move the selected options into the selected-for-this-search select box. Just before the form is submitted, I also select all the options in all the selected-for-this-search boxes so that they are submitted. My question is, can Struts support this? From the messages on this list it seems like multi-select box values need to be kept in an Array but I think mine need to be in a HashMap thanks, matt. In principle, it *should* still work with an array. The key is that your setter method should take a String array as the arg: public void setSelectResults(String selectResults[]) and Struts will then accumulate all of the options that were actually selected into a String array and call this setter for you. Because it's a new array, there is no requirement that the number of selected items be the same (or anything like that). Struts does not really care what happens on the client side before the submit (which is where your JavaScript manipulations to implement the above takes place). Craig
Re: checkLogon issue, and ActionError substitution problem...
Craig - I had tried it as a runtime expression (and just tried it again) - app:checkLogon name="%= Constants.STAFF_LOGIN_KEY %" / but get the same result?!? If I put a system.out.println in the doEndTag of checkLogon, it prints name = "%= Constants.STAFF_LOGIN_KEY %". This is with Tomcat 3.2 if that matters. On the other problem, in the resource file I have - error.login=libLogin Error: {0}/b/li Is that the correct syntax? Thanks, Ryan [EMAIL PROTECTED] 06/11/01 10:38AM On Mon, 11 Jun 2001, Ryan Cornia wrote: I'm trying to figure out how to pass a constant name/page to the example checkLogon tag. I created a Constants class, with - public final static String STAFF_LOGIN_KEY = "test:staffloggedin"; in my jsp I put - app:checkLogon name="% Contants.STAFF_LOGIN_KEY %" /" You need to use a runtime expression instead: app:checkLogon name="%= Constants.STAFF_LOGIN_KEY %" / ^ | | The issue is that it sets name in the checkLogon tag to the string " % Contants.STAFF_LOGIN_KEY %" not the value of that scriptlet ("stafflogon.jsp"). Any ideas? Also, I am trying to do substitution on an action error with the following - errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.login", "test")); When this runs, the error message is - "Login Error: [Ljava.lang.Object;@158bf9 " Instead of "Login Error: test" This is with Struts 1.0B3. What does the message format string named "error.login" look like? Thanks, Ryan "Newbie" Ryan Cornia Programmer Analyst Department of Community and Economic Development State of Utah Craig McClanahan
RE: Hacking HTML forms
but what about when i get sent back to the form (perhaps from a validation error). How will the selected select box repopulate itself if all it has to go on are the Strings in the associated array? matt. -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 12:35 PM To: [EMAIL PROTECTED] Subject: Re: Hacking HTML forms On Mon, 11 Jun 2001, McShane, Matthew wrote: Hello, I have created a javascript widget which lets users move options from one multi-select to another as input to a search. For example they can select one or many hardcoded options in an allowed select box and then click on an arrow to move the selected options into the selected-for-this-search select box. Just before the form is submitted, I also select all the options in all the selected-for-this-search boxes so that they are submitted. My question is, can Struts support this? From the messages on this list it seems like multi-select box values need to be kept in an Array but I think mine need to be in a HashMap thanks, matt. In principle, it *should* still work with an array. The key is that your setter method should take a String array as the arg: public void setSelectResults(String selectResults[]) and Struts will then accumulate all of the options that were actually selected into a String array and call this setter for you. Because it's a new array, there is no requirement that the number of selected items be the same (or anything like that). Struts does not really care what happens on the client side before the submit (which is where your JavaScript manipulations to implement the above takes place). Craig
Help with define tag
Hi, I think I'm missing something here. I have a bean that is available to my page in the request scope. Within that I have another bean that has properties I want to display. I'm trying to use the define tag to get a reference to the embedded bean and I'm getting the infamous: javax.servlet.jsp.JspException: No getter method for property homeAddress of bean policyHolderInfo Here's the code - In my bean policyHolderInfo bean attached to the request obj: public AddressInfo homeAddress; public AddressInfo getHomeAddress(AddressInfo homeAddress) { return homeAddress; } public void setHomeAddress( AddressInfo homeAddress) { this.homeAddress = homeAddress; } My jsp tag is: bean:define id=policyHolderAddress name=policyHolderInfo property=homeAddress / All other getters on the policyHolderInfo bean work just fine. Am I doing something wrong or is there another way to do this? Any suggestions would be appreciated. Thanks, Chuck
Re: Dynamic action mapping
Hello AFASA, Monday, June 11, 2001, 2:50:08 PM, you wrote: ACdP I am looking for a way to invoke different Actions from one form ACdP depending on the button clicked by the user. ACdP Is there a simple way of configuring Struts to do this? You can implement one of your actions as switch between other actions. Use button name as key to choose target action and forward request processing to it. -- Best regards, Olegmailto:[EMAIL PROTECTED]
RE: cann't work
Hi Zhongquing, Where is your servlet mapping? --Abraham -Original Message-From: zhongqing [mailto:[EMAIL PROTECTED]]Sent: Thursday, June 08, 2000 7:29 PMTo: [EMAIL PROTECTED]Subject: cann't work HI I have a problem in using struts.The details are as follow: The Web Server is WebLogic5.1. and the configure info in the web.xml is: servlet servlet-nameaction/servlet-name display-nameaction/display-nameservlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-nameapplication/param-name param-valuecom.ncs.iwa.ApplicationResources/param-value/init-param init-param param-namedetail/param-name param-value2/param-value /init-param init-param param-namevalidate/param-name param-valuetrue/param-value /init-param load-on-startup2/load-on-startup/servlet and in the web-info folder there are: lib\struts.jar struts-config.xml The problem is : when I input the http://localhost:port/myapp/login.do The server told me the login.do cann't be found . why?
Re: checkLogon issue, and ActionError substitution problem...
Aha ... that's because the app.tld for this attribute declares that it does not accept runtime expressions. You can go ahead and change that on your copy (it's in the WEB-INF directory of the Struts example declaration) if you want -- this will be fixed in the final 1.0 release. Craig On Mon, 11 Jun 2001, Ryan Cornia wrote: Craig - I had tried it as a runtime expression (and just tried it again) - app:checkLogon name=%= Constants.STAFF_LOGIN_KEY % / but get the same result?!? If I put a system.out.println in the doEndTag of checkLogon, it prints name = %= Constants.STAFF_LOGIN_KEY %. This is with Tomcat 3.2 if that matters. ¯ On the other problem, in the resource file I have - error.login=libLogin Error: {0}/b/li Is that the correct syntax? Thanks, Ryan [EMAIL PROTECTED] 06/11/01 10:38AM On Mon, 11 Jun 2001, Ryan Cornia wrote: I'm trying to figure out how to pass a constant name/page to the example checkLogon tag. I created a Constants class, with - public final static String STAFF_LOGIN_KEY = test:staffloggedin; in my jsp I put - app:checkLogon name=% Contants.STAFF_LOGIN_KEY % / You need to use a runtime expression instead: app:checkLogon name=%= Constants.STAFF_LOGIN_KEY % / ^ | | The issue is that it sets name in the checkLogon tag to the string % Contants.STAFF_LOGIN_KEY % not the value of that scriptlet (stafflogon.jsp). Any ideas? Also, I am trying to do substitution on an action error with the following - errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.login, test)); When this runs, the error message is - Login Error: [Ljava.lang.Object;@158bf9 Instead of Login Error: test This is with Struts 1.0B3. What does the message format string named error.login look like? Thanks, Ryan Newbie Ryan Cornia Programmer Analyst Department of Community and Economic Development State of Utah Craig McClanahan
RE: Hacking HTML forms
On Mon, 11 Jun 2001, McShane, Matthew wrote: but what about when i get sent back to the form (perhaps from a validation error). How will the selected select box repopulate itself if all it has to go on are the Strings in the associated array? The set of selected objects will be marked selected because Struts will call the corresponding property getter. Repopulating the list of all available options is going to have to be managed by your own code. Perhaps you can include a hidden variable containing all of the currently listed choices as part of your submit? matt. Craig -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 12:35 PM To: [EMAIL PROTECTED] Subject: Re: Hacking HTML forms On Mon, 11 Jun 2001, McShane, Matthew wrote: Hello, I have created a javascript widget which lets users move options from one multi-select to another as input to a search. For example they can select one or many hardcoded options in an allowed select box and then click on an arrow to move the selected options into the selected-for-this-search select box. Just before the form is submitted, I also select all the options in all the selected-for-this-search boxes so that they are submitted. My question is, can Struts support this? From the messages on this list it seems like multi-select box values need to be kept in an Array but I think mine need to be in a HashMap thanks, matt. In principle, it *should* still work with an array. The key is that your setter method should take a String array as the arg: public void setSelectResults(String selectResults[]) and Struts will then accumulate all of the options that were actually selected into a String array and call this setter for you. Because it's a new array, there is no requirement that the number of selected items be the same (or anything like that). Struts does not really care what happens on the client side before the submit (which is where your JavaScript manipulations to implement the above takes place). Craig
Re: Help with define tag
Is your getter method really as you posted it? That just returns the parameter it is passed. It should be this: public AddressInfo getHomeAddress() { return this.homeAddress; } Note the absence of the parameter. The rest looks fine, although I would advocate making the homeAddress member private instead of public. -- Martin Cooper At 10:46 AM 6/11/01, Chuck Stern wrote: Hi, I think I'm missing something here. I have a bean that is available to my page in the request scope. Within that I have another bean that has properties I want to display. I'm trying to use the define tag to get a reference to the embedded bean and I'm getting the infamous: javax.servlet.jsp.JspException: No getter method for property homeAddress of bean policyHolderInfo Here's the code - In my bean policyHolderInfo bean attached to the request obj: public AddressInfo homeAddress; public AddressInfo getHomeAddress(AddressInfo homeAddress) { return homeAddress; } public void setHomeAddress( AddressInfo homeAddress) { this.homeAddress = homeAddress; } My jsp tag is: bean:define id=policyHolderAddress name=policyHolderInfo property=homeAddress / All other getters on the policyHolderInfo bean work just fine. Am I doing something wrong or is there another way to do this? Any suggestions would be appreciated. Thanks, Chuck
checkLogon issue fixed, Still have ActionError substitutionproblem...
Thanks Craig, that works perfectly! Now the checkLogon tag accepts the expression, and everything works as expected. Any idea on why the actionerror substitution is not working? Anyone else having problems with it? (RECAP: Also, I am trying to do substitution on an action error with the following - errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.login, test)); When this runs, the error message is - Login Error: [Ljava.lang.Object;@158bf9 Instead of Login Error: test This is with Struts 1.0B3. In the resource file I have - error.login=libLogin Error: {0}/b/li /RECAP) Thanks, Ryan
Tomcat startup command
Title: Tomcat startup command I am sorry it is not a really struts problem. But I am deploying struts application on Tomcat, so Is there a way to pass the port address via command line (such as a -d parameter)? Thanks
Re: Tomcat startup command
I don't think so. The ports are assigned in the server.xml file in the conf directory. I think when you start the server up, any port assigned in that file gets started. Enron Broadband Services Office: 713-345-6840 Cell: 713-858-9438 |+--- || [EMAIL PROTECTED]| || om | || | || 06/11/01 | || 02:01 PM | || Please | || respond to | || struts-user | || | |+--- | || | To: [EMAIL PROTECTED] | | cc: (bcc: Bill Donges/Enron Communications) | | Subject: Tomcat startup command | | I am sorry it is not a really struts problem. But I am deploying struts application on Tomcat, so Is there a way to pass the port address via command line (such as a -d parameter)? Thanks
Re: Help with define tag
Hello Chuck, comments below... Monday, June 11, 2001, 9:46:56 PM, you wrote: CS Hi, CS I think I'm missing something here. I have a bean that is available to my CS page in the request scope. Within that I have another bean that has CS properties I want to display. I'm trying to use the define tag to get a CS reference to the embedded bean and I'm getting the infamous: CS javax.servlet.jsp.JspException: No getter method for property homeAddress of CS bean policyHolderInfo CS Here's the code - CS In my bean policyHolderInfo bean attached to the request obj: CS public AddressInfo homeAddress; CS public AddressInfo CS getHomeAddress(AddressInfo homeAddress) wrong here^ CS { CS return homeAddress; CS } CS public void CS setHomeAddress( AddressInfo homeAddress) CS { CS this.homeAddress = homeAddress; CS } CS My jsp tag is: CS bean:define id=policyHolderAddress name=policyHolderInfo CS property=homeAddress / CS All other getters on the policyHolderInfo bean work just fine. CS Am I doing something wrong or is there another way to do this? Any CS suggestions would be appreciated. CS Thanks, CS Chuck Your property support must looks like - public AddressInfo getHomeAddress() { return homeAddress; } public void setHomeAddress( AddressInfo homeAddress) { this.homeAddress = homeAddress; } -- Best regards, Olegmailto:[EMAIL PROTECTED]
Re: Problem With Struts and Tomcat
Modifying TomcatRunner was trivial. Here's a link to the doc I was talking about (watch for word wrap): http://www7.software.ibm.com/vad.nsf/data/document2557?OpenDocumentp=1BCT= 1Footer=1 -- Dan Miser http://www.distribucon.com - Original Message - From: Thomas L Richards [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 11, 2001 10:03 AM Subject: Re: Problem With Struts and Tomcat Dan, Ok, I'll try that (even though I ordered 3.5.3but it'll be a while before I get it). Do you have the title of the article for integrating 3.2.1 into VAJ on VADD? The thing I'm curious about is in the IBM Tomcat Integration bundle, IBM has a Runner class that handles Tomcat startup and everything. Is it possible to use the 3.1.X runner (just tweak it for 3.2.1?) thereby pointing it at the new version? I haven't tried this Just a thought.
GenericDataSource Examples
Hi, where can I find GenericDataSource Examples ?
Re: Good 'ol missing message for key...?
All versions of Struts work with WAS 3.52+. It's just a matter of how much tweaking you have to do. If you use Beta 3, search the mailing list for a work-around to WAS' bug that doesn't allow request scope beans to be removed. For your error, take a look at the stdout.log for your app server. Also, take a look at this doc: http://www.distribucon.com/struts/WASInstall.htm -- Dan Miser http://www.distribucon.com - Original Message - From: dsf65b y b3763476b3 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 11, 2001 4:11 AM Subject: Good 'ol missing message for key...? Hi here! Being somewhat new to struts in general and in combination with Websphere Application Server (WAS) in particular I have the following questions for you: Is it correct that only the struts-1.0-b1 distribution will work with WAS? I have deployed struts-example.war and converted it to my own application. Everything works fine except that it can't find my ApplicationResource.properties file. Searching this forum I can see that people emphasize that struts.jar should *not* be in the web apps classpath but if I try to put any other place I get the error: Application unavailable for service.
Re: uploading file requires immediate serialization location?
Martin, Hi. Can I pick your brain about an earlier post? I asked what would happen if I have a html:file tag on my form, but without changing the enctype to multipart/form-data? Do you know if I just then get a String containing the filename selected/entered? thanks, Dave Martin Cooper [EMAIL PROTECTED] on 06/11/2001 01:55:07 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED], Jonathan Asbell [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Re: uploading file requires immediate serialization location? String parameters are not written to a file. Only the bodies of file upload parts are written to disk, and each one to a separate file. The files are written as the input stream (i.e. the request) is processed. Let's say your form has two fields, a textarea called 'myText' and a file input called 'myFile'. After you submit it, and Struts has populated your form bean, you will have: 1) The text from the textarea field is stored in the bean's 'myText' property as a String. 2) The uploaded data is stored in a temporary file somewhere on disk. 3) The 'myFile' property on your bean, which has type FormFile, contains information about the uploaded data (e.g. file name, content type, etc.). The bean is in either request or session scope, as you defined it in your struts-config.xml file. If the bean goes away, then so does the file that holds the uploaded data. Hope this helps. -- Martin Cooper - Original Message - From: Jonathan Asbell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 10, 2001 10:48 PM Subject: Re: uploading file requires immediate serialization location? So do you simultaneously write to a file while reading a String parameter when you process a form? What parts of the multipart request do we save in the bean, and in what scope? - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Jonathan Asbell [EMAIL PROTECTED] Sent: Monday, June 11, 2001 1:23 AM Subject: Re: uploading file requires immediate serialization location? Yes, I think you've got it. Just to be clear, though, when you say we need to examine the sections in the header ..., the we here is Struts - you don't need to do anything in your application. Struts makes getParameter() et all work for multipart requests as well as regular requests. What you are seeing in the packages you've looked at is the parsing of a MIME part. The fields in a multipart/form-data request each conform to the specification for a MIME part, and they are separated by a boundary, which is a line containing a pattern defined in a header at the top of the request. Each MIME part consists of a sequence of MIME headers, followed by a blank line, followed by the data for that MIME part, known as the body. A MIME header takes the form header-name: value - for example, Content-type: text/plain. The body is just a bunch of data that conforms to the statements made about it in the headers. Every field in a multipart request is encoded this way. So where a regular query using GET might contain a query string like this: ...author=Martin... a multipart request would represent the same query parameter like this: -0123456789-- Content-disposition: form-data; name=author Martin -0123456789-- For a file upload, the difference is only that the Content-disposition header will include a file name, and the data can be binary if necessary. When a multipart handler processes a request, it is reading the data from an input stream provided by the container. Typically, for regular query parameters, it will store the value in a hash table. For file parameters, it will store the data in a file and retain information about that file. The Struts implementation uses the FormFile interface to provide access to that information. A multipart implementation could do whatever it wanted to with the data provided from a file upload. Although the Content-disposition header may specify a file name, there is no requirement to store that data as a file. One implementation that would make sense would be to define a size threshold, and store uploaded objects below that size in memory, while writing larger ones to disk. Regarding form beans and binary data, there is no reason why a field in a form bean cannot be a byte array. However, by itself that is not very useful, hence the FormFile interface. If you'll notice, that interface does in fact have a getFileData() method, which will give you the uploaded data as a byte array. In the current implementation, what that actually does is load the contents of the file into memory and hand you back that memory. And there you have binary data in a form field. Hope this helps. -- Martin Cooper - Original Message - From: Jonathan Asbell [EMAIL
Re: GenericDataSource Examples
I'm not sure if you are asking a more general question, but this retrieves the Struts connection pool. protected Connection getConnection() throws SQLException { DataSource ds = (DataSource)servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY); return ds.getConnection(); } data-sources data-source autoCommit=false description=Example Data Source Configuration driverClass=sun.jdbc.odbc.JdbcOdbcDriver maxCount=4 minCount=2 password= url=jdbc:odbc:TEST user=sa / /data-sources David --- hunkpapa [EMAIL PROTECTED] wrote: Hi, where can I find GenericDataSource Examples ? __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/
RE: GenericDataSource Examples
It in the documentation somewhere...the users guide i believe... Mikkel -Original Message- From: hunkpapa To: [EMAIL PROTECTED] Sent: 11-06-2001 21:46 Subject: GenericDataSource Examples Hi, where can I find GenericDataSource Examples ?
RE: Problem With Struts and Tomcat
I posted a how-to for getting struts and tomcat 3.2.1 up and running in VAJ...check the archives or even www.helenius.org... Mikkel -Original Message- From: Thomas L Richards To: [EMAIL PROTECTED] Sent: 11-06-2001 17:03 Subject: Re: Problem With Struts and Tomcat Dan, Ok, I'll try that (even though I ordered 3.5.3but it'll be a while before I get it). Do you have the title of the article for integrating 3.2.1 into VAJ on VADD? The thing I'm curious about is in the IBM Tomcat Integration bundle, IBM has a Runner class that handles Tomcat startup and everything. Is it possible to use the 3.1.X runner (just tweak it for 3.2.1?) thereby pointing it at the new version? I haven't tried this Just a thought. -Tom Dan Miser [EMAIL PROTECTED] To: [EMAIL PROTECTED] com cc: Subject: Re: Problem With Struts and Tomcat 06/09/2001 11:10 AM Please respond to struts-user You don't *need* VAJ 3.5.3 to run 3.2.1. Of course, you need to do things yourself as opposed to using the IBM Tomcat integration offering. If you have specific problems with your config, post them here and I should be able to help out. Also, there's an article on VADD that outlines most of the things you need to do for Struts integration with VAJ. -- Dan Miser http://www.distribucon.com - Original Message - From: Thomas L Richards [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 08, 2001 4:47 PM Subject: Re: Problem With Struts and Tomcat I'm downloading Tomcat 3.2.1 now (can't get 3.2.2 for VAJ yet). Unfortunately, as it turns out, I need to upgrade VAJ to 3.5.3 since Tomcat 3.2.X won't work with VAJ 3.5.2. Go figure.
Re: uploading file requires immediate serialization location?
I don't know what would happen. In particular, I don't know what the browser would submit (if anything) in that case. I had thought that the HTML spec stated that the enctype must be multipart/form-data when you use a file input tag, but I just checked, and it (the 4.01 spec) says should, not must. Of course, that doesn't mean that browsers will support it! :-) -- Martin Cooper At 12:55 PM 6/11/01, [EMAIL PROTECTED] wrote: Martin, Hi. Can I pick your brain about an earlier post? I asked what would happen if I have a html:file tag on my form, but without changing the enctype to multipart/form-data? Do you know if I just then get a String containing the filename selected/entered? thanks, Dave Martin Cooper [EMAIL PROTECTED] on 06/11/2001 01:55:07 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED], Jonathan Asbell [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Re: uploading file requires immediate serialization location? String parameters are not written to a file. Only the bodies of file upload parts are written to disk, and each one to a separate file. The files are written as the input stream (i.e. the request) is processed. Let's say your form has two fields, a textarea called 'myText' and a file input called 'myFile'. After you submit it, and Struts has populated your form bean, you will have: 1) The text from the textarea field is stored in the bean's 'myText' property as a String. 2) The uploaded data is stored in a temporary file somewhere on disk. 3) The 'myFile' property on your bean, which has type FormFile, contains information about the uploaded data (e.g. file name, content type, etc.). The bean is in either request or session scope, as you defined it in your struts-config.xml file. If the bean goes away, then so does the file that holds the uploaded data. Hope this helps. -- Martin Cooper - Original Message - From: Jonathan Asbell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 10, 2001 10:48 PM Subject: Re: uploading file requires immediate serialization location? So do you simultaneously write to a file while reading a String parameter when you process a form? What parts of the multipart request do we save in the bean, and in what scope? - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Jonathan Asbell [EMAIL PROTECTED] Sent: Monday, June 11, 2001 1:23 AM Subject: Re: uploading file requires immediate serialization location? Yes, I think you've got it. Just to be clear, though, when you say we need to examine the sections in the header ..., the we here is Struts - you don't need to do anything in your application. Struts makes getParameter() et all work for multipart requests as well as regular requests. What you are seeing in the packages you've looked at is the parsing of a MIME part. The fields in a multipart/form-data request each conform to the specification for a MIME part, and they are separated by a boundary, which is a line containing a pattern defined in a header at the top of the request. Each MIME part consists of a sequence of MIME headers, followed by a blank line, followed by the data for that MIME part, known as the body. A MIME header takes the form header-name: value - for example, Content-type: text/plain. The body is just a bunch of data that conforms to the statements made about it in the headers. Every field in a multipart request is encoded this way. So where a regular query using GET might contain a query string like this: ...author=Martin... a multipart request would represent the same query parameter like this: -0123456789-- Content-disposition: form-data; name=author Martin -0123456789-- For a file upload, the difference is only that the Content-disposition header will include a file name, and the data can be binary if necessary. When a multipart handler processes a request, it is reading the data from an input stream provided by the container. Typically, for regular query parameters, it will store the value in a hash table. For file parameters, it will store the data in a file and retain information about that file. The Struts implementation uses the FormFile interface to provide access to that information. A multipart implementation could do whatever it wanted to with the data provided from a file upload. Although the Content-disposition header may specify a file name, there is no requirement to store that data as a file. One implementation that would make sense would be to define a size threshold, and store uploaded objects below that size in memory, while writing larger ones to disk. Regarding form beans and binary data, there is no reason why a field in a form bean cannot be a byte array. However, by
ActionForms for read-only data??
I have a Struts theory question on use of action forms versus java beans for read-only data. We have extended workflow on our website such that the same form can look a bit different depending on where you are in the workflow. For example, the quote request will have limit and retention fields in the business request section. Once you get to quote, those fields are read-only and there's an additional quote amount field. When the client requests binder, all those fields are read-only and there is a checkbox. Once bound, everything is read-only. There is some disagreement on the team as to how to handle this case. We will obviously have four JSPs, one for each of these presentations. The question is the data mapping to beans. Half of the team feels that to use Struts in its purest sense, we need to have java beans that represent the read-only data, and action forms to represent the editable data. That would mean four action forms, one for each JSP. The other half of the team wants to re-use the same action form for all four cases, bean:define it in the session, and use bean:write to print out the data if read-only. The major advantage is simplicity - we have one bean that represents all of the data - there is no need to understand what part of the workflow we are in when translating the data from the data model to the presentation layer beans. It is also easier to understand for an HTML programmer or developer that the same bean is used regardless of whether it is a bean:write or any of the html tags. We certainly don't want to end up in a position where we have broken the framework and hurt our extensibility in future releases. The first scenario would seem to follow the framework more closely, but in this special case, is it a problem to deviate and use the ActionForm for what it is - a bean? We would appreciate any advice and experiences. Thank you. Lisa Stephens GeneralCologne Re Trumbull, CT 203 328 5227
multiple mapping problems
Hello, I've been trying to figure out why this is happening and have had no luck, so I figured maybe someone here could help. I don't know if this is a bug, or if I just don't understand the correct application framework, etc. I have two servlets defined in the web.xml file (servlet1 and servlet1) of class types servletclass1 and servletclass2. Each one has the init-param 'config' set to the same 'stuts-config.xml'. Each servlet has a different mapping (*.do1, *.do2). In the stuts-config.xml file I have two action paths defined (/path1 and /path2) with types actionclass1 and actionclass2. The requests are only for path1.do1 and path2.do2, never path1.do2. When I load this, both mappings get mapped to both servlets: Call package.ServletClass1.addServletMapping(servlet1/java.lang.String,*.do 1/java.lang.String) Call package.ServletClass1.addServletMapping(servlet2/java.lang.String,*.do 2/java.lang.String) then later on Call package.ServletClass2.addServletMapping(servlet1/java.lang.String,*.do 1/java.lang.String) Call package.ServletClass2.addServletMapping(servlet2/java.lang.String,*.do 2/java.lang.String) Any ideas? Should I just define a seperate stuts-config file? _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com
Re: ActionForms for read-only data??
The important thing about ActionForm beans is that they are intended as adapters between HTML forms and the rest of the application. If the property is being used within a HTML form, then it is a valid use of an ActionForm bean, regardless of whether the property is hidden or immutable. It is not expected that there will be a 1:1 relationship between a HTML form and an ActionForm bean. Some ActionForm beans may be used on several forms, and several forms may use the same ActionForm bean. In general, most people would design ActionForm beans to represent a logical view (in the SQL sense) within the application. If the data is being accessed by the same SQL query, then it would make sense to put it all on the same ActionForm bean, regardless of whether it is exposed. The only thing to watch for is Strut's calling reset() as part of the validation. If a property is not present in the form, then it will be reset, and your validation has to cope with that. One caveat: ActionForms are not meant to be a panacea for the presentation layer. There are often other JavaBeans in play on this layer, with ActionForms being specialized for use with HTML forms. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/ [EMAIL PROTECTED] wrote: I have a Struts theory question on use of action forms versus java beans for read-only data. We have extended workflow on our website such that the same form can look a bit different depending on where you are in the workflow. For example, the quote request will have limit and retention fields in the business request section. Once you get to quote, those fields are read-only and there's an additional quote amount field. When the client requests binder, all those fields are read-only and there is a checkbox. Once bound, everything is read-only. There is some disagreement on the team as to how to handle this case. We will obviously have four JSPs, one for each of these presentations. The question is the data mapping to beans. Half of the team feels that to use Struts in its purest sense, we need to have java beans that represent the read-only data, and action forms to represent the editable data. That would mean four action forms, one for each JSP. The other half of the team wants to re-use the same action form for all four cases, bean:define it in the session, and use bean:write to print out the data if read-only. The major advantage is simplicity - we have one bean that represents all of the data - there is no need to understand what part of the workflow we are in when translating the data from the data model to the presentation layer beans. It is also easier to understand for an HTML programmer or developer that the same bean is used regardless of whether it is a bean:write or any of the html tags. We certainly don't want to end up in a position where we have broken the framework and hurt our extensibility in future releases. The first scenario would seem to follow the framework more closely, but in this special case, is it a problem to deviate and use the ActionForm for what it is - a bean? We would appreciate any advice and experiences. Thank you. Lisa Stephens GeneralCologne Re Trumbull, CT 203 328 5227
RE: Where can I get the latest version of Jasper?
Thanks again for the help Craig. My container vendor is asking me which version of Jasper (tomcat) they should use. Currently they are using 3.1.x -- what would you reccomend as a good version that contains the Jasper fix to get around the pageContext.removeAttribute() problem? --Steve -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 09, 2001 4:17 PM To: '[EMAIL PROTECTED]' Subject: Re: Where can I get the latest version of Jasper? On Wed, 6 Jun 2001, Ritter, Steve wrote: Does anyone know how I get the latest version of Jasper? Do I have to download Tomcat and if so which version? Thanks in advance!!! --Steve Jasper is not packaged separately from Tomcat -- you'll need to get Tomcat if you want it. Craig
Re: Any hosting sites that use Struts?
Hi Jeff I don't know how they do it, but at the AOIndustries Level II service, one does get a private VM and app server, classpath, etc. At Level I, when you restart Tomcat, it restarts everybody's app, and that can be a hassle. Tom Jeff Trent wrote: Problem is I'm looking for a hosting facility that offers Java + ASP hosting. Usually, I find these services lean one way or another.A bit off subject, but I'm wondering how these providers have their environment setup so that each user can have a separate App Server / VM, classpath, etc. and can be managed separately (on NT). If anyone knows, I'd be interested to hear from you...Tnx. -- Tom Miller Miller Associates, Inc. [EMAIL PROTECTED] 641.469.3535 Phone 413.581.6326 FAX
Javascript implementation of html:rewrite ?
I ran into an interesting problem: I need the ability to rewrite the url, with the encoded session information, dynamically, after the page has already been loaded by the browser client. I am opening a new browser window for doing searches, some of the fields on my first page need to be passed along to this secondary page. If I didn't need to pass parameters from my form onto the new window I could just use the rewrite tag. Like this: window.open ('html:rewrite page=/findRequestedFacility.do/', 'provider', 'scrollbars=yes,width=640,height=480,status=yes'); However, my url needs to look something like this: //Grab a parameter off my form... var lUrl = /findRequestedFacility.do?FacilityId=' + form.facilityId.value + '; //Rewrite the URL...Need Javascript function to do this. lUrl = rewriteUrl(lUrl); //Open the thing. window.open (lUrl, 'provider', 'scrollbars=yes,width=640,height=480,status=yes'); Has anybody written a javascript function to do this? Thanks Tyler Van Gorder [EMAIL PROTECTED] Landacorp
RE: Logic Tag Library and (Iterator) List Navigation
Hi Oleg, Could you please send me the class and JSP too. Thanks. -Nimmi -Original Message- From: Oleg V Alexeev [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 3:07 PM To: Matt Raible Subject: Re: Logic Tag Library and (Iterator) List Navigation Hello Matt, I can send you Pager class, used to generate ArrayList of links to the pages in this result set, and a piece of jsp code to display it. I think it can used for any container wich implements Collection interface. Thursday, June 07, 2001, 5:57:12 PM, you wrote: MR Has anyone used logic:iterator to display a list of records, and MR corresponding list navigation links at the bottom? MR For instance, I have an Iteration of DataObjects that I can list through MR with the following code: MR while (iteratorName.hasNext()) { MR dataObject = (DataObject)iteratorName.next(); MR out.println(dataObject.getName()); MR } MR I'm assuming I can do this with the Iterator tag, however, I would also like MR to display the following at the bottom of the list: MR First | 1-10 | 11-20 | 20-30 | Last MR Where there are 30 records returned. MR Any ideas? MR Thanks, MR Matt MR _ MR Do You Yahoo!? MR Get your free @yahoo.com address at http://mail.yahoo.com -- Best regards, Olegmailto:[EMAIL PROTECTED]
Interfaces in Struts
I wanted to share my approach because it seems successful for what we're doing. I can't imagine we're the only ones doing it, but just in case we are, I wanted to share. I'd also like to hear any and all comments and criticisms. We use Struts to present database tables to the user so that we may collect information from them, validate it, and process it. Nothing new here. In order to make sure we only have to design these beans once, I used interfaces from the beginning. So a profile starts out as something like this: /* * Profile.java */ package com.trams.project ; public interface Profile { int proifleno = 0 ; String firstname = null ; String lastname = null ; . . . int getProfileno ( ) ; void setProfileno ( int profileno ) ; String getFirstname ( ) ; void setFirstname( String firstname ) ; void setLastname ( String lastname ) ; String getLastname ( ) ; . . . } // end of Profile.java Once I have the interface, I also write the class that uses it. In this case, a database interactivity class that constructs SQL statements in order to process the data presented to it: /* * ProfileDBM.java */ package com.trams.project ; public class ProfileDBM extends DatabaseManager { Profile table = null ; public void setTable ( Object table ) { this.table = (Profile) table ; } public void create ( ) { . . . } public void retrieve ( ) { . . . table.setProfileno(rs.getInt(PROFILENO)) ; table.setFirstname(rs.getString(FIRSTNAME)) ; table.setLastname(rs.getString(LASTNAME)) ; . . . } public void update ( ) { . . . } public void delete ( ) { . . . } } At this point you can see (or have to trust) that nothing uses Struts, Servlets, or anything other than basic packages. The above code could be used to populate any object with Profile information, be it a command line utility, AWT object, or even a Struts ActionForm. I then implement my Profile into an ActionForm: /* * ProfileForm.java */ package com.trams.project ; public final class ProfileForm extends ActionForm implements Profile { private int proifleno ; private String firstname ; private String lastname ; . . . int getProfileno ( ) { return this.profileno ; } void setProfileno ( int profileno ) { this.profileno = profileno ; } String getFirstname ( ) { return this.firstname ; } void setFirstname( String firstname ) { this.firstname = firstname ; } void setLastname ( String lastname ) { return this.lastname ; } String getLastname ( ) { this.lastname = lastname ; } . . . } Then a fragment of my ProfileAction.java file: . . . ProfileForm profileForm = (ProfileForm) form ; ProfileDBM dbm = new ProfileDBM() ; dbm.setCon(con) ; // part of my DatabaseManager class dbm.setTable(profileForm) ; dbm.retrieve() ; . . . That populates the entire form so it can be displayed and manipulated by the user. The other methods aid in creating, updating, and deleting. Nothing really spectacular, I know. But I remember people talking about it, and I just wanted to share what I've been doing. Again, we've had great success in representing our existing database. And at this rate, we'll have more than a Struts API for accessing our database. We'll also have independent interfaces that could be used by any developer who wants the SQL logic all worked out for them. Anthony These pearls of thought in Persian gulfs were bred, Each softly lucent as a rounded moon; The diver Omar plucked them from their bed, Fitzgerald strung them on an English thread. -James Russell Lowell, in a copy of Omar Khayyam
RE: uploading file requires immediate serialization location?
Hi, Sorry about not jumping into this conversation, I haven't been around. If you don't specify multipart/form-data, the information is sent as POST data, basically just encoded name/value pairs in your ServletInputStream. So all you're passing is the name of the file that the client specified. -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Monday, June 11, 2001 5:45 PM To: [EMAIL PROTECTED] Subject: Re: uploading file requires immediate serialization location? I don't know what would happen. In particular, I don't know what the browser would submit (if anything) in that case. I had thought that the HTML spec stated that the enctype must be multipart/form-data when you use a file input tag, but I just checked, and it (the 4.01 spec) says should, not must. Of course, that doesn't mean that browsers will support it! :-) -- Martin Cooper At 12:55 PM 6/11/01, [EMAIL PROTECTED] wrote: Martin, Hi. Can I pick your brain about an earlier post? I asked what would happen if I have a html:file tag on my form, but without changing the enctype to multipart/form-data? Do you know if I just then get a String containing the filename selected/entered? thanks, Dave Martin Cooper [EMAIL PROTECTED] on 06/11/2001 01:55:07 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED], Jonathan Asbell [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Re: uploading file requires immediate serialization location? String parameters are not written to a file. Only the bodies of file upload parts are written to disk, and each one to a separate file. The files are written as the input stream (i.e. the request) is processed. Let's say your form has two fields, a textarea called 'myText' and a file input called 'myFile'. After you submit it, and Struts has populated your form bean, you will have: 1) The text from the textarea field is stored in the bean's 'myText' property as a String. 2) The uploaded data is stored in a temporary file somewhere on disk. 3) The 'myFile' property on your bean, which has type FormFile, contains information about the uploaded data (e.g. file name, content type, etc.). The bean is in either request or session scope, as you defined it in your struts-config.xml file. If the bean goes away, then so does the file that holds the uploaded data. Hope this helps. -- Martin Cooper - Original Message - From: Jonathan Asbell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 10, 2001 10:48 PM Subject: Re: uploading file requires immediate serialization location? So do you simultaneously write to a file while reading a String parameter when you process a form? What parts of the multipart request do we save in the bean, and in what scope? - Original Message - From: Martin Cooper [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Jonathan Asbell [EMAIL PROTECTED] Sent: Monday, June 11, 2001 1:23 AM Subject: Re: uploading file requires immediate serialization location? Yes, I think you've got it. Just to be clear, though, when you say we need to examine the sections in the header ..., the we here is Struts - you don't need to do anything in your application. Struts makes getParameter() et all work for multipart requests as well as regular requests. What you are seeing in the packages you've looked at is the parsing of a MIME part. The fields in a multipart/form-data request each conform to the specification for a MIME part, and they are separated by a boundary, which is a line containing a pattern defined in a header at the top of the request. Each MIME part consists of a sequence of MIME headers, followed by a blank line, followed by the data for that MIME part, known as the body. A MIME header takes the form header-name: value - for example, Content-type: text/plain. The body is just a bunch of data that conforms to the statements made about it in the headers. Every field in a multipart request is encoded this way. So where a regular query using GET might contain a query string like this: ...author=Martin... a multipart request would represent the same query parameter like this: -0123456789-- Content-disposition: form-data; name=author Martin -0123456789-- For a file upload, the difference is only that the Content-disposition header will include a file name, and the data can be binary if necessary. When a multipart handler processes a request, it is reading the data from an input stream provided by the container. Typically, for regular query parameters, it will store the value in a hash table. For file parameters, it will store the data in a file and retain information about that file. The Struts implementation uses the FormFile interface to provide access to that information. A multipart implementation
RE: html:file tag question
Dave, You'll just submit POST form data, with the name being the name of the file input, and the value being the file path given by the client. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 06, 2001 12:24 PM To: [EMAIL PROTECTED] Subject: html:file tag question Hi everyone. I was wondering if anyone know what will be submitted if I use the html:file tag WITHOUT setting the enctype to multipart/form-data on my form tag? A string? I do not want to actually upload the file, just get the filename requested. Many thanks, Dave
difficulty with logic:forward in template
I'm trying to use logic:forward in a .jsp file that is used in a template (via template:put). Apparently this is problematic, as I get the following exception when ForwardTag.doEndTag tries to execute pageContext.forward(path): java.lang.IllegalStateException: Cannot forward as OutputStream or Writer has already been obtained Yet the same logic:forward works perfectly when invoked in a plain .jsp rather than in a template. Can anyone suggest a workaround, or even better, something I don't know about that might solve this? TIA. -- Tom Miller Miller Associates, Inc. [EMAIL PROTECTED] 641.469.3535 Phone 413.581.6326 FAX
Re: Concepts in working with multipart request
Thanks Mike :^) - Original Message - From: SCHACHTER,MICHAEL (HP-NewJersey,ex2) To: '[EMAIL PROTECTED]' Sent: Monday, June 11, 2001 10:15 PM Subject: RE: Concepts in working with multipart request Jonathan, Hello all. I wanted to know if I am able to use the MultipartRequestWrapper object by itself. That is, can I store MultipartRequestWrapper objects in a bean. I would definately not recommend it.The MultipartRequestWrapper object is somethingthat should be usedinternally to Struts, to work around some existing issues between normal and multipart requests. Also, that class is definately going to change to extend javax.servlet.http.HttpServletRequestWrapper when Struts adopts the Servlet 2.3 spec. My purpose is to temporarily storea binary and its file name in a bean until the final form page when the usersubmitsthe whole "kit and kaboodle". Instead of doing this, you'd probably just want to stick to using an ActionForm bean that has aFormFile property. TheFormFile interfaceshould suit your needs well, as it has a getFileName() method and methods to retrieve the data written to a temporary file after uploading: public classMultipageForm extends ActionForm { private FormFile theFile; public void setTheFile(FormFile file) { this.theFile =file; } public FormFile getTheFile() { return theFile; } } Part of the problem is that I dont understand what is going on.It looks like the request keeps the following: "name" property representing the form field name "value" property representing the Stringpath of the file you uploaded some binary Stream data representing the file Again, don't pay much attention to the MultipartRequestWrapper class, concentrate on creating an ActionFormbean that has aorg.apache.struts.upload.FormFile property representing your file,and normal String properties representing your form data, just as you would normally create a non multipart form. I realy have no idea, and I am looking around for answers but am coming up empty. Can someone sum up what is happening here, what the request contains, what values the request works with, and whatare the requirements. Martin Cooper summed this up nicely in anotherthread aboutuploading, but I'llgo over it anyway: 1) Request comes in, Struts goes to populate the form (BeanUtils.populate()) discovers thatthe content type of the request is"multipart/form-data" 2) Struts goes to populate the form, and creates a MultipartRequestHandler instance to handle the multipart request. MultipartRequestHandler is an interface, the implementation can change at will and can be specified as an init-param for ActionServlet, or as an ActionServlet property in struts-config.xml 2a) In the implementation that comes with Struts, the multipart form data is read as follows: Read the data, if it's a string parameter, grab it's value and put it in a Hashtable for later use if it's a file, read the file with a BufferedInputStream and store the data in a temporary file, then wrap it in a FormFile implementation (org.apache.struts.upload.DiskFile) and hand it back to BeanUtils (next step) 3) BeanUtils.populate() uses the interface methods in MultipartRequestHandler to grab the properties that were retrieved from the normal multipart request, the populates your ActionForm bean with the relevant data. 4) The Action is executed, and code in there manipulates the file according to whatever you want to do with it, for example, say we wanted to take the previous form bean (above) and use it in the action: public class UploadActionextends Action { public ActionForward perform(ActionMapping mapping,ActionForm form, HttpServletRequest request, HttpServletResponse response) { FormFile theFile = ((MultipageForm) form).getTheFile(); String filename = theFile.getFileName(); //and so on... } Hope this helps, also consult that long thread called "uploading files requires immediate serialization?", Martin Cooper does a damn good job of answering questions about this. Thanks again Martin... - Mike
Re: difficulty with logic:forward in template
The template is flushing the write buffer, and you can't redirect once the browser starts writing to the screen. Tom Miller wrote: I'm trying to use logic:forward in a .jsp file that is used in a template (via template:put). Apparently this is problematic, as I get the following exception when ForwardTag.doEndTag tries to execute pageContext.forward(path): java.lang.IllegalStateException: Cannot forward as OutputStream or Writer has already been obtained Yet the same logic:forward works perfectly when invoked in a plain .jsp rather than in a template. Can anyone suggest a workaround, or even better, something I don't know about that might solve this?
forward data
Hi, i would like to know how to forward data along with mapping.findForward("success") to other jsp page. thanks rajiv
RE: Displaying data retrieved from a database
Jonathan A way of doing this is to use the java.util.ArrayList object. If you have a bean to represent a row of data eg TableRow CustID FirstName LastName RowBean Integer CustId; /* with get and set Methods */ String FirstName;/* with get and set Methods */ String LastName;/* with get and set Methods */ In your action perform, you can loop through your resultset, create a new RowBean for each Row and add it to the arraylist. You can then either assign the arraylist to the response object or the session object. In your JSP page, use the iterate tag to loop through your list. Theother option is to use the CacheResultSet from sun but I have not venture into that area. There are a number of discussions in this list about using the CacheResultSet. Regards Michael Mok www.webappcabaret.com/normad -Original Message-From: Jonathan Asbell [mailto:[EMAIL PROTECTED]]Sent: Tuesday, 12 June 2001 10:09To: [EMAIL PROTECTED]Subject: Displaying data retrieved from a database I was interested in how you all were displaying data retrieved from a database. My notion is that in your Actions perform() method you will make calls and get results. But where do you put the results? Do I save the data to a bean which I pass in the request to a waiting Tag class on the page I will forward to, and have that Tag class iterate through the beans data?This means I have to make Tag classes toread in passed beans. How are you all doing this in general. I am very interested. Jonathan
RE: Form with request scope
Hi Timothy Check your struts-config file to see if you have specified scope=request in your action definition for processN1. Regards Michael Mok www.webappcabaret.com/normad -Original Message- From: Timothy Hicks [mailto:[EMAIL PROTECTED]] Sent: Monday, 11 June 2001 20:10 To: [EMAIL PROTECTED] Subject: Form with request scope I am trying to create a form which has request scope, so that it can be autopopulated when the form is displayed. However, when I go to the jsp the fields are not filled in and if I put debug statements in FormTag.doStartTag() I realize that the form is tied to a session scope. The following is the code I am using. Any thoughts? %@page language=java % %@taglib uri=/WEB-INF/struts-html.tld prefix=html % %@taglib uri=/WEB-INF/struts-bean.tld prefix=bean % html:form name=frmVendor action=processN1.do scope=request type =com.aholdusa.struts.view.N1Form html:errors / TABLE border=0 cellPadding=1 cellSpacing=1 id=smallfont TR TD colspan=2H1 class=blackVENDOR INFORMATION/H1/TD /TR /tableBR table id=smallfont tr td id=captionbar colspan=4Company Information/td /trTR TDVENDOR NUMBER/TD TDhtml:text property=vendorNumber maxlength=11 size=11 //TD /TRTR TDA/P NUMBER/TD TDhtml:text property=apNumber maxlength=11 size=11 //TD /TRTR TDCOMPANY NAME/TD TDhtml:text property=companyName maxlength=75 size=75 //TD/tr /tableBR table id=smallfont tr td id=captionbar colspan=6Contact Information/td /trTR valign=bottom TD valign=centerCONTACT FIRST NAME/TD TD colspan=5html:text property=contactFirstName maxlength =36 size=75 //TD /TRTR TD valign=centerCONTACT LAST NAME/TD TD colspan=5html:text property=contactLastName maxlength =36 size=75 //TD /TRTR TDADDRESS/TD TD colspan=5html:text property=vendorStreetAddress1 maxlength=36 size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCSTREET ADDRESS LINE 1/FONT/TD /TRTR TD/TD TD colspan=5html:text property=vendorStreetAddress2 maxlength=36 size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCSTREET ADDRESS LINE 2/FONT/TD /TRTR TD/TD TDhtml:text maxlength=35 property=vendorCity size=36 //TD TDhtml:text maxlength=3 property=vendorState size=3 //TD TDhtml:text maxlength=7 property=countryCode size=7 value=USA //TD TDhtml:text maxlength=10 property=vendorZip size=10 //TD /TRTR TD/TD TDFONT ID=DESCCITY/FONT/TD TDFONT ID=DESCREGION/STATE/FONT/TD TDFONT ID=DESCCOUNTRY/FONT/TD TDFONT ID=DESCPOSTAL CODE/FONT/TD /TRTR TDPHONE/TD TD colspan=5html:text maxlength=12 property=vendorPhone size=12 //TD /TRTR TD/TD TD colspan=5FONT ID=DESCXXX-XXX-/FONT/TD /TRTR TDEMAIL/TD TD colspan=5html:text maxlength=128 property =vendorEmailAddress size=75 //TD /TRTR TD/TD TD colspan=5FONT ID=DESC[EMAIL PROTECTED]/FONT/TD /TR TR TDITEM LEAD TIME (IN DAYS)/TD TD colspan=5html:text property=poFloat size=2 maxlength =2 / html:text property=busDays value=BUSINESS DAYS //TD /TR /TABLE /html:form
Struts graph language?
I'd like to be able to diagram the work flow of my web application, which uses Struts. At the most naive level, I imagine it to be a graph of nodes (Actions, JSPs) and arcs (URIs and/or ActionMappings). Has anyone specified a graph language to include the following bits of information? * Actions * ActionForms * Request data (including attributes) At a glance, I'd like to be able to answer questions, such as the following? Q1. Where and how was a specific ActionForm instantiated and populated? Q2. What requests does a specific page (html or JSP) include? (Or put another way: where can I go from this page?). Q3. In presenting a given page, where did the data come from? (ActionForm? Bean? Was it on the session or the request? Under what name? etc) I've toyed with http://members.home.net/dlongmuir/struts.html, but found it limited to the data in the struts-config.xml. I'd like to include the JSPs as well as the data flow. Any ideas? -- Martin Zaidel, Senior Software Engineer Cortex eBusiness P/L, Melbourne www.cortexebusiness.com.au
Modifying Custom Tag HTML Libraries in Dreamweaver
From the archive I found that there is a Custom Tag Library Extension for Dreamweaver at http://www.shokker.com/ctlx/ctlx.zip. Can anyone share their experience of using it? satish
Custom Tag Library
Is it possible to use the Struts framework without using any of the Custom Tag libraries? Thanks Satish