Problem with unused Formbean-Properties
Hello, i have a formBean which has a property id. this id is not shown to the user and it has no associated input field. If the user posts the FormData the id contains the prior value - as expected. But since we implemented the reset() method in every formBean, struts calls this method and deletes my id. What i need is that struts uses the formBean for displaying the Page and posting the data without calling reset... i thought this could be handled with the param scope (session/request) but struts calls reset anyway... I need to store this id field from the get-request and access it in the post request but i dont want to store it as attribute... any ideas? thanks Andreas Langmann -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
a little riddle...
Hi, i have the following code: c:forEach var=fach items=${f_myformbean.fachListe} html:select property=fachListe[0].ufId styleClass=CB_Edit html:option value=option one/html:option /html:select /c:forEach This works, but access for each object in fachListe the object with id 0. if i do the following inside the loop: % counter++; % html:select property=fachListe[%= counter %].ufId styleClass=CB_Edit html:option value=option one/html:option /html:select i got fachListe[].ufId and an error any ideas? Must i do this without jstl ? I want struts to fill my formBean with the entered data thanks, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: a little riddle...
forget it... it's so easy, if you know how -Ursprüngliche Nachricht- Von: Andreas Langmann [mailto:[EMAIL PROTECTED]] Gesendet: 29.11.2002 16:11 An: Struts User Mailingliste Betreff: a little riddle... Hi, i have the following code: c:forEach var=fach items=${f_myformbean.fachListe} html:select property=fachListe[0].ufId styleClass=CB_Edit html:option value=option one/html:option /html:select /c:forEach This works, but access for each object in fachListe the object with id 0. if i do the following inside the loop: % counter++; % html:select property=fachListe[%= counter %].ufId styleClass=CB_Edit html:option value=option one/html:option /html:select i got fachListe[].ufId and an error any ideas? Must i do this without jstl ? I want struts to fill my formBean with the entered data thanks, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: java.sql.Date again!!
hmmm... make the following files... package de.km.bw.estat.struts.utils; import java.sql.Date; public class DateWrapper extends java.sql.Date { static java.text.DateFormat df = new java.text.SimpleDateFormat(dd-MM-); public static void setFormatStr(String formatStr) { df = new java.text.SimpleDateFormat(formatStr); } public DateWrapper(long date) { super(date); } public String toString() { return df.format(this); } } /** coverts java.util.Date to String using BeanUtils ***/ package de.km.bw.estat.struts.utils; import org.apache.commons.beanutils.Converter; import java.text.*; import java.util.*; public class DateBeanUtilsConverter implements Converter { private String formatPattern = null; public void setFormatPattern(String formatPattern) { this.formatPattern = formatPattern; } public Object convert(Class type, Object value) { DateWrapper date = null; if (value != null (value instanceof String) (type == DateWrapper.class)) { try { String s = value.toString(); SimpleDateFormat formatter = new SimpleDateFormat(formatPattern); date = new DateWrapper(formatter.parse(s).getTime()); } catch (Exception e) { //ErrorLogging.println(DateBeanUtilsConverter: + e); } } return date; } } package de.km.bw.estat.struts.utils; import java.text.*; import java.util.*; import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.*; public class StringBeanUtilsConverterDate implements Converter { //~ Statische Variblen und Initialisierer --- private static final StringConverter stringConverter = new StringConverter(); //~ Instanz-Variablen --- private String formatPattern = null; //~ Methoden /** * TODO_documentieren * * @param formatPattern TODO_documentieren */ public void setFormatPattern(String formatPattern) { this.formatPattern = formatPattern; } /** * TODO_documentieren * * @param type TODO_documentieren * @param value TODO_documentieren * * @return TODO_documentieren */ public Object convert(Class type, Object value) { Object returnValue = null; if (value != null) { if ((type == String.class) (value instanceof DateWrapper)) { SimpleDateFormat formatter = new SimpleDateFormat(formatPattern); String dateString = formatter.format(value); returnValue = dateString; } else { returnValue = stringConverter.convert(type, value); } } return returnValue; } } * add the following static block to your BaseAction: // for static block import org.apache.commons.beanutils.ConvertUtils; import org.apache.log4j.Logger; import org.apache.struts.action.*; import org.apache.struts.actions.*; import org.apache.struts.util.MessageResources; static { DateBeanUtilsConverter dateConverter = new DateBeanUtilsConverter(); dateConverter.setFormatPattern(dd.MM.); StringBeanUtilsConverterDate myStringConverter = new StringBeanUtilsConverterDate(); myStringConverter.setFormatPattern(dd.MM.); ConvertUtils.register(dateConverter, DateWrapper.class); ConvertUtils.register(myStringConverter, String.class); } ** thats it. now you'll use DateWrapper Class in Formbeans and anything is fine. greetings, Andreas -Ursprüngliche Nachricht- Von: Slava_L [mailto:[EMAIL PROTECTED]] Gesendet: 25.11.2002 06:12 An: Struts Users Mailing List Betreff: java.sql.Date again!! Well, are there any changes about java.sql.Date-in-Struts problem? What is the best appropriate way to solve the representation poblem (i.e. when Date converts in non-localezed string like -MM-DD) ? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: java.sql.Date again!!
-Ursprngliche Nachricht- For java.sql.Date the default format is -mm-dd. You can change it however with the following key in your resourcebundle: org.apache.struts.taglib.bean.format.sql.date=mm/dd/ no, that will not work. in beta-2 this key is not used correctly... (look into the sources or give it a try). greetings, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: AW: java.sql.Date again!!
Thats it. I use input fields and a german date format Uhh, maybe input fields with java.sql.Date? I convert them by myself with this mask as well, thou I plan to use a custom SqlDateConverter class for this task. Soon soon it'll come. You can re-use my DateWrapper Class (prior posting this morning) I hope that the next struts release can handle this without so much customizing greetings, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
XML Include for validation.xml
Hello, i tried the following: ** ?xml version=1.0 encoding=ISO-8859-1 standalone=yes ? !DOCTYPE validation [ !ENTITY a SYSTEM file://C:/Programme/eclipse/workspace/appl/build/webapp/WEB-INF/validation/ validation-a.xml !ENTITY b SYSTEM file://C:/Programme/eclipse/workspace/appl/build/webapp/WEB-INF/validation/ validation-b.xml !ENTITY c SYSTEM /WEB-INF/validation/validation-c.xml ] form-validation formset a; b; c; /formset /form-validation * and it works... but how can i use relative url's for the included files? This example loads validation-a, and validation-b, but not c... I dont want to use http://127.0.0.1/...xml; because i dont want to give the xml files to public http access The same problem in struts-config xml for including form-bean-definitions was no problem... it works fine, but here i got problems with missing dtd if i use the header from struts-examples... tia Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: AW: java.sql.Date again!!
Hmmm make a constructor accepting java.sql.Date for DateWrapper and a getDate() method returning java.sql.Date. I have no idea how to do more integration any ideas? greetings, Andreas -Ursprngliche Nachricht- Von: Slava_L [mailto:[EMAIL PROTECTED]] Gesendet: 25.11.2002 12:01 An: Struts Users Mailing List Betreff: Re: AW: java.sql.Date again!! But is it possible to hide DateWrapper behind java.sql.Date ? i wish to use JDBC type in my FormBean - Original Message - From: Andreas Langmann [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 25, 2002 6:57 PM Subject: AW: AW: java.sql.Date again!! Thats it. I use input fields and a german date format Uhh, maybe input fields with java.sql.Date? I convert them by myself with this mask as well, thou I plan to use a custom SqlDateConverter class for this task. Soon soon it'll come. You can re-use my DateWrapper Class (prior posting this morning) I hope that the next struts release can handle this without so much customizing greetings, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: AW: java.sql.Date again!!
That would be nice no, for display struts uses DateWrapper.toString(), the converters are used for filling formBeans If you register these Converters for java.sql.Date, the display-format would be wrong but you could change the display-format manually (in the jsp page) -Ursprngliche Nachricht- Von: Slava_L [mailto:[EMAIL PROTECTED]] Gesendet: 25.11.2002 12:22 An: Struts Users Mailing List Betreff: Re: AW: java.sql.Date again!! In your recent msg you posted 3 classes and as i can see one for String to Date (DateBeanUtilsConverter), the second (StringBeanUtilsConverterDate) for Date to String - duz Struts invoke it instead of Class.toString method ? - Original Message - From: Andreas Langmann [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 25, 2002 7:09 PM Subject: AW: AW: java.sql.Date again!! Hmmm make a constructor accepting java.sql.Date for DateWrapper and a getDate() method returning java.sql.Date. I have no idea how to do more integration any ideas? greetings, Andreas -Ursprngliche Nachricht- Von: Slava_L [mailto:[EMAIL PROTECTED]] Gesendet: 25.11.2002 12:01 An: Struts Users Mailing List Betreff: Re: AW: java.sql.Date again!! But is it possible to hide DateWrapper behind java.sql.Date ? i wish to use JDBC type in my FormBean - Original Message - From: Andreas Langmann [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, November 25, 2002 6:57 PM Subject: AW: AW: java.sql.Date again!! Thats it. I use input fields and a german date format Uhh, maybe input fields with java.sql.Date? I convert them by myself with this mask as well, thou I plan to use a custom SqlDateConverter class for this task. Soon soon it'll come. You can re-use my DateWrapper Class (prior posting this morning) I hope that the next struts release can handle this without so much customizing greetings, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: AW: java.sql.Date again!!
i had tested it inside the execute method, and all worked fine. It will slow down the execute a bit, but i could'nt realize a change ;-) Better way would be convertutils use a context-object to set format-strings... but i think a solution for this problem could be in next release And your Converters are the one I was planning to implement. Thank you. Thank you. Nothing to thank, it was a mailinglist co-production ;-) greetings, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: java.sql.Date again!!
hmmm... for conversion from form-bean to a displayable string, struts uses DateWrapper.toString(). it should use the converter instead, but that dont work. Bug in struts?! Might its no bug and this class is used for other cases... Had you set a break point and debugged the thing? greetings, Andreas -Ursprngliche Nachricht- Von: Slava_L [mailto:[EMAIL PROTECTED]] Gesendet: 25.11.2002 12:56 An: Struts Users Mailing List Betreff: Re: java.sql.Date again!! while i wuz playin' with these convertors i could not make second convertor StringBeanUtilsConverterDate excuted. When exactly Struts will invoke it -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: AW: java.sql.Date again!!
As a rule, FormBeans should only work with Strings. For example, suppose the date field on your FormBean is supposed to be populated from a user's form submission. What if the user types in a bad value, and you want to return to the submission page to flag the error with the problematic field highlighted? For that you need to capture the value initially as a String, because otherwise automatic type conversion will lose the user's original (bad) value. See the archives of this list for details. for that, i use the javascript validation, so this case never happens. And the formBeans containing Integer and Date objects are perfect as parameters for business-methods. for example: form_bean_xxx contains teacher : fb_teacher fb_teacher contains name birthdate : DateWrapper you can give form_bean.teacher to a session bean method. so you need not much parameters and no separate simpletypes greetings, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: XML Include for validation.xml
At the same level, have you tried: !ENTITY c SYSTEM validation-c.xml ^ yes parser says something about relative uri not allowed without base uri. think it's a bug in common-validation? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
AW: Struts 1.1 beta2 on Weblogic 6.1 SP3 deployment problem
We had detected a problem with weblogic, which could be of interest. If you deploy ear files, Weblogic 6.1 will extract only a subset of the containing files inside. For example, our application had problems finding configuration files for logging, resources, etc. because weblogic dont extract these. Solution was to deploy no ear file, but an war and the ejb-jar files. To do so you must have all jars in weblogic classpath which are used by ejb and web application... Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: moving from struts-b2 to actual nigthly build...
David Graham wrote: If the Tiles request processor isn't being called then there's probably an error in your struts config. Can you post the section that defines the plugin? !-- == Controller Configuration -- controller / !-- == Message Resources Definitions -- message-resources parameter=messages.ApplicationResources / !-- == Plug Ins Configuration = -- plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathname value=/WEB-INF/validation/validator-rules.xml, /WEB-INF/validation/validation.xml/ /plug-in plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles/tile-frameset-content-definitions.xml, /WEB-INF/tiles/tile-dv-block-definitions.xml, /WEB-INF/tiles/tile-dv-content-definitions.xml, /WEB-INF/tiles/tile-dv-fusszeile-definitions.xml, /WEB-INF/tiles/tile-bv-block-definitions.xml, /WEB-INF/tiles/tile-bv-content-definitions.xml / set-property property=moduleAware value=true / /plug-in * tia, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: moving from struts-b2 to actual nigthly build...
It works now... but i can't say exactly, what i've changed... the main struts-config file was correct, but in the sub-apps config files were differences... i think, i need in every config-file in every tiles-plugin-definition the same set (all) of tiles-def-files. thanks, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Where can i get struts-el ???
Hello, i'm searching for struts-el but can't find the struts-html-el.tld Are they included in struts? Thanks, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Where can i get struts-el ???
I found it, build it and - now i need to upgrade to nightly build version... or can i run struts-el with beta2 (i think not) thanks, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
moving from struts-b2 to actual nigthly build...
Hmmm... its not so easy. I changed some xml files and now everything works fine. except of my sub-applications. If i access them, i get a message HTTP ERROR: 404 /webapp/dv/dv_07_03 Not Found RequestURI=/webapp/dv/a_dv_07_03.do I assume that struts found my action definition in struts-config-dv.xml action path=/a_dv_07_03 type=de.km.bw.estat.struts.dv.Dv_07_03_Action name=f_dv_07_03 scope=session validate=true parameter=method forward name=success path=dv_07_03/ /action But why it wont load my tile-dv-content-definitions, where dv_07_03 is defined? And - why cant i see an error message ??? Struts throws me dead with thousands of info-Messages, but no error occurs... 259913 [SocketChannelListener-0] INFO action.RequestProcessor - Processing a 'GET' for path '/a_dv_07_03' 259913 [SocketChannelListener-0] INFO org.apache.struts.action.RequestProcessor - Processing a 'GET' for path '/a_dv_07_03' thanks, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: moving from struts-b2 to actual nigthly build...
David Graham wrote: It might need to be forward name=success path=dv_07_03.jsp/ David From: Andreas Langmann [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: moving from struts-b2 to actual nigthly build... Date: Wed, 20 Nov 2002 17:13:40 +0100 Hmmm... its not so easy. I changed some xml files and now everything works fine. except of my sub-applications. If i access them, i get a message HTTP ERROR: 404 /webapp/dv/dv_07_03 Not Found RequestURI=/webapp/dv/a_dv_07_03.do I assume that struts found my action definition in struts-config-dv.xml action path=/a_dv_07_03 type=de.km.bw.estat.struts.dv.Dv_07_03_Action name=f_dv_07_03 scope=session validate=true parameter=method forward name=success path=dv_07_03/ /action But why it wont load my tile-dv-content-definitions, where dv_07_03 is defined? And - why cant i see an error message ??? Struts throws me dead with thousands of info-Messages, but no error occurs... 259913 [SocketChannelListener-0] INFO action.RequestProcessor - Processing a 'GET' for path '/a_dv_07_03' 259913 [SocketChannelListener-0] INFO org.apache.struts.action.RequestProcessor - Processing a 'GET' for path '/a_dv_07_03' no, i am using tiles and i detected via debugging that the tiles-requestprocessor can't be called, but its as plugin in the struts-config.xml... any ideas? tia Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to lookup key values...
Hello, i have lists with the following data key / value list-example 1 / Hund 2 / Katze 3 / Maus is there a tag to exchange the key with the value? it would be great, if i can store all key/value pairs in one List (HashMap), so they would be referenced by listname and key... thanks, Andreas -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Who knows the name of my FormBean?
Hello, the FormBean Name is accessed via tiles:getAsString name=formName/ in the layout_content.jsp. But it is not available in the tiles is there a way to do this? I need it for a logic:iterate tag: logic:iterate id=bg type=Gen_bg_Fb name=%= formName % property=bgListe (I have an FormBean containing the Property bgListe, an array of Gen_bg_Fb) tia Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
My Tile-Jsp needs to know the FormBean name...
Hello, the FormBean Name is accessed via tiles:getAsString name=formName/ in the layout_content.jsp. But it is not available in the tiles is there a way to do this? I need it for a logic:iterate tag: logic:iterate id=bg type=Gen_bg_Fb name=%= formName % property=bgListe (I have an FormBean containing the Property bgListe, an array of Gen_bg_Fb) tia Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Validation Question
Hello, i had updated to validator-1.0 (from the struts-1.1-b2 version) and my validation just prints out the following code... // End -- /SCRIPT I miss the opening tag and my validation rules... the tag code is: html:javascript formName=%= formName % method=subValidate dynamicJavascript=true staticJavascript=false/ formName is correct, and all works perfectly with the pre-release validator version. Must i update Struts (to nightly build :-( ) ?? Tia Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Validator Problem
dynamicJavascript=false generates dynamic javascript specially for a specified formName !this generated code needs the general javascript staticJavascript=true generates general javascript (functions for the generated code) so you can generate in every page the dynamic code and the general code only in one page. (dont forget to include the general code - jsp-page into every page. -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Action takes long time to complete
if the tasks result is not important for fulfilling the request make a separate process, so the action method can finish before. Andreas David Bolsover wrote: Hi all I have an action that takes a very long time to complete. Advice please - how do I forward to a new page before the tasks the action has started have completed? db -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
html:select question
Hello, i use a selectbox... the variables sb_lx and sb_l are inside the formbean. With the attached jsp-code i need to put the object sb_l from formbean into context request.setAttribute(sb_l, myform.getSb_l()); html:select property=sb_lx multiple=false size=6 html:options collection=sb_l property=id labelProperty=value/ /html:select So it works fine... but is there a way to do it without the setAttribute? Tnx, Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: html:select question
Struts-el is a good solution for this. html-el:options collection=${formean.sb_l} property=id labelProperty=value/ /html:select Hmm... thats great! Thanks for advice! Andreas -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Using own Date type in Formbeans...
Hello, i am using a user-defined Date type for FormBeans. So i can change the Display-Format (in MyDate.toString()) But now i get an error message (see below). Must i change the constructor to accept the new Format? thanks, Andreas HTTP ERROR: 500 BeanUtils.populate INFO: Processing a 'POST' for path '/a_dv_07_03_bildungsgang_aendern' 13:11:58.213 WARN!! Exception for /webapp/dv/a_dv_07_03_bildungsgang_aendern.do java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property Utils.java:1650) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property Utils.java:1545) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils. java:1574) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:919 ) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc essor.java:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja va:246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:129 2) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366 ) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicati onHandler.java:292) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:5 77) at org.mortbay.http.HttpContext.handle(HttpContext.java:1682) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplication Context.java:544) at org.mortbay.http.HttpContext.handle(HttpContext.java:1632) at org.mortbay.http.HttpServer.service(HttpServer.java:875) at org.mortbay.http.HttpConnection.service(HttpConnection.java:806) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956) at org.mortbay.http.SocketChannelListener.handle(SocketChannelListener.j ava:284) at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743) at java.lang.Thread.run(Thread.java:536) -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Using own Date type in Formbeans...
Additional Information: i extend java.sql.Date (also tried java.util.Date, but no difference...) Andreas Langmann wrote: Hello, i am using a user-defined Date type for FormBeans. So i can change the Display-Format (in MyDate.toString()) But now i get an error message (see below). Must i change the constructor to accept the new Format? thanks, Andreas HTTP ERROR: 500 BeanUtils.populate INFO: Processing a 'POST' for path '/a_dv_07_03_bildungsgang_aendern' 13:11:58.213 WARN!! Exception for /webapp/dv/a_dv_07_03_bildungsgang_aendern.do java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property Utils.java:1650) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property Utils.java:1545) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils. java:1574) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:919 ) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc essor.java:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja va:246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:129 2) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366 ) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicati onHandler.java:292) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:5 77) at org.mortbay.http.HttpContext.handle(HttpContext.java:1682) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplication Context.java:544) at org.mortbay.http.HttpContext.handle(HttpContext.java:1632) at org.mortbay.http.HttpServer.service(HttpServer.java:875) at org.mortbay.http.HttpConnection.service(HttpConnection.java:806) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956) at org.mortbay.http.SocketChannelListener.handle(SocketChannelListener.j ava:284) at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743) at java.lang.Thread.run(Thread.java:536) -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Using own Date type in Formbeans...
Actually i use Struts Milestone build. Should i try to update used librarys? TIA Andreas Langmann jsp ---cut--- html:text property=bildungsgang.txt_bgaend_gueltigkeit_von/ ---cut--- FormBean ---cut--- // java.sql.Date mTxtBgaendGueltigkeitVon; public java.sql.Date getTxt_bgaend_gueltigkeit_von() { return mTxtBgaendGueltigkeitVon; } public void setTxt_bgaend_gueltigkeit_von(java.sql.Date txtBgaendGueltigkeitVon) { mTxtBgaendGueltigkeitVon = txtBgaendGueltigkeitVon; } ---cut--- CLASS DateWrapper package de.km.bw.estat.struts.utils; import java.sql.Date; /** * @author alangman * */ public class DateWrapper extends java.sql.Date { static String cFormatStr = dd.MM.; public static void setFormatStr(String formatStr) { cFormatStr = formatStr; } public DateWrapper(long date) { super(date); } public String toString() { java.text.DateFormat df = new java.text.SimpleDateFormat(cFormatStr); return df.format(this); } } Postfach 4711 wrote: Hello Andreas, given your infos I can only guess what goes wrong. Setting the props in your action form fails because of your setters. Can you mail your jsp and your form bean. Friday, November 8, 2002, 2:08:49 PM, you wrote: AL Additional Information: i extend java.sql.Date (also tried AL java.util.Date, but no difference...) AL Andreas Langmann wrote: Hello, i am using a user-defined Date type for FormBeans. So i can change the Display-Format (in MyDate.toString()) But now i get an error message (see below). Must i change the constructor to accept the new Format? thanks, Andreas HTTP ERROR: 500 BeanUtils.populate INFO: Processing a 'POST' for path '/a_dv_07_03_bildungsgang_aendern' 13:11:58.213 WARN!! Exception for /webapp/dv/a_dv_07_03_bildungsgang_aendern.do java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property Utils.java:1650) at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property Utils.java:1545) at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils. java:1574) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:919 ) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc essor.java:779) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja va:246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:129 2) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:366 ) at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicati onHandler.java:292) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:5 77) at org.mortbay.http.HttpContext.handle(HttpContext.java:1682) at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplication Context.java:544) at org.mortbay.http.HttpContext.handle(HttpContext.java:1632) at org.mortbay.http.HttpServer.service(HttpServer.java:875) at org.mortbay.http.HttpConnection.service(HttpConnection.java:806) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:956) at org.mortbay.http.SocketChannelListener.handle(SocketChannelListener.j ava:284) at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:743) at java.lang.Thread.run(Thread.java:536) -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- Best regards, Dirk -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org -- Dipl. Ing. (BA
Re: Using own Date type in Formbeans...
Yeah! It works my FormBean variable type is myDate (from java.sql.Date or java.util.Date ) and i used the code from an older posting to make it. Okay, what to do: Change the Date type in the code below to myDate. And now your date type will use your format for display... - Date: Thu, 17 Oct 2002 12:22:35 -0400 From: Rick Reumann [EMAIL PROTECTED] Subject: [ConvertUtils] Converter for java.util.Date Content-Type: text/plain; charset=us-ascii Hey Elder, (posting this to Struts list as well in case anyone else finds it useful while digging through the archives) I modified the code you sent just a bit and also provided a method taking a format String for how they want the date formatted (actually someone might want to modify the code with a default format, but I want to be forced to provide one). I still haven't gotten around to actually modifying the StringConverter class to handle the other direction (String to java.util.Date) to avoid having to register the extra custom StringConverter class below. I'll get around to it some time:) To use these converters so that BeanUtils.copyProperties( ) works in both directions I just added a static block to the top of my dispatch Action ... static { DateBeanUtilsConverter dateConverter = new DateBeanUtilsConverter(); dateConverter.setFormatPattern( MMdd ); StringBeanUtilsConverterDate myStringConverter = new StringBeanUtilsConverterDate(); myStringConverter.setFormatPattern( MMdd ); ConvertUtils.register( dateConverter, java.util.Date.class ); ConvertUtils.register( myStringConverter, String.class ); } The two classes are listed below. All seems to be working fine. /** coverts java.util.Date to String using BeanUtils ***/ import org.apache.commons.beanutils.Converter; import java.text.*; import java.util.*; import corporate.*; public class DateBeanUtilsConverter implements Converter { private String formatPattern = null; public void setFormatPattern(String formatPattern) { this.formatPattern = formatPattern; } public Object convert(Class type, Object value) { Date date = null; if (value != null (value instanceof String) (type == Date.class)) { try { String s = value.toString(); SimpleDateFormat formatter = new SimpleDateFormat(formatPattern); date = formatter.parse(s); } catch (Exception e) { ErrorLogging.println(DateBeanUtilsConverter: + e); } } return date; } } /** coverts String to java.util.Date using BeanUtils ***/ import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.*; import java.text.*; import java.util.*; import corporate.*; public class StringBeanUtilsConverterDate implements Converter { private static final StringConverter stringConverter = new StringConverter(); private String formatPattern = null; public void setFormatPattern(String formatPattern) { this.formatPattern = formatPattern; } public Object convert(Class type, Object value) { Object returnValue = null; if (value != null) { if (type == String.class (value instanceof Date)) { SimpleDateFormat formatter = new SimpleDateFormat(formatPattern); String dateString = formatter.format(value); returnValue = dateString; } else { returnValue = stringConverter.convert(type, value); } } return returnValue; } } - -- Dipl. Ing. (BA) Andreas Langmann Software Developer ISB AG Karlstr. 52-54 76133 Karlsruhe Telefon: +49 (0)721/82800-0 Telefax: +49 (0)721/82800-82 Email: [EMAIL PROTECTED] Internet: http://www.isb-ag.de -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org