html:javascript simple question
Hi, In my jsp's i do on the bottom of the jsp: script today(); /script In my head section i then define the method... function today(){ var today = new Date(); var month = today.getMonth()+1; var year = today.getYear(); var day = today.getDate(); if(day10) day = 0 + day; if(month10) month= 0 + month ; if(year1000) year+=1900; var date=day + / + month + / + year; window.document.forms[0]'shipments.shipmentDate'].value=date; } This is working fine, but thaught might there be a better way doing this ? Using html:javascript ? Thanks !! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:javascript simple question
the DateTime taglib would perfectly fit your needs: http://jakarta.apache.org/taglibs/doc/datetime-doc/intro.html Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 19 februari 2004 11:27 To: [EMAIL PROTECTED] Subject: html:javascript simple question Hi, In my jsp's i do on the bottom of the jsp: script today(); /script In my head section i then define the method... function today(){ var today = new Date(); var month = today.getMonth()+1; var year = today.getYear(); var day = today.getDate(); if(day10) day = 0 + day; if(month10) month= 0 + month ; if(year1000) year+=1900; var date=day + / + month + / + year; window.document.forms[0]'shipments.shipmentDate'].value=date; } This is working fine, but thaught might there be a better way doing this ? Using html:javascript ? Thanks !! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html:javascript simple question
Or with JSTL: %@ taglib prefix=fmt uri=http://java.sun.com/jstl/fmt; % jsp:useBean id=today class=java.util.Date/ script type=text/javascript language=javascript !-- function today() { var date = fmt:formatDate value=${today} pattern=dd/MM//; window.document.forms[0]['shipments.shipmentDate'].value = date; } // -- /script But seeing as how this is a Struts list, why not handle it in ActionForm.reset (or wherever else you might be initializing the form's data)? Quoting Turner Benjamin [EMAIL PROTECTED]: the DateTime taglib would perfectly fit your needs: http://jakarta.apache.org/taglibs/doc/datetime-doc/intro.html Ben -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 19 februari 2004 11:27 To: [EMAIL PROTECTED] Subject: html:javascript simple question Hi, In my jsp's i do on the bottom of the jsp: script today(); /script In my head section i then define the method... function today(){ var today = new Date(); var month = today.getMonth()+1; var year = today.getYear(); var day = today.getDate(); if(day10) day = 0 + day; if(month10) month= 0 + month ; if(year1000) year+=1900; var date=day + / + month + / + year; window.document.forms[0]'shipments.shipmentDate'].value=date; } This is working fine, but thaught might there be a better way doing this ? Using html:javascript ? Thanks !! -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Simple Question about Long property
I have a form with a Long property; I used Long instead of long to have the property nullable, but if the (html) form includes such a property, struts sets the corresponding bean property to 0, even if it has no value (value=); what I'd like is struts to leave the property at null!! It also behaves so if the (html) property has non numeric value!! Any help is appreciated Renato Renato Romano Sistemi e Telematica S.p.A. Calata Grazie - Vial Al Molo Giano 16127 - GENOVA e-mail: [EMAIL PROTECTED] Tel.: 010 2712603 _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
checkbox - simple question
Hello, The value of a checkbox is added to the sessionScope. How can i print checked box 1 and not checked box1 using the logic taglib ? Thanks
simple question
How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks !
Re: simple question
It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
hi, perhaps it is this: (look at: http://jakarta.apache.org/struts/userGuide/struts-bean.html#define ) type: Specifies the fully qualified class name of the value to be exposed as the id attribute. [ java.lang.String (if you specify a value attribute) or java.lang.Object otherwise. ] [RT Expr] greetings -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:41 PM To: Struts Users Mailing List Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
I can write bean:write name=url/ but not %=url% then i get an org.apache.jasper.JasperException: Unable to compile class for JSP any idea ? Thanks ! - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:40 PM Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
No thats not it, It's not working with or without type... org.apache.jasper.JasperException Thx - Original Message - From: Matthias Wessendorf [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:42 PM Subject: RE: simple question hi, perhaps it is this: (look at: http://jakarta.apache.org/struts/userGuide/struts-bean.html#define ) type: Specifies the fully qualified class name of the value to be exposed as the id attribute. [ java.lang.String (if you specify a value attribute) or java.lang.Object otherwise. ] [RT Expr] greetings -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:41 PM To: Struts Users Mailing List Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
I think it may depend on the servlet container. Currently i am unable to do it (tomcat 5) however I know I have done it before in one of the 4.x versions. Camron G. Levanger The Dreamlab www.dreamlabmedia.com (866) 890-3705 On Jan 5, 2004, at 7:12 AM, dirk wrote: I can write bean:write name=url/ but not %=url% then i get an org.apache.jasper.JasperException: Unable to compile class for JSP any idea ? Thanks ! - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:40 PM Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature
Re: simple question
Here are some random guesses.. Looks like it should work to me. I use html-el:form action=${url} usually url is defined in a tiles def but what you're doing should work fine.. what about c:set var=url value=/foo.do / to test if its some problem with the bean:define tag you could try. % java.lang.String url = /foo.do; pageContext.setAttribute(url,url); % or perhaps your container is storing your variable as an object. so html:form action=%= url.toString() % Cheers Mark On 5 Jan 2004, at 15:15, Camron G. Levanger wrote: I think it may depend on the servlet container. Currently i am unable to do it (tomcat 5) however I know I have done it before in one of the 4.x versions. Camron G. Levanger The Dreamlab www.dreamlabmedia.com (866) 890-3705 On Jan 5, 2004, at 7:12 AM, dirk wrote: I can write bean:write name=url/ but not %=url% then i get an org.apache.jasper.JasperException: Unable to compile class for JSP any idea ? Thanks ! - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:40 PM Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple question on displaytag
if I put paging.banner.placement=bottom i get the paging as well in bottom and in top. How can i put it only in the bottom ? Thanks
simple question
I have an action which contains the following: String hulp=request.getParameter(users.userId); return mapping.findForward(CONTINUE); continue points to user.jsp. How can i use in the file user.jsp the value of hulp ? eg: %=hulp% is not working. Thx
Re: simple question
hi, try this, %= request.getParameter(users.userId) % dirk wrote: I have an action which contains the following: String hulp=request.getParameter(users.userId); return mapping.findForward(CONTINUE); continue points to user.jsp. How can i use in the file user.jsp the value of hulp ? eg: %=hulp% is not working. Thx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
Try this. String hulp=request.getParameter(users.userId); request.setAttribute(hulp,hulp); return mapping.findForward(CONTINUE); and in jsp %=hulp% it will work Thanks Nazeer -Original Message- From: dirk [mailto:[EMAIL PROTECTED] Sent: Monday, December 22, 2003 10:42 AM To: Struts Users Mailing List Subject: simple question I have an action which contains the following: String hulp=request.getParameter(users.userId); return mapping.findForward(CONTINUE); continue points to user.jsp. How can i use in the file user.jsp the value of hulp ? eg: %=hulp% is not working. Thx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
the value is null allthought the value of help is not null. But i cannot access it in the jsp... thx ! - Original Message - From: François Richard [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, December 22, 2003 4:45 PM Subject: Re: simple question hi, try this, %= request.getParameter(users.userId) % dirk wrote: I have an action which contains the following: String hulp=request.getParameter(users.userId); return mapping.findForward(CONTINUE); continue points to user.jsp. How can i use in the file user.jsp the value of hulp ? eg: %=hulp% is not working. Thx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
in the JSP you need to do: % String hulp = (String)request.getAttribute(hulp); % then you can use: %= hulp % often i do this (instead of the one above) to make sure u get the parameter: % String hulp = (String)request.getParameter(hulp); if(hulp==null) hulp = (String)request.getAttribute(hulp); % HTH - Original Message - From: dirk [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, December 22, 2003 3:55 PM Subject: Re: simple question the value is null allthought the value of help is not null. But i cannot access it in the jsp... thx ! - Original Message - From: François Richard [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, December 22, 2003 4:45 PM Subject: Re: simple question hi, try this, %= request.getParameter(users.userId) % dirk wrote: I have an action which contains the following: String hulp=request.getParameter(users.userId); return mapping.findForward(CONTINUE); continue points to user.jsp. How can i use in the file user.jsp the value of hulp ? eg: %=hulp% is not working. Thx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: simple question
hi, you can also use in jsp: bean:write name=hulp/ and in action before: String hulp=request.getParameter(users.userId); request.setAttribute(hulp,hulp); //FORWARD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple question
I want to create a select box with the values 1 thru 100 how can i do that? What i have is: But that is not working. Any idea ? Thanks ! html:select property=selectBox styleClass=content % for(int i=0;i999;i++){ % html:option value=%=i%%=i%/html:option %}% /html:select
RE: simple question
html:option value='%=+i%'%=+i%/html:option Naveen -Original Message- From: dirk [mailto:[EMAIL PROTECTED] Sent: Friday, December 19, 2003 7:51 AM To: Struts Users Mailing List Subject: simple question I want to create a select box with the values 1 thru 100 how can i do that? What i have is: But that is not working. Any idea ? Thanks ! html:select property=selectBox styleClass=content % for(int i=0;i999;i++){ % html:option value=%=i%%=i%/html:option %}% /html:select - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
html:option value='%=+i%'%=+i%/html:option -Original Message- From: dirk [mailto:[EMAIL PROTECTED] Sent: Friday, December 19, 2003 7:51 AM To: Struts Users Mailing List Subject: simple question I want to create a select box with the values 1 thru 100 how can i do that? What i have is: But that is not working. Any idea ? Thanks ! html:select property=selectBox styleClass=content % for(int i=0;i999;i++){ % html:option value=%=i%%=i%/html:option %}% /html:select - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
Nothing to add really just a few variations on a theme. c:forEach var=num begin=0 end=999 html-el:option value=${num} c:out value=${num} / /html-el:option /c:forEach i think c:forEach var=num begin=0 end=999 htmll:option value=%= num %%= num % //html:option /c:forEach will also work although perhaps you need to convert the int to a string. On 19 Dec 2003, at 12:50, dirk wrote: I want to create a select box with the values 1 thru 100 how can i do that? What i have is: But that is not working. Any idea ? Thanks ! html:select property=selectBox styleClass=content % for(int i=0;i999;i++){ % html:option value=%=i%%=i%/html:option %}% /html:select - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
I know the question is targeted at doing this in a JSP, but why wouldn't you just set up a String[100] in application scope, name it numbers (or whatever) and do something like: html:select property=selectBox styleClass=content html:options name=numbers/ /html:select Quoting Mark Lowe [EMAIL PROTECTED]: Nothing to add really just a few variations on a theme. c:forEach var=num begin=0 end=999 html-el:option value=${num} c:out value=${num} / /html-el:option /c:forEach i think c:forEach var=num begin=0 end=999 htmll:option value=%= num %%= num % //html:option /c:forEach will also work although perhaps you need to convert the int to a string. On 19 Dec 2003, at 12:50, dirk wrote: I want to create a select box with the values 1 thru 100 how can i do that? What i have is: But that is not working. Any idea ? Thanks ! html:select property=selectBox styleClass=content % for(int i=0;i999;i++){ % html:option value=%=i%%=i%/html:option %}% /html:select -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
Agreed. On 19 Dec 2003, at 14:02, Kris Schneider wrote: I know the question is targeted at doing this in a JSP, but why wouldn't you just set up a String[100] in application scope, name it numbers (or whatever) and do something like: html:select property=selectBox styleClass=content html:options name=numbers/ /html:select Quoting Mark Lowe [EMAIL PROTECTED]: Nothing to add really just a few variations on a theme. c:forEach var=num begin=0 end=999 html-el:option value=${num} c:out value=${num} / /html-el:option /c:forEach i think c:forEach var=num begin=0 end=999 htmll:option value=%= num %%= num % //html:option /c:forEach will also work although perhaps you need to convert the int to a string. On 19 Dec 2003, at 12:50, dirk wrote: I want to create a select box with the values 1 thru 100 how can i do that? What i have is: But that is not working. Any idea ? Thanks ! html:select property=selectBox styleClass=content % for(int i=0;i999;i++){ % html:option value=%=i%%=i%/html:option %}% /html:select -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Simple Question
I like a for the mouse over affect. img does not have a mouse over. -Original Message- From: Srinivas Kusunam [mailto:[EMAIL PROTECTED] Sent: Friday, November 14, 2003 2:49 PM To: Subject: Simple Question Hi All, I my team while in a Code-Review we had a discussion wether to use html:img or normal a href=... as the later one can do the same work. One option accepted was why do we need Tag over head if a href= can handle that ?? What do you guys suggest Thanks, Srini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple Question
If I'm remembering correctly: a tile=mouse over text link/a and img src=blah.jpg alt=mouse over text/ - Original Message - From: Malcolm Davis [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 9:14 PM Subject: RE: Simple Question I like a for the mouse over affect. img does not have a mouse over. -Original Message- From: Srinivas Kusunam [mailto:[EMAIL PROTECTED] Sent: Friday, November 14, 2003 2:49 PM To: Subject: Simple Question Hi All, I my team while in a Code-Review we had a discussion wether to use html:img or normal a href=... as the later one can do the same work. One option accepted was why do we need Tag over head if a href= can handle that ?? What do you guys suggest Thanks, Srini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Simple Question
Hi All, I my team while in a Code-Review we had a discussion wether to use html:img or normal a href=... as the later one can do the same work. One option accepted was why do we need Tag over head if a href= can handle that ?? What do you guys suggest Thanks, Srini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Simple Question
For maintaining the JSESSIONID if someone has their cookies turned off - this ensures the id is embedded in the link when cookies aren't available. Regards, David -Original Message- From: Srinivas Kusunam [mailto:[EMAIL PROTECTED] Sent: Friday, November 14, 2003 3:49 PM To: Subject: Simple Question Hi All, I my team while in a Code-Review we had a discussion wether to use html:img or normal a href=... as the later one can do the same work. One option accepted was why do we need Tag over head if a href= can handle that ?? What do you guys suggest Thanks, Srini - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Simple Question
One option accepted was why do we need Tag over head if a href= can handle that ?? What do you guys suggest I agree, if there is no dynamic content, then I use a plain old HTML tag. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple question
Hi, Is there any Struts tag for an expression like %= request.getAttribute(attributeName)% where the attribute is a String. Thanks, Shyam __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
you can use bean:write name=attributeName OR bean:message key=attributeName/ Where key is the key defined in resources file Cheers Gary - Original Message - From: Shyam A [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 13, 2003 9:40 PM Subject: simple question Hi, Is there any Struts tag for an expression like %= request.getAttribute(attributeName)% where the attribute is a String. Thanks, Shyam __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple question
Hi all, I think I have a relative easy question. I have a J2EE application which has some entitybeans. I want to display the values of these entitybeans in my JSP pages (using Struts). I have made value objects of the entitybeans. In my ListAllCategoriesAction.java, I do something like the following: Collection allCategories = mySessionFacade.getAllCategories(); DisplayBean displayBean = new DisplayBean(); displayBean.setCategories(allCategories); request.setAttribute(categories, displayBean); return mapping.findforward( SUCCESS ); As you can see I'm using a special bean (displayBean) to pass the categories to my JSP page. In my JSP page I use the logic:iterate tags to iterate through te collection and display the proper information. Is this a normal / good approach? Or do I have to use ActionForm classes for this purpose? Thanks a lot, Harm de Laat Informatiefabriek The Netherlands - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
Yes. This is a normal approach. ActionForms are used only if you want to pre-populate data. i.e If you have to show default values in a text field you can pre-populate the Action Form and forward to a JSP. You can also store a Collection directly in one of the scopes and show that but Custom beans like this are useful because they can be manipulated quite well with the tag handlers. Mohan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 7:15 PM To: [EMAIL PROTECTED] Subject: simple question Hi all, I think I have a relative easy question. I have a J2EE application which has some entitybeans. I want to display the values of these entitybeans in my JSP pages (using Struts). I have made value objects of the entitybeans. In my ListAllCategoriesAction.java, I do something like the following: Collection allCategories = mySessionFacade.getAllCategories(); DisplayBean displayBean = new DisplayBean(); displayBean.setCategories(allCategories); request.setAttribute(categories, displayBean); return mapping.findforward( SUCCESS ); As you can see I'm using a special bean (displayBean) to pass the categories to my JSP page. In my JSP page I use the logic:iterate tags to iterate through te collection and display the proper information. Is this a normal / good approach? Or do I have to use ActionForm classes for this purpose? Thanks a lot, Harm de Laat Informatiefabriek The Netherlands - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
What you are doing should be fine (as long as your collection is not too terribly big). You use an ActionForm when you want to collect input from the user. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2003 9:45 AM To: [EMAIL PROTECTED] Subject: simple question Hi all, I think I have a relative easy question. I have a J2EE application which has some entitybeans. I want to display the values of these entitybeans in my JSP pages (using Struts). I have made value objects of the entitybeans. In my ListAllCategoriesAction.java, I do something like the following: Collection allCategories = mySessionFacade.getAllCategories(); DisplayBean displayBean = new DisplayBean(); displayBean.setCategories(allCategories); request.setAttribute(categories, displayBean); return mapping.findforward( SUCCESS ); As you can see I'm using a special bean (displayBean) to pass the categories to my JSP page. In my JSP page I use the logic:iterate tags to iterate through te collection and display the proper information. Is this a normal / good approach? Or do I have to use ActionForm classes for this purpose? Thanks a lot, Harm de Laat Informatiefabriek The Netherlands - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple question
Hi, there is a possibility to send an object in the request if i don't pass it with parameter of the link? for example: % request.setAttribute(in,index); % ... hm:link page=/index.jsp transaction=true home /hm:link this obviously don't work...but there is a system to obtain this whit a Struts component? I should pass a String value to action, but this must be not visible in the url. In particular my action don't know the page that call it and for this... I try to pass it as message, but this don't work.. Any idea? Thanks in advance Alessio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
You can try this : form name=myLink action=html:rewrite page=/index.jsp/ method=POST input type=hidden name=in value=... /form a href=javascript:document.forms.myLink.submit()home/a Notice the (not visible) HTML form will add a visual line break in browser. You can avoid it by putting it a page bottom or in an hidden div, or between two rows of a table. Nico. hm:link page=/index.jsp transaction=true home /hm:link this obviously don't work...but there is a system to obtain this whit a Struts component? I should pass a String value to action, but this must be not visible in the url. In particular my action don't know the page that call it and for this... I try to pass it as message, but this don't work.. Any idea? Thanks in advance Alessio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
Thank, but with this i must crete an ActionForm...it's possible avoid to create an ActionForm for an form? Thank for help Ale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
You don't need an ActionForm (but you can). You can use request.getParameter(in) in your action, you can use a dynaForm too if you don't wan't to create a formBean for this. As you can read in the code I sent, I did not used html:form, so action form definition is not needed. This beeing said, using a dynaForm an struts tags would be IMHO the cleaner way, and you will not have to create the code for a new formbean. Nico. Thank, but with this i must crete an ActionForm...it's possible avoid to create an ActionForm for an form? Thank for help Ale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: simple question
Thank you, you have been very kind. Ale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[XEN] Simple question: forward and redirect
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 13 Mar 2003, Ian Hunter wrote: Are you redirecting or forwarding to your JSP from that Action? What is the exact difference between forwarding and redirecting? What are their implications? I searched the Servlet and JSP specs but I haven't found nothing about that. A presto, Fabio - -- - - Fabio Mancinelli, PhD student EMail : [EMAIL PROTECTED] Dipartimento di Informatica WWW : http://www.di.univaq.it/~mancinel Universita' dell'Aquila - - -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Made with pgp4pine 1.75-6 iD8DBQE+ca7A6dsQbk2R3cMRAruyAKDTfVtCqtF13uyg+oDHw8NpfSIWrgCfa8RB FKSGdLso4sReqYrbCO2fkcE= =aSQr -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [XEN] Simple question: forward and redirect
When you forward, you pass control to another class within your current application root context. When you redirect, you can pass in or out of the context. Simon - If I have this wrong, my site is well sha***d!! - Original Message - From: Fabio Mancinelli [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, March 14, 2003 11:28 AM Subject: [XEN] Simple question: forward and redirect -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 13 Mar 2003, Ian Hunter wrote: Are you redirecting or forwarding to your JSP from that Action? What is the exact difference between forwarding and redirecting? What are their implications? I searched the Servlet and JSP specs but I haven't found nothing about that. A presto, Fabio - -- - - Fabio Mancinelli, PhD student EMail : [EMAIL PROTECTED] Dipartimento di Informatica WWW : http://www.di.univaq.it/~mancinel Universita' dell'Aquila - - -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Made with pgp4pine 1.75-6 iD8DBQE+ca7A6dsQbk2R3cMRAruyAKDTfVtCqtF13uyg+oDHw8NpfSIWrgCfa8RB FKSGdLso4sReqYrbCO2fkcE= =aSQr -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [XEN] Simple question: forward and redirect
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Fri, 14 Mar 2003, Simon Kelly wrote: When you forward, you pass control to another class within your current application root context. When you redirect, you can pass in or out of the context. What do you mean? Aren't we talking at the HTTP protocol level? When you say another class do you mean another WEB object? I mean, it should be possible to forward/redirect also to a PHP page, shouldn't it? The forward/redirect semantics is tied to the Java Framework that we are using or is it more general? And what are the effect of enabling the redirect property of a struts action? A presto, Fabio - -- - - Fabio Mancinelli, PhD student EMail : [EMAIL PROTECTED] Dipartimento di Informatica WWW : http://www.di.univaq.it/~mancinel Universita' dell'Aquila - - -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Made with pgp4pine 1.75-6 iD8DBQE+cbSO6dsQbk2R3cMRAmFZAKCjwio1kbnIRqz5oW4bw0g+q0d0pACgmO9m H+VuLhfCBUUgNi9l0m5D3WA= =U+8j -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [XEN] Simple question: forward and redirect
I hope to be not too much oot :-) I would even say that the forward is internal to the server (ie, no client/server communication) but the redirect is a http response to the client. The forward is sometimes used to separate the business logic (p.ex : a servlet) from the presentation (p.ex : a jsp). A problem can be if the servlet and the jsp sit in different directories. For example : a client accesses a servlet in x.com/servlet/frontcontroller that forwards to /gui/screen1.jsp. The client's path is still x.com/servlet/frontcontroller since the forward is internal. If the jsp needs to get a picture in /gui/image.gif then the html must look like img src=../gui/image.gif even if the jsp and the image are in the same directory. The redirect can be used for non-existing pages (p.ex : x.com - x.com/index.html), but there are other uses probably... A forward cannot go out of the application server since it is internal. The application server is not a proxy... Have a look at HttpRequest.getDispatcher(...) and HttpResponse.sendRedirect(...). Kind regards, André -Original Message- From: Simon Kelly [mailto:[EMAIL PROTECTED] Sent: 14 March 2003 11:44 To: Struts Users Mailing List Subject: Re: [XEN] Simple question: forward and redirect When you forward, you pass control to another class within your current application root context. When you redirect, you can pass in or out of the context. Simon - If I have this wrong, my site is well sha***d!! - Original Message - From: Fabio Mancinelli [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, March 14, 2003 11:28 AM Subject: [XEN] Simple question: forward and redirect -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 13 Mar 2003, Ian Hunter wrote: Are you redirecting or forwarding to your JSP from that Action? What is the exact difference between forwarding and redirecting? What are their implications? I searched the Servlet and JSP specs but I haven't found nothing about that. A presto, Fabio - -- - - Fabio Mancinelli, PhD student EMail : [EMAIL PROTECTED] Dipartimento di Informatica WWW : http://www.di.univaq.it/~mancinel Universita' dell'Aquila - - -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: Made with pgp4pine 1.75-6 iD8DBQE+ca7A6dsQbk2R3cMRAruyAKDTfVtCqtF13uyg+oDHw8NpfSIWrgCfa8RB FKSGdLso4sReqYrbCO2fkcE= =aSQr -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER This e-mail and any attachments thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by persons other than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [XEN] Simple question: forward and redirect
Fabio Mancinelli wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 13 Mar 2003, Ian Hunter wrote: Are you redirecting or forwarding to your JSP from that Action? What is the exact difference between forwarding and redirecting? What are their implications? I searched the Servlet and JSP specs but I haven't found nothing about that. Forward = RequestDispatcher.forward() (http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/RequestDispatcher.html) Redirect = HttpServletResponse.sendRedirect() (http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletResponse.html) Big difference is that redirect sends an HTTP Response back the browser with a redirect header, generating a new request from the browser. This makes it in general slower and less efficient. Also, the Request object (and anything that you have shoved into it) is not preserved. On the other hand, redirect gives you control over the destination URL. Search the archives for full discussion. hth, Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html-el:link and logic-el:iterate and tiles --- Just a simple question.
Thanks that was what I was missing... I ended up with: html-el:link page=${item.link} jsp:getProperty name=item property=value//html-el:link Last questions is the jsp:getProperty needed? I was hoping to find a html-el:link / implementation that Produced Aproduced text/A.. Is that possible? Second question is how do I test for the last instance of item within the iterate tag? Thanks for all the insight as all ways, Jeff Born. -Original Message- From: Ray Madigan [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 26, 2003 2:06 AM To: Struts Users Mailing List Subject: RE: html-el:link and logic-el:iterate and tiles --- Just a simple question. I would check to see if items.footer an attribute in some scope and it has a collection bound to it. Also, the id=item: item is an instance of the current iteration not a string. In the link paramName=item should be item.someMethod ( ) that returns a string. and i suspect that paramProperty=value might be something like paramProperty=item.value which calls the getValue ( ) method on instance. I hope this helps Ray Madigan -Original Message- From: Jeff Born [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 7:49 PM To: 'Struts Users Mailing List' Subject: html-el:link and logic-el:iterate and tiles --- Just a simple question. I would like the html-el:link to produce A href=%=request.getContextPath()%jsp:getProperty name=item property=link/jsp:getProperty name=item property=value/A I would like in to work with the iterate tag. But so far I am not getting it to work. logic-el:iterate id=item name=items.footer type=org.apache.struts.tiles.beans.MenuItem td html-el:link paramName=item paramProperty=value/ /td /logic-el:iterate Any insight would be greatly appreciated, Jeff Born - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html-el:link and logic-el:iterate and tiles --- Just a simple question.
I would like the html-el:link to produce A href=%=request.getContextPath()%jsp:getProperty name=item property=link/jsp:getProperty name=item property=value/A I would like in to work with the iterate tag. But so far I am not getting it to work. logic-el:iterate id=item name=items.footer type=org.apache.struts.tiles.beans.MenuItem td html-el:link paramName=item paramProperty=value/ /td /logic-el:iterate Any insight would be greatly appreciated, Jeff Born - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: html-el:link and logic-el:iterate and tiles --- Just a simple question.
I would check to see if items.footer an attribute in some scope and it has a collection bound to it. Also, the id=item: item is an instance of the current iteration not a string. In the link paramName=item should be item.someMethod ( ) that returns a string. and i suspect that paramProperty=value might be something like paramProperty=item.value which calls the getValue ( ) method on instance. I hope this helps Ray Madigan -Original Message- From: Jeff Born [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 7:49 PM To: 'Struts Users Mailing List' Subject: html-el:link and logic-el:iterate and tiles --- Just a simple question. I would like the html-el:link to produce A href=%=request.getContextPath()%jsp:getProperty name=item property=link/jsp:getProperty name=item property=value/A I would like in to work with the iterate tag. But so far I am not getting it to work. logic-el:iterate id=item name=items.footer type=org.apache.struts.tiles.beans.MenuItem td html-el:link paramName=item paramProperty=value/ /td /logic-el:iterate Any insight would be greatly appreciated, Jeff Born - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Simple question
Is there a nifty way of accessing attributes of the form bean? Julian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple question
From where? David From: julian green [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Simple question Date: Wed, 12 Feb 2003 17:09:24 + Is there a nifty way of accessing attributes of the form bean? Julian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Simple question
You mean in a display .jsp? You could use a taglib: http://jakarta.apache.org/struts/doc-1.0.2/api/org/apache/struts/taglib/bean /package-summary.html#package_description -Original Message- From: julian green [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 12, 2003 12:09 PM To: Struts Users Mailing List Subject: Simple question Is there a nifty way of accessing attributes of the form bean? Julian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Simple question
formName.property inside an el expression or name=formName property=property inside of tags that support these two attributes but not EL where formName is the name of the form in struts-config.xml -Original Message- From: julian green [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 12, 2003 11:09 AM To: Struts Users Mailing List Subject: Simple question Is there a nifty way of accessing attributes of the form bean? Julian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple question
Sorry, from within a jsp. Julian David Graham wrote: From where? David From: julian green [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Simple question Date: Wed, 12 Feb 2003 17:09:24 + Is there a nifty way of accessing attributes of the form bean? Julian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple question
The form bean is stored in the session or request so your jsp can access it with: c:out value=${myForm.myProperty}/ David From: julian green [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Simple question Date: Wed, 12 Feb 2003 17:20:06 + Sorry, from within a jsp. Julian David Graham wrote: From where? David From: julian green [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Simple question Date: Wed, 12 Feb 2003 17:09:24 + Is there a nifty way of accessing attributes of the form bean? Julian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple (?) question ;)
Hello! I'm new to struts and a little bit leazy ;). I have out-of-host html form that have to be redirected to my application, then I have to virify that form and redirect this values to other html form (jsp) that contains the same fields plus some more to enter, that means the second form is child-like object. And my question is: is there any way to autofill form fields (the same way like form filling when error ocured during verification). it looks lie this: external form action=host/action1.doinput name=id value=blah/form action1.do: form action=host/action2.doinput name=id v=blahinput name=other v=foo/form and I would like to autofill the second form fields (in this egzample 'id'), any way to do this? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
A simple question about i18n
I have a form where I have used html:submit property=submit value=Log On/ to submit it. Instead of value = Log On being hardcoded I want to get it from my resource property file. How can I do it. I am new to Struts so any help would be great Rajesh Kanade 91-22-660-3666 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: A simple question about i18n
Try this: html:submit property=submitbean:message key=button.logon//html:submit -Original Message- From: Rajesh Kanade [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 15, 2002 11:07 AM To: Struts Mailing list Subject: A simple question about i18n I have a form where I have used html:submit property=submit value=Log On/ to submit it. Instead of value = Log On being hardcoded I want to get it from my resource property file. How can I do it. I am new to Struts so any help would be great Rajesh Kanade 91-22-660-3666 -- 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]
Simple Question
This is probably a simple question, but i cannot find the answer in any straighforward place. how do i get a property from my ApplicationResources.properties file within some java code. i know how to do this using a bean tag, but not otherwise. is there a helper class to do this? i am using this to assign default values for a form (within a form object). thanks, mark -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Simple Question
Are doing this within an Action? James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 3:07 PM To: Struts Users Mailing List Subject: Simple Question This is probably a simple question, but i cannot find the answer in any straighforward place. how do i get a property from my ApplicationResources.properties file within some java code. i know how to do this using a bean tag, but not otherwise. is there a helper class to do this? i am using this to assign default values for a form (within a form object). thanks, mark -- 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]
RE: Simple Question
No, i want to refer to it in the consutructor of my ActionForm, to set some default values of a search form (dates, times, etc.) this will allow the search page to be easily configurable later on. i thought there might be a helper class that takes into account the file name and path, rather than using the ResourcesBundle from scratch. is there something like this? thanks, mark -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 12:21 PM To: Struts Users Mailing List Subject: RE: Simple Question Are doing this within an Action? James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 3:07 PM To: Struts Users Mailing List Subject: Simple Question This is probably a simple question, but i cannot find the answer in any straighforward place. how do i get a property from my ApplicationResources.properties file within some java code. i know how to do this using a bean tag, but not otherwise. is there a helper class to do this? i am using this to assign default values for a form (within a form object). thanks, mark -- 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]
RE: Simple Question
Just write a helper class that opens the file, loads it into a properties object, reads the properties, and closes the file. Something like the following: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; public final class SilvaProperties { public SilvaProperties setProperty(String file, String key, String value) { key = Replace.replace(key, , ); File hold = new File(file); Properties properties = new Properties(); try { FileInputStream input = new FileInputStream(hold); properties.load(input); properties.setProperty(key, value); FileOutputStream output= new FileOutputStream(hold); properties.store(output, -- TRESBEAU -- ); output.close(); input.close(); } catch (FileNotFoundException fnfe) { } catch (IOException ioe) { } return this; } public String getProperty(String file, String key) { key = Replace.replace(key, , ); File hold = new File(file); Properties properties = new Properties(); try { FileInputStream input = new FileInputStream(hold); properties.load(input); input.close(); } catch (FileNotFoundException fnfe) { } catch (IOException ioe) { } return properties.getProperty(key); } public Properties getProperties(String file) { Properties properties = new Properties(); Filehold = new File(file); try { FileInputStream input = new FileInputStream(hold); properties.load(input); input.close(); } catch (FileNotFoundException fnfe) { } catch (IOException ioe) { } return properties; } public final class Replace { public synchronized static String replace(String content, String before, String after) { int position = content.indexOf(before); while (position -1) { content = content.substring(0, position) + after + content.substring(position + before.length()); position = content.indexOf(before, position + after.length()); } return content; } } } } At 03:21 PM 9/9/2002 -0400, you wrote: Are doing this within an Action? James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 3:07 PM To: Struts Users Mailing List Subject: Simple Question This is probably a simple question, but i cannot find the answer in any straighforward place. how do i get a property from my ApplicationResources.properties file within some java code. i know how to do this using a bean tag, but not otherwise. is there a helper class to do this? i am using this to assign default values for a form (within a form object). thanks, mark -- 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]
RE: Simple Question
Without a request instance, you'd be confined to accessing only the default bundle for the default module - a little limiting. If you need to do this in an ActionForm, you'd be better off doing it from reset(), which at least gets the request passed to it. For how to access the appropriate bundle given a request instance, take a look at: Action.getResources(HttpServletRequest, String) -- Martin Cooper -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 12:29 PM To: Struts Users Mailing List Subject: RE: Simple Question No, i want to refer to it in the consutructor of my ActionForm, to set some default values of a search form (dates, times, etc.) this will allow the search page to be easily configurable later on. i thought there might be a helper class that takes into account the file name and path, rather than using the ResourcesBundle from scratch. is there something like this? thanks, mark -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 12:21 PM To: Struts Users Mailing List Subject: RE: Simple Question Are doing this within an Action? James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 3:07 PM To: Struts Users Mailing List Subject: Simple Question This is probably a simple question, but i cannot find the answer in any straighforward place. how do i get a property from my ApplicationResources.properties file within some java code. i know how to do this using a bean tag, but not otherwise. is there a helper class to do this? i am using this to assign default values for a form (within a form object). thanks, mark -- 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]
Re: Simple Question
You might also note that you can have default values in an included property file. See Properties API At 12:07 PM 9/9/2002 -0700, you wrote: This is probably a simple question, but i cannot find the answer in any straighforward place. how do i get a property from my ApplicationResources.properties file within some java code. i know how to do this using a bean tag, but not otherwise. is there a helper class to do this? i am using this to assign default values for a form (within a form object). thanks, mark -- 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]
RE: Simple Question
-Original Message- From: Mark Silva [mailto:[EMAIL PROTECTED]] Sent: Monday, September 09, 2002 3:29 PM To: Struts Users Mailing List Subject: RE: Simple Question No, i want to refer to it in the consutructor of my ActionForm, to set some default values of a search form (dates, times, etc.) this will allow the search page to be easily configurable later on. i thought there might be a helper class that takes into account the file name and path, rather than using the ResourcesBundle from scratch. is there something like this? Since 1.1b1, the instance of MessageResources that you need is set in the request (under Action.MESSAGES_KEY) during request processing. The current subapp and message-resources key are used to decide which one to set. So, you will need access to the request in order to retrieve the correct instance. I could be wrong, (its happened before ;) but I don't beleive struts will ever call your constructor anyway. Look at the docs for ActionForm. It's lifecycle is described pretty well in the docs. You might have some luck with reset(). thanks, mark James Mitchell Software Engineer\Struts Evangelist Struts-Atlanta, the Open Minded Developer Network http://www.open-tools.org/struts-atlanta -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Simple question about Struts
Hi all, I've studiing Struts for the past 3 weeks because I have done a generic Jsp content-management web site connected on a MySql database using a set of custom tag libraries following the Manning book Tag Librairies. So I am still new at Struts, and I would like a simple advice over the Struts framework. I was hoping to adapt my site to a Struts framework to gain some architectural strenght and, by re-using the work I've done with Strut, I thaught, limit the future development when doing another site with the same framework. My question is : Can a Strut web site be modify or upgrade without the outcome of a java programmers? I means without the creation of multiple java classes? It seems that if you want to add a page, or modify the parameter or the validation of a form, you must go into the java classes that controle this form and add some logic into it. Without questioning the strength of MVC, in a first glance, it seems that this framework is not light-weight and demands some real professional effort to adapt or modifie any web solution using this structure. So, maybe, loosing the goal of building a generic solution? By the way, I think I have having a virus a day (just got one) with this mailing list, nobody scan the mail before sending it? Regards, Etienne Montreal -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Simple question about Struts
On Thu, 8 Aug 2002, Eddie Bush wrote: Go check out Chuck's book to see what Struts can do and how easily it can be configured. If you have specific questions about Well, would my end usrs have to program to do X? just swing by and drop us a note. There are a bunch (understatement!) of talented folks on the list that aren't scared to give their opinion. Oh, and you might also search oreilly.com articles for rolling blogger to give you some ideas of how you can automate Struts configuration type things. I haven't looked at his system in depth, but, as I recall, he builds his design on Struts (and Velocity, and ...). This is the site for Roller: http://www.rollerweblogger.org/ It has a link to the O'Reilly article. I can't say too much about it because I haven't poured through the code much either, but it deployed quite easily. -- stu: www.stuology.net It just no longer is plain simple safe fun when it's the psycho chimp that has the ray gun Stuology -- A million monkeys can't be wrong -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Simple Question
Hi Norman, it's not clear what your problem is. What have you tried? Try reading this and reposting the question: http://www.tuxedo.org/~esr/faqs/smart-questions.html Adam Ryan Norman wrote: Hi, I am Norman. I have a simple problem for which I don't know the answer. I have a single form that I want to use for both add and view user. I was able to successfully add a user. After adding the user I want the user details to be displayed. Can somebody throw some lights on what I need to do. I am pasting my code with this. Partial struts-config.xml - global-forwards forward name=login path=/login.jsp/ forward name=logout path=/logout.jsp/ forward name=changePassword path=/password.jsp/ forward name=mainMenu path=/index.jsp/ forward name=searchUser path=/admin/search/searchuser.jsp/ forward name=userList path=/admin/search/userlist.jsp/ forward name=user path=/admin/user.jsp/ /global-forwards form-bean name=userForm type=strutsapp1.user.UserForm/ action path=/user type=strutsapp1.user.UserAction name=userForm scope=request input=/admin/user.jsp /action user.jsp - %@ 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 % jsp:useBean id=action scope=page class=java.lang.String /jsp:useBean % action = request.getParameter( Action ); //action = ( String ) request.getAttribute( Action ); action = ( action == null ? : action ); % !doctype html public -//W3C//DTD HTML 4.0 Transitional//EN html head link href=../style.css rel=stylesheet type=text/css /head body html:form action=/user method=post enctype=application/x-www-form-urlencoded input type=hidden name=txtAction value=%= action % table border=1 cellpadding=0 cellspacing=0 width=100% align=center tr width=100% td class=ErrorMessage colspan=20 align=center table border=0 cellpadding=0 cellspacing=0 width=100% align=center tr width=100% td class=FrameTitle colspan=20 align=center % if( action.equals( AddUser ) ) { % bean:message key=screen.adduser.title/ % } else { % bean:message key=screen.viewuser.title/ % } % /td /tr tr width=100% td class= colspan=20 align=center nbsp; /td /tr tr width=100% td class=ErrorMessage colspan=20 align=center html:errors/ /td /tr tr width=100% align=center td colspan=20 align=center table border=0 cellpadding=0 cellspacing=0 width=100% align=center tr width=100% td class=LabelDisplay colspan=4 width=20% User ID: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=userID size=8 maxlength=8 / /td td class= colspan=4 width=20% nbsp; /td td class= colspan=4 width=20% nbsp; /td td class= colspan=4 width=20% nbsp; /td /tr tr width=100% td class=LabelDisplay colspan=4 width=20% First Name: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=firstName size=14 maxlength=14 / /td td class= colspan=4 width=20% nbsp; /td td class=LabelDisplay colspan=4 width=20% Last Name: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=lastName size=20 maxlength=20 / /td /tr tr width=100% td class=LabelDisplay colspan=4 width=20% Phone Number: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=phoneNumber size=16 maxlength=16 / /td td class= colspan=4 width=20% nbsp; /td td class=LabelDisplay colspan=4 width=20% Fax Number: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=faxNumber size=16 maxlength=16 / /td /tr tr width=100% td colspan=20 align=center nbsp; /td /tr tr width=100% td class=Heading1 colspan=20 align=center Change Password /td /tr tr width=100% td class=LabelDisplay colspan=20 align=center center Please enter the new password and then verify the new password by re-entering. br Please
Simple Question
Hi, I am Norman. I have a simple problem for which I don't know the answer. I have a single form that I want to use for both add and view user. I was able to successfully add a user. After adding the user I want the user details to be displayed. Can somebody throw some lights on what I need to do. I am pasting my code with this. Partial struts-config.xml - global-forwards forward name=login path=/login.jsp/ forward name=logout path=/logout.jsp/ forward name=changePassword path=/password.jsp/ forward name=mainMenu path=/index.jsp/ forward name=searchUser path=/admin/search/searchuser.jsp/ forward name=userList path=/admin/search/userlist.jsp/ forward name=user path=/admin/user.jsp/ /global-forwards form-bean name=userForm type=strutsapp1.user.UserForm/ action path=/user type=strutsapp1.user.UserAction name=userForm scope=request input=/admin/user.jsp /action user.jsp - % 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 % jsp:useBean id=action scope=page class=java.lang.String /jsp:useBean % action = request.getParameter( Action ); //action = ( String ) request.getAttribute( Action ); action = ( action == null ? : action ); % !doctype html public -//W3C//DTD HTML 4.0 Transitional//EN html head link href=../style.css rel=stylesheet type=text/css /head body html:form action=/user method=post enctype=application/x-www-form-urlencoded input type=hidden name=txtAction value=%= action % table border=1 cellpadding=0 cellspacing=0 width=100% align=center tr width=100% td class=ErrorMessage colspan=20 align=center table border=0 cellpadding=0 cellspacing=0 width=100% align=center tr width=100% td class=FrameTitle colspan=20 align=center % if( action.equals( AddUser ) ) { % bean:message key=screen.adduser.title/ % } else { % bean:message key=screen.viewuser.title/ % } % /td /tr tr width=100% td class= colspan=20 align=center nbsp; /td /tr tr width=100% td class=ErrorMessage colspan=20 align=center html:errors/ /td /tr tr width=100% align=center td colspan=20 align=center table border=0 cellpadding=0 cellspacing=0 width=100% align=center tr width=100% td class=LabelDisplay colspan=4 width=20% User ID: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=userID size=8 maxlength=8 / /td td class= colspan=4 width=20% nbsp; /td td class= colspan=4 width=20% nbsp; /td td class= colspan=4 width=20% nbsp; /td /tr tr width=100% td class=LabelDisplay colspan=4 width=20% First Name: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=firstName size=14 maxlength=14 / /td td class= colspan=4 width=20% nbsp; /td td class=LabelDisplay colspan=4 width=20% Last Name: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=lastName size=20 maxlength=20 / /td /tr tr width=100% td class=LabelDisplay colspan=4 width=20% Phone Number: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=phoneNumber size=16 maxlength=16 / /td td class= colspan=4 width=20% nbsp; /td td class=LabelDisplay colspan=4 width=20% Fax Number: nbsp; /td td class= colspan=4 width=20% nbsp; html:text property=faxNumber size=16 maxlength=16 / /td /tr tr width=100% td colspan=20 align=center nbsp; /td /tr tr width=100% td class=Heading1 colspan=20 align=center Change Password /td /tr tr width=100% td class=LabelDisplay colspan=20 align=center center Please enter the new password and then verify the new password by re-entering. br Please remember that passwords are case sensitive. /center /td /tr tr width=100% td class=LabelDisplay colspan=10 align=center New
Having trouble nesting iterate tags (long explanation,relatively simple question)
Hi. I'm fairly new to Struts, but I've gone through the Struts documentation and KeyboardMonkey's helpful tutorial. What I want to do is (almost) right out of the tutorial, but it's not working the way I would expect. The list archives show that other people have had this problem, and the few real solutions I've found seem to indicate that I'm doing the right thing, but I keep getting exceptions. My understanding is complicated by the fact that the tutorial shows how to nest lists within a form, but I'm not using a form (surely that's not necessary?). One clarification I need: the KM tutorial indicates that only Object[] can be used for nested lists, even though the Struts taglib docs say that logic:iterate can iterate over Collection, Enumerations, arrays, etc. Is that still true? Or can I nest lists where the bean property getters return java.util.Collection? So let me describe what I have, and what I'm trying to do. BTW, simply using a single-level logic:iterate tag works great. I'm using Tomcat 4.0.4b2 and the nightly build of Struts from a couple days ago. I have a set of Locations that are in a City. I have a list of Cities. I would like to list all the Cities, and under each City list all the locations. My code manages to list all the Cities, but when I add tags HTML to list the Locations, I get variously tag nesting exceptions or null pointer exceptions (and occasionally a getter not found exception), depending on various ways of writing the code. I have a City bean (called a Site for historical reasons, it will eventually be changed) defined like this: public class Site { public StringgetCity() { return mCity; } public voidsetCity(String inCity) { mCity = inCity; } public StringgetState() { return mState; } public voidsetState(String inState) { mState = inState; } public CollectiongetLocations() { return mLocations; } public voidsetLocations(Collection inLocations) { mLocations = inLocations; } private StringmCity = null; privateStringmState = null; privateCollectionmLocations = null; // Vector of Locations } and a FindResults bean defined like this: public class FindResults { public CollectiongetCities() { return mCities; } public voidsetCities(Collection inCities) { mCities = inCities; } private CollectionmCities; // A Vector of Sites } There's also a simple Location bean: public Location { public String getName() { return mName; } public void setName(String inName) { mName = inName; } } As a result of submitting a form, my FindAction object gets executed. It takes the form input, does a JDBC lookup, then creates a FindResults bean and puts it in the session state. The following (simplified) JSP displays the list of cities satisfactorily: %@ page contentType=text/html;charset=UTF-8 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-nested.tld prefix=nested % jsp:useBean id=findResults scope=session type=com.latencyzero.cc.FindResults/ head titleSearch Results/title /head body bgcolor=#ff logic:iterate id=foundCity name=findResults property=cities table trtd Locations in bean:write name=foundCity property=city/ /td/tr trtd !-- insert location list here -- /td/tr /table /logic:iterate /body /html:html It's when I try to nest a list that I run into trouble. I started by replacing the insert location list here comment with the following: logic:iterate id=foundLocation name=foundCity property=locations pbean:write name=foundLocation property=name/p /logic:iterate As soon as I do that, I get org.apache.jasper.compiler.ParseException: End of content reached while more parsing required: tag nesting error?. Various permutations of using nested instead of logic and bean result in other errors. For example, if I use nested:iterate for the inner loop (and on the bean write), I get null pointer exception (even if I remove the 'name=foundCity' attribute). I even tried to make a single outer loop (the very first example above) that used a nested:write tag, just to see if I could get *something* nested going. Using both logic:iterate and nested:iterate, this resulted in a null pointer exception. Clearly, I'm missing some fundamental point about nesting. Some people's responses on the list indicate that they've had success simply nesting logic:iterate tags without trouble (http://www.mail-archive.com/struts-user@jakarta.apache.org/msg23493.html). I'd be happy with that for this situation (I don't think I need the implicit-dotting of hierarchies of properties for this simple operation). TIA for any help! BTW, is my approach of
Re: Having trouble nesting iterate tags (long explanation, relatively simple question)
A total stab in the dark here, I'm a JSP newbie: At 04:20 PM 4/9/2002 -0700, Rick Mann wrote: logic:iterate id=foundLocation name=foundCity property=locations pbean:write name=foundLocation property=name/p /logic:iterate As soon as I do that, I get org.apache.jasper.compiler.ParseException: End of content reached while more parsing required: tag nesting error?. Should it maybe be p bean:write name=foundLocation property=name / /p (note the closing slash)? Cheers, Rob -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: This hopefully is a simple question that has been dealt with
Have you looked at the validator that comes with struts 1.1 beta? You can look at validator.xml and validator-rules.xml in the blank application's WEB-INF. It's for input though, as opposed to output. I haven't heard of anything similar for output. -Original Message- From: Vladimir Levin [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 10:48 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: This hopefully is a simple question that has been dealt with I haven't found the solution I will use yet to solve this problem in my own project, so advice would definitely be helpful. I found a taglibrary that purports to do this (at http://jsptags.com) http://www.sqlt.com/taglib.html I have not investigated using it just yet though. I think even writing one's own tag to format dates and numbers should be easy enough: just extend the bean:write tag to support a format attribute and use the existing java formatting capabilities (SimpleDateFormat, NumberFormat). Doing arbitrary String masking would be cool too (typical example is phone number formatting, currency formatting, but I also have additional requirements). Does anyone know of a taglib that does this kind of thing? Vlad Sorry to post this question again, but I'm still curious about this ... I'm sure this question has come up but I'm not having much luck searching the archives. I'm really new to Struts so I hope this question isn't too out of place for this list. Lets say we are dealing with Employee beans. I would my EmployeeBean to be able to have members that are not all Strings. (In this example say Age would be an int, birthDate a java.util.Date, etc.). Now in the sample app I'm developing I have an EmployeeForm class also that currently has just String datatypes for these fields. Having the information from the actual form jsp's going to the EmployeeForm in as all Strings without any conversions is not that big of a deal since wherever I do anything with this data (jdbc inserts in the business logic I could always covert them there if I need to ). However, I'm more concerned with getting this information displayed correctly using the iterate tag. For example, say I have on an Action class that gets back and ArrayList of EmployeeBean objects and puts this list into the request before forwarding. I really can't do: logic:iterate id=row name=employeeList bean:write name=row property=firstName/BR bean:write name=row property=lastName/BR bean:write name=row property=age/BR bean:write name=row property=birthDate/BR BR /logic:iterate since I won't have birthDate formatted correctly, or say I was returning a Double that I needed in a currency format. What is the best way to deal with this situation? I could of course maybe have my business logic return me a Collection of EmployeeForm beans instead and inside the EmployeeForm beans there would be methods like setBirthDateDate( Date date ) that would take a java.util.Date and format it into a String and then call the EmployeeForm setBrithDate( String date ). Although that would work, I'd still rather deal with the business logic that returns a Collection of EmployeeBeans... as this seems to make the most reusable sense (maybe the components later won't just be for the web). Thanks for any help. -- Rick mailto:[EMAIL PROTECTED] Why do people in ship mutinies always ask for 'better treatment'? I'd ask for a pinball machine, because with all that rocking back and forth you'd probably be able to get a lot of free games. -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- 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]
Re[6]: Does this tag exist architecture [was] This hopefully is a simple question that has been dealt with
On Saturday, March 30, 2002, 10:33:32 AM, Vladimir Levin wrote: VL 2) Performance penalty for copying a list of result beans to VL a list of form beans. Exactly. What if you a very large result set of Employee objects being returned. Now you have to go through this entire Collection again just to populate another very similar collection that has different data types for the members. I guess I just need to decide if this tradeoff is worth it. -- Rick mailto:[EMAIL PROTECTED] If I was the head of a country that lost a war, and I had to sign a peace treaty, just as I was signing, I'd glance over the treaty and then suddenly act surprised. 'Wait a minute! I thought we won!' -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re[2]: This hopefully is a simple question that has been dealt with
On Saturday, March 30, 2002, 8:06:10 AM, Wellie W. Chao wrote: WWC Have you looked at the validator that comes with struts 1.1 beta? WWC You can look at validator.xml and validator-rules.xml in the WWC blank application's WEB-INF. It's for input though, as opposed to WWC output. I haven't heard of anything similar for output. Yes, I'm actually using Validator. Like you mention, however, it doesn't really deal with displaying data that you get from the business tier. WWC -Original Message- WWC From: Vladimir Levin [mailto:[EMAIL PROTECTED]] WWC Sent: Thursday, March 28, 2002 10:48 PM WWC To: [EMAIL PROTECTED]; [EMAIL PROTECTED] WWC Subject: Re: This hopefully is a simple question that has been dealt WWC with WWC I haven't found the solution I will use yet to solve this problem WWC in my own project, so advice would definitely be helpful. WWC I found a taglibrary that purports to do this (at http://jsptags.com) WWC http://www.sqlt.com/taglib.html WWC I have not investigated using it just yet though. I think even WWC writing one's own tag to format dates and numbers should be easy WWC enough: just extend the bean:write tag to support a format WWC attribute and use the existing java formatting capabilities WWC (SimpleDateFormat, NumberFormat). WWC Doing arbitrary String masking would be cool too (typical WWC example is phone number formatting, currency formatting, WWC but I also have additional requirements). Does anyone know WWC of a taglib that does this kind of thing? WWC Vlad Sorry to post this question again, but I'm still curious about this ... I'm sure this question has come up but I'm not having much luck searching the archives. I'm really new to Struts so I hope this question isn't too out of place for this list. Lets say we are dealing with Employee beans. I would my EmployeeBean to be able to have members that are not all Strings. (In this example say Age would be an int, birthDate a java.util.Date, etc.). Now in the sample app I'm developing I have an EmployeeForm class also that currently has just String datatypes for these fields. Having the information from the actual form jsp's going to the EmployeeForm in as all Strings without any conversions is not that big of a deal since wherever I do anything with this data (jdbc inserts in the business logic I could always covert them there if I need to ). However, I'm more concerned with getting this information displayed correctly using the iterate tag. For example, say I have on an Action class that gets back and ArrayList of EmployeeBean objects and puts this list into the request before forwarding. I really can't do: logic:iterate id=row name=employeeList bean:write name=row property=firstName/BR bean:write name=row property=lastName/BR bean:write name=row property=age/BR bean:write name=row property=birthDate/BR BR /logic:iterate since I won't have birthDate formatted correctly, or say I was returning a Double that I needed in a currency format. What is the best way to deal with this situation? I could of course maybe have my business logic return me a Collection of EmployeeForm beans instead and inside the EmployeeForm beans there would be methods like setBirthDateDate( Date date ) that would take a java.util.Date and format it into a String and then call the EmployeeForm setBrithDate( String date ). Although that would work, I'd still rather deal with the business logic that returns a Collection of EmployeeBeans... as this seems to make the most reusable sense (maybe the components later won't just be for the web). Thanks for any help. -- Rick mailto:[EMAIL PROTECTED] Why do people in ship mutinies always ask for 'better treatment'? I'd ask for a pinball machine, because with all that rocking back and forth you'd probably be able to get a lot of free games. -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] WWC _ WWC Join the worlds largest e-mail service with MSN Hotmail. WWC http://www.hotmail.com WWC -- WWC To unsubscribe, e-mail: WWC mailto:[EMAIL PROTECTED] WWC For additional commands, e-mail: WWC mailto:[EMAIL PROTECTED] WWC -- WWC To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] WWC For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Rick mailto:[EMAIL PROTECTED] If I was the head of a country that lost a war, and I had to sign a peace treaty, just as I was signing, I'd glance over the treaty and then suddenly act surprised. 'Wait a minute! I thought we won!' -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Does this tag exist architecture [was] This hopefully is a simple question that has been dealt with
On Friday, March 29, 2002, 11:19:25 AM, Maturo, Larry wrote: ML We define a separate bean that mirrors our ML EmployeeBean, but has string fields. We then ML get a list of EmployeeBeans and manually convert ML them to a list of EmployeeStringBeans. :-) It's ML a pain, but it works. Note that we only populate ML the fields we actually plan on displaying, since ML it is pointless to populate the other fields. Thanks for your feedback Larry. (By the way nice job on that AthensGroup paper on Struts if you wrote it). Currently I already have an EmployeeForm bean (all String fields) and an EmployeeBean (Strings, ints, etc.). The business tier does the DB query and returns an ArrayList of EmployeeBeans. Now the question becomes what next in order to iterate through this list and display the EmployeeBean fields in a nice way (ie. proper date format, currency format, etc.) ?... I'm assuming from your reply that you might have extra logic somewhere that will take that ArrayList of EmployeeBeans and loop through the list and populate a new List of EmployeeForm beans. In this step calls will be made to make sure the Strings in each EmployeeForm object are correctly formatted. I see how this idea will work, although it seems a shame that you have a perfectly good ArrayList of Employee objects and now you are iterating through it just to populate another ArrayList of Employee objects with all String fields. Before I looked into Struts I didn't see the big deal of iterating though this list of regular EmployeeBean objects and then where formatting was needed just call my helper util class to change the format. For example: %= RickUtils.displayDateAsString( bean.getBirthDate() ) % I know, everyone says the above it bad because you now have scriplets in your JSP code. Still, though, this seems to make more sense to me than to going through the overhead of looping through possibly a large ArrayList of beans in order to just populate a similar ArrayList with just String fields. I suppose I will go the later route in order to maintain the Struts architecture of perfectly clean JSP pages. Being new to struts and new to using tags, would it be that difficult to create a tag that when passed a double it new to spit out a display in some currency format or if it received a Date it would display it in the proper format. I noticed there is a tag library out there for display dates, but ideally I would like one tag that would just pick up the datatype and if datatype is double display this way, if Date display this way. Does a tag library like the above already exist? Thanks again for your feedback. I'm posting this to the list as well for any other ideas. ML There is a utility in Struts to help with this, but ML I have never used it, since it always seemed like ML learning to use it was more work than doing it ML manually. ML -- Larry Maturo ML[EMAIL PROTECTED] ML -Original Message- ML From: Rick Reumann [mailto:[EMAIL PROTECTED]] ML Sent: Thursday, March 28, 2002 9:09 PM ML To: Struts Users Mailing List ML Subject: This hopefully is a simple question that has been dealt with ML Sorry to post this question again, but I'm still curious about this ML ... ML I'm sure this question has come up but I'm not having much luck ML searching the archives. I'm really new to Struts so I hope this ML question isn't too out of place for this list. Lets say we are dealing ML with Employee beans. I would my EmployeeBean to be able to have ML members that are not all Strings. (In this example say Age would be an ML int, birthDate a java.util.Date, etc.). Now in the sample app I'm ML developing I have an EmployeeForm class also that currently has just ML String datatypes for these fields. Having the information from the ML actual form jsp's going to the EmployeeForm in as all Strings without ML any conversions is not that big of a deal since wherever I do anything ML with this data (jdbc inserts in the business logic I could always ML covert them there if I need to ). However, I'm more concerned with ML getting this information displayed correctly using the iterate tag. ML For example, say I have on an Action class that gets back and ML ArrayList of EmployeeBean objects and puts this list into the request ML before forwarding. I really can't do: ML logic:iterate id=row name=employeeList ML bean:write name=row property=firstName/BR ML bean:write name=row property=lastName/BR ML bean:write name=row property=age/BR ML bean:write name=row property=birthDate/BR ML BR ML /logic:iterate ML since I won't have birthDate formatted correctly, or say I was ML returning a Double that I needed in a currency format. What is the ML best way to deal with this situation? I could of course maybe have my ML business logic return me a Collection
This hopefully is a simple question that has been dealt with
Sorry to post this question again, but I'm still curious about this ... I'm sure this question has come up but I'm not having much luck searching the archives. I'm really new to Struts so I hope this question isn't too out of place for this list. Lets say we are dealing with Employee beans. I would my EmployeeBean to be able to have members that are not all Strings. (In this example say Age would be an int, birthDate a java.util.Date, etc.). Now in the sample app I'm developing I have an EmployeeForm class also that currently has just String datatypes for these fields. Having the information from the actual form jsp's going to the EmployeeForm in as all Strings without any conversions is not that big of a deal since wherever I do anything with this data (jdbc inserts in the business logic I could always covert them there if I need to ). However, I'm more concerned with getting this information displayed correctly using the iterate tag. For example, say I have on an Action class that gets back and ArrayList of EmployeeBean objects and puts this list into the request before forwarding. I really can't do: logic:iterate id=row name=employeeList bean:write name=row property=firstName/BR bean:write name=row property=lastName/BR bean:write name=row property=age/BR bean:write name=row property=birthDate/BR BR /logic:iterate since I won't have birthDate formatted correctly, or say I was returning a Double that I needed in a currency format. What is the best way to deal with this situation? I could of course maybe have my business logic return me a Collection of EmployeeForm beans instead and inside the EmployeeForm beans there would be methods like setBirthDateDate( Date date ) that would take a java.util.Date and format it into a String and then call the EmployeeForm setBrithDate( String date ). Although that would work, I'd still rather deal with the business logic that returns a Collection of EmployeeBeans... as this seems to make the most reusable sense (maybe the components later won't just be for the web). Thanks for any help. -- Rick mailto:[EMAIL PROTECTED] Why do people in ship mutinies always ask for 'better treatment'? I'd ask for a pinball machine, because with all that rocking back and forth you'd probably be able to get a lot of free games. -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: This hopefully is a simple question that has been dealt with
I haven't found the solution I will use yet to solve this problem in my own project, so advice would definitely be helpful. I found a taglibrary that purports to do this (at http://jsptags.com) http://www.sqlt.com/taglib.html I have not investigated using it just yet though. I think even writing one's own tag to format dates and numbers should be easy enough: just extend the bean:write tag to support a format attribute and use the existing java formatting capabilities (SimpleDateFormat, NumberFormat). Doing arbitrary String masking would be cool too (typical example is phone number formatting, currency formatting, but I also have additional requirements). Does anyone know of a taglib that does this kind of thing? Vlad Sorry to post this question again, but I'm still curious about this ... I'm sure this question has come up but I'm not having much luck searching the archives. I'm really new to Struts so I hope this question isn't too out of place for this list. Lets say we are dealing with Employee beans. I would my EmployeeBean to be able to have members that are not all Strings. (In this example say Age would be an int, birthDate a java.util.Date, etc.). Now in the sample app I'm developing I have an EmployeeForm class also that currently has just String datatypes for these fields. Having the information from the actual form jsp's going to the EmployeeForm in as all Strings without any conversions is not that big of a deal since wherever I do anything with this data (jdbc inserts in the business logic I could always covert them there if I need to ). However, I'm more concerned with getting this information displayed correctly using the iterate tag. For example, say I have on an Action class that gets back and ArrayList of EmployeeBean objects and puts this list into the request before forwarding. I really can't do: logic:iterate id=row name=employeeList bean:write name=row property=firstName/BR bean:write name=row property=lastName/BR bean:write name=row property=age/BR bean:write name=row property=birthDate/BR BR /logic:iterate since I won't have birthDate formatted correctly, or say I was returning a Double that I needed in a currency format. What is the best way to deal with this situation? I could of course maybe have my business logic return me a Collection of EmployeeForm beans instead and inside the EmployeeForm beans there would be methods like setBirthDateDate( Date date ) that would take a java.util.Date and format it into a String and then call the EmployeeForm setBrithDate( String date ). Although that would work, I'd still rather deal with the business logic that returns a Collection of EmployeeBeans... as this seems to make the most reusable sense (maybe the components later won't just be for the web). Thanks for any help. -- Rick mailto:[EMAIL PROTECTED] Why do people in ship mutinies always ask for 'better treatment'? I'd ask for a pinball machine, because with all that rocking back and forth you'd probably be able to get a lot of free games. -Jack Handey -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
logic:equal simple question
can I use the tag logic:equal name=myForm property=MyProperty value=3 in other words can i use an int ? how about a boolean? thanks in advance. Gus
AW: logic:equal simple question
you can compare a property to an int value, but you have to quote it: logic:equal name=myForm property=MyProperty value=3 -Ursprungliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von gdelgado Gesendet: Dienstag, 3. Juli 2001 21:27 An: [EMAIL PROTECTED] Betreff: logic:equal simple question can I use the tag logic:equal name=myForm property=MyProperty value=3 in other words can i use an int ? how about a boolean? thanks in advance. Gus
Re: logic:equal simple question
what is we have an index of type int??? how do we refer to it??? means suppose i have % int index=0; % how can i check this with logic:equal thanks, rama - Original Message - From: Norman Timmler [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2001 1:13 PM Subject: AW: logic:equal simple question you can compare a property to an int value, but you have to quote it: logic:equal name=myForm property=MyProperty value=3 -Ursprungliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von gdelgado Gesendet: Dienstag, 3. Juli 2001 21:27 An: [EMAIL PROTECTED] Betreff: logic:equal simple question can I use the tag logic:equal name=myForm property=MyProperty value=3 in other words can i use an int ? how about a boolean? thanks in advance. Gus
simple question
Title: Java Bean log file. Hi Guys, Can anyone tell me the difference between 'Page Scope' and 'Request Scope'. What is the boundaries set by each one.. Thanks a lot. cheers, Amar..
RE: simple question
Thanx everybody for clarifying. cheers, Amar.. -Original Message- From: Peter Alfors [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 25, 2001 3:50 PM To: [EMAIL PROTECTED] Subject: Re: simple question From the pageContext javadoc: PAGE_SCOPE page scope: (this is the default) the named reference remains available in this PageContext until the return from the current Servlet.service() invocation. REQUEST_SCOPE request scope: the named reference remains available from the ServletRequest associated with the Servlet that until the current request is completed. SESSION_SCOPE session scope (only valid if this page participates in a session): the named reference remains available from the HttpSession (if any) associated with the Servlet until the HttpSession is invalidated. APPLICATION_SCOPE application scope: named reference remains available in the ServletContext until it is reclaimed. HTH, Pete Nanduri, Amarnath wrote: Hi Guys, Can anyone tell me the difference between 'Page Scope' and 'Request Scope'. What is the boundaries set by each one.. Thanks a lot.cheers,Amar..
Re: simple question
Title: Java Bean log file. page scope does NOT HOLD VALUES BETWEEN pages. request scope holds values UNTIL THE END OF THE REQEST which could be one or more jsps/servlets. That is, the page request is like a variable useful within the jsp page and not from another page. You can ask the jsp page what variables it contains by using page scope. - Original Message - From: Nanduri, Amarnath To: '[EMAIL PROTECTED]' Sent: Wednesday, April 25, 2001 3:35 PM Subject: simple question Hi Guys, Can anyone tell me the difference between 'Page Scope' and 'Request Scope'. What is the boundaries set by each one.. Thanks a lot. cheers, Amar..
Re: simple question
From the pageContext javadoc: PAGE_SCOPE page scope: (this is the default) the named reference remains available in this PageContext until the return from the current Servlet.service() invocation. REQUEST_SCOPE request scope: the named reference remains available from the ServletRequest associated with the Servlet that until the current request is completed. SESSION_SCOPE session scope (only valid if this page participates in a session): the named reference remains available from the HttpSession (if any) associated with the Servlet until the HttpSession is invalidated. APPLICATION_SCOPE application scope: named reference remains available in the ServletContext until it is reclaimed. HTH, Pete Nanduri, Amarnath wrote: Hi Guys, Can anyone tell me the difference between 'Page Scope' and 'Request Scope'. What is the boundaries set by each one.. Thanks a lot.cheers,Amar.. begin:vcard n:; x-mozilla-html:FALSE org:BRIMG SRC=http://www.irista.com/logo/irista.gif;BRBRFONT Color=#80FONT SIZE=2BBringing Vision to Your Supply Chain adr:;; version:2.1 end:vcard
Date formatting (simple question)
Hi folks, Can I format java.util.Date presentations with bean:write, or do I need to do something at the property getter? TKS. Matt.
Re: Date formatting (simple question)
Hello Matthew, Thursday, April 12, 2001, 5:55:21 AM, you wrote: MOH Can I format java.util.Date presentations with bean:write, or do I need to MOH do something at the property getter? You can do it in getter method and by special version of bean:write tag - with parameters to define formatting type and locale. I can send you one, if you interested. -- Best regards, Olegmailto:[EMAIL PROTECTED]
Simple question about Struts
Has anyone used Allaire's JRun and Struts yet? If so, are any of you fine people willing to share tips or tricks of what to do or not do? Thanks in advance. Mike V.