RE: How to disable Enter=Submit on struts form?

2004-11-08 Thread jthompson
>What do you want the Enter key to do? Do you want it to move to the next >control, i.e., act like the Tab key? That would be ideal - provided it continued to work as an Enter key within textarea's. - To unsubscribe, e-mai

RE: How to disable Enter=Submit on struts form?

2004-11-08 Thread jthompson
>What do you want the Enter key to do? Do you want it to move to the next >control, i.e., act like the Tab key? That would be ideal. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTEC

How to disable Enter=Submit on struts form?

2004-11-08 Thread jthompson
Anyone know how to stop a struts form from being submitted when the Enter key is pressed and focus isn't on the submit button? (ie I still want Enter to work - I just don't want Enter to equate to pressing submit). - To unsu

Re: How To Display Check Boxes in Struts?

2004-10-05 Thread jthompson
I should add that my previous post provides a mechanism for displaying your check-boxes and capturing the user's responses. You'll still need some code in your Action that processes the form to recover the selected responses, something like this: String[] sc = questionform.getSelectedCl

Re: How To Display Check Boxes in Struts?

2004-10-05 Thread jthompson
I'll assume you have an iteration in your JSP that goes like this: ... where "clients" corresponds to your collection of client beans. (ie you have a method in your form called 'getClients()' that returns a List.) The id "client" is the name I've made up for the bean that comes into sc

Java edit method - design pattern? (O/T)

2004-10-03 Thread jthompson
I'm working on an application API to be deployed with struts, and am interested in how other developers are dealing with 'editing' methods, ie methods that answer a question with a true/false value, but if false is returned, you also want to know why. for example, a credit card application ma

Re: How to treat optional dates?

2004-09-16 Thread jthompson
>Are you sure? Isn't it m-d-y? Yes. Here's the code (getOrderDate returns a java.util.Date) : If row.orderDate is 01-01-0001, blanks are displayed. If row.orderDate is 16-09-2004, '2004-09-16' is displayed. (we do d/m/y in New Zealand). >> Since the posting I made a happy discovery thoug

Re: How to treat optional dates?

2004-09-16 Thread jthompson
Treating them to a nice dinner and a romantic movie usually works ;-) HawHaw - I guess it depends on HOW optional! >Any reason you cant model them as null? The date's already defined as 'not null' on the data-base and I wanted to avoid touching it. Wouldn't null dates appear as 'null' if

How to treat optional dates?

2004-09-16 Thread jthompson
Hi all, I'm curious as to the best way to treat dates in a struts form when entry of the date is optional. Currently I'm storing un-entered optional dates as 1/1/1970. When I come to display an optional date field on a form, I need to decide whether to display a formatted date or a blank (by

RE: [OT]: ant + eclipse not working .. eclipse bug?

2004-09-09 Thread jthompson
I was using v2.1.3, and not referring to any external version of Ant. If you've used previous versions of Eclipse then you're already way more familiar with it than I am, and unlikely to do some of the mad things I did. All the same, I thought it shouldn't generate bad class files - either go

Re: [OT]: ant + eclipse not working .. eclipse bug?

2004-09-09 Thread jthompson
I struck this problem with Eclipse and ant a couple a months ago. It looked as if the java compiler was generating incomplete class files. I can't advise of any known problem or fix to it though - I was only evaluating Eclipse at the time and switched to another tool. Regards, John [EMAIL PR

Re: [OT] File IO

2004-08-26 Thread jthompson
Brian, Not exactly what you're after, but close. The following code creates a directory called 'home' in the root directory of a context. (Class 'File' can be used for manipulating directories as well as files) // create home directory if none String homedirName=serv

Re: Absolute URLs

2004-08-19 Thread jthompson
There are probably better ways, but I've used the following java code for that purpose. public static String getFullURL(HttpServletRequest request) { if (request==null) return null; StringBuffer url = new StringBuffer(); url.append( (request.isSecure() ? "https://"; : "http://";

Re: multiple checkboxes

2004-08-17 Thread jthompson
>say for example I have a list with 10 objects. I am displaying a list on a page with a check box. the object has a boolean property. depending on the value of the property the check box should be checked or unchecked initially.( In case of Multibox all of them are unchecke

Re: multiple checkboxes

2004-08-17 Thread jthompson
To use a multibox, you need a getter and setter method in your form-bean that returns/sets a String array. Each element in this String array corresponds to the value of a checked check-box. Let's say you have a multibox coded like this: ie 1) myFormBean has a method 'getDataBaseR

Re: Specifying HTML form names

2004-08-15 Thread jthompson
You could add your own attribute to a form tag, so that your javascript could distinguish forms based on the value/presence of this attribute. eg the following has 5 different forms, all with the same name and fields, but I've added a new attribute 'mylabel': function showForms() { var

Re: A character decoding problem

2004-08-12 Thread jthompson
Try this: Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 |-+> | | Leandro Melo | | | <[EMAIL PROTECTED]| | | oo.com.br> | | || | |

Re: Should every Action have an associated form?

2004-08-10 Thread jthompson
You don't need a form with an action. I have an action called 'HomeAction' - it's job is to decide where to direct a user based on their allowable actions. It's configured like this in struts-config: ie 'HomeAction' gets called using the url path '/home'. HomeAction

Re: Index on multi-box

2004-08-09 Thread jthompson
Please ignore the previous post, I left out an iterate. I have the following struts labels on a jsp: And it's generating the following html: ... and so on for as many items in the surveySittingForm. What I really want is this: Can I do this with t

Index on multi-box

2004-08-09 Thread jthompson
Hi All, I have the following struts labels on a jsp: And it's generating the following html: ... and so on for as many items in the surveySittingForm. What I really want is this: Can I do this with the multi-box tag? ---

Re: R: How to render html embedded in a text-area?

2004-08-03 Thread jthompson
I've just shown these rich-text editors to our users and they are ecstatic. Thanks to everybody who responded - amazing where a simple question will lead. Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 |-+> | | "Simone - Dev" | |

Re: How to render html embedded in a text-area?

2004-08-02 Thread jthompson
Looks like I went a bit over the top with the embedded html proposal. It seems the users would be content if whatever they'd keyed into a text-area looked the same when subsequently re-displayed as text in a document. ie just preserve the line-feeds, no need for bolding etc. Any ideas?

Re: Brain fart - allowing user to download file

2004-08-02 Thread jthompson
The usual suspects are: 1) not granting public access to the file you're trying to download. 2) your http server not allowing access to the directory or file type specified. Just in case the obvious isn't so obvious today. Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 |-+--

How to render html embedded in a text-area?

2004-08-02 Thread jthompson
Hi All, I have a struts app that lets users input into text-areas. Whatever the user entered will later be displayed as text. To give users some control over presentation, I'd like to allow them to enter html directly into a text-area. Struts appears to convert all html to harmless displayabl

Re: ActionErrors and ActionMessages

2004-07-25 Thread jthompson
Please excuse the question - turns out I'm using Struts 1.1 Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 |-+> | | [EMAIL PROTECTED]| | | o.nz | | || | |

ActionErrors and ActionMessages

2004-07-25 Thread jthompson
I'm trying to use the saveErrors method in an Action class using (request,actionMessages) as parameters, instead of (request,actionErrors) which has been deprecated. I keep getting the following error at compilation though: saveErrors(javax.servlet.http.HttpServletRequest,org.apache.struts.ac

Re: Datasource problem again..

2004-07-20 Thread jthompson
Good point. I've done the same, ie setup a within the of server.xml, and defined my data-source there. I've still got a context.xml, but it's now down to just a couple of lines ie to specify docBase, path and a logger. It looks like this now: Just to make it clear what this is all abou

Re: Datasource problem again..

2004-07-19 Thread jthompson
If you're auto-deploying and can get the DefaultContext to work for you, then that's what I'd do. (I'm not auto-deploying, so my case isn't so straight-forward). You always have the fall-back of configuring Context datasources if you run into trouble. There's an example of configuring a Defau

Re: Datasource problem again..

2004-07-19 Thread jthompson
I recall reading about a month ago that setting up of data-sources in struts-config was purely for some backwards-compatability issue, and was no longer advised. I haven't bothered to do it. I set up my data source in a server.xml context, and it works fine. Like you I'd prefer to have server

Re: MessageUtils and LabelValueBean

2004-07-18 Thread jthompson
http://struts.apache.org/api/org/apache/struts/util/LabelValueBean.html Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 |-+> | | Michael McGrady | | | <[EMAIL PROTECTED]| | | ady.com> | |

Re: webapp deployment

2004-07-12 Thread jthompson
Are you using Tomcat in-process with the apache server on an AS/400? Your problem, and the fact you don't have .war deployment sound familar. John Thompson [EMAIL PROTECTED] |-+> | | Phyl | | | <[EMAIL P

Re: newbie question on indexed properties

2004-07-09 Thread jthompson
Thanks so much Bill, that worked beautifully. Regards, John |-+> | | Bill Siggelkow | | | <[EMAIL PROTECTED]| | | th.net> | | | Sent by: news| | | <[

newbie question on indexed properties

2004-07-08 Thread jthompson
I have a form bean with a string array defined as a property, with a corresponding set/get like this: private String[] answers = { "Answer 1","Answer 2","Answer 3","Answer 4","Answer 5" }; public String[] getAnswers() { return (this.answers); } public void setAnswers(String[] value) { this.an

Re: Form tag problem - Another newbie tip

2004-07-05 Thread jthompson
Speaking of newbie tips, I've been banging my head with struts/JSTL for the past two weeks and discovered this gem today. <% if (image.trim().length()>0) { %> ... This lets me grab an object out of a form bean and switch to JSP script mode so that I can use the full force of Java rather t

RE: how to de-reference bean name using java method?

2004-07-05 Thread jthompson
Thanks Erez, great answer. Regards, John [EMAIL PROTECTED] Ph (09) 372-5010 |-+> | | Erez Efrati | | | <[EMAIL PROTECTED]| | | et.il> | | || |

how to de-reference bean name using java method?

2004-07-04 Thread jthompson
I'd like to be able to code the following line: where Constants.HOME_DIR_KEY is a java method that returns the name of bean "home_directory". The following two lines work: <%= Constants.HOME_DIR_KEY %>// returns the value "home_directory" I suppose it doesn't wor

recover tomcat home directory

2004-06-30 Thread jthompson
I'd like to create directories programmatically (using a struts Action class) in a tomcat webapp directory. ie, with a url of http://domain.com:8080/testapp/... that maps to directory /testing/webapps/testapp/... how do I recover the '/testing/webapps/testapp' part in an Action class? John

Re: Converting Java Code in JSP to JSTL

2004-06-28 Thread jthompson
You could use: Click Me Threads:  Thanks for all the supports and help that I have received so far on this topic. I have another question about the converstion of Java code: Click Me <%else {%> Threads:  <%}%> 1. what is the JSTL equivalent of the <

Re: Struts - How to recover collection element

2004-06-23 Thread jthompson
Superb answer Bill. I've coded the following which correctly gets the OptionsCollection, but I'm stumped as to what to substitute in place of 'MyForm.key': Type: There are a couple of ways o

Struts - How to recover collection element

2004-06-23 Thread jthompson
I've loaded a collection of valid options and their descriptions as a ServletContext attribute, for use in an tag. It works as intended in a generated html tag. Once a user selects an option, the option value (rather than the description) is recorded in a form bean, and the form bean is for