[OT] JSP 2.0 tag files and expressions
Sorry for the off-topic post but I'm sure someone here will be able to tell me what's going on with this... I'm trying to use the JSTL forEach tag in a tag file invoked by another tag file and I'm getting an error. Here's an example piece of JSP: v: ${v} That works fine in a JSP. It works fine in a tag file invoked from a JSP. But if the tag file is invoked from another tag file, I get the error "According to TLD or attribute directive in tag file, attribute end does not accept any expressions." I can use the expression language in other places (e.g. outside of custom tags) though. Is this a limitation of tag files or of Tomcat's implementation of them? Or am I just doing something wrong? If it's a limitation of the JSP spec and/or Tomcat, is there a work-around? Otherwise tag files are about to become a whole lot less useful to me... :-( L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] JSP 2.0 tag files and expressions
You summed it up perfectly. And that test case works for me too. As does my own now. I've no idea what I changed between last night and now, but everything's now fine! I'm glad of that but I hate mystery bugs... L. Kris Schneider wrote: This worked on TC 5.0.28: /WEB-INF/tags/tag1.tag: --- <%@ tag body-content="empty" %> <%@ taglib prefix="tags" tagdir="/WEB-INF/tags/" %> /WEB-INF/tags/tag2.tag: --- <%@ tag body-content="empty" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %> v: ${v} tagfile.jsp: <%@ taglib prefix="tags" tagdir="/WEB-INF/tags/" %> Which generated: v: 0 v: 1 v: 2 v: 3 v: 4 Is that what you were trying to do? Quoting Laurie Harper <[EMAIL PROTECTED]>: Sorry for the off-topic post but I'm sure someone here will be able to tell me what's going on with this... I'm trying to use the JSTL forEach tag in a tag file invoked by another tag file and I'm getting an error. Here's an example piece of JSP: v: ${v} That works fine in a JSP. It works fine in a tag file invoked from a JSP. But if the tag file is invoked from another tag file, I get the error "According to TLD or attribute directive in tag file, attribute end does not accept any expressions." I can use the expression language in other places (e.g. outside of custom tags) though. Is this a limitation of tag files or of Tomcat's implementation of them? Or am I just doing something wrong? If it's a limitation of the JSP spec and/or Tomcat, is there a work-around? Otherwise tag files are about to become a whole lot less useful to me... :-( L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts boooks: remommendations?
I'm looking for a good book on Struts, but there seem to be a number of choices... Choice is all well and good, but i need some selection criteria :-) I'm looking for a book that has comprehensive coverage of Struts, is up-to-date, and which focuses on Struts (not a book on web application development that happens to talk about Struts along the way, for example). So, what do people recommend? What books have you found most useful in that context? From the sample chapters on line it seems like Struts in Action may be a good choice but I don't know how up-to-date it is. Suggestions appreciated :) L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
validaton and i18n
I've finally managed to get the Struts Validator working, thanks to the sample chapter on it from Struts in Action. I'm having one small problem still, though. When validation fails, I get a blank alery popup. Looking at the generated Javascript the problem appears to be that the message strings aren't populated: function required () { this.aa = new Array("email", "", new Function ("varName", "this.mask=/^([!#\\$%&'\\*\\+\\-\\.\\/0-9=\\?A-Z\\^\\x5E_`a-z\\{\\|\\}~]+)@(([0-9a-zA-Z]([0-9a-zA-Z-]*[0-9a-zA-Z])?)(\\.[0-9a-zA-Z]([0-9a-zA-Z-]*[0-9a-zA-Z])?)+)$/; return this[varName];")); this.ab = new Array("password", "", new Function ("varName", " return this[varName];")); } The message keys are defined in the validation.xml file, I think correctly: mask ^([!#\$%&'\*\+\-\.\/0-9=\?A-Z\^\x5E_`a-z\{\|\}~]+)@(([0-9a-zA-Z]([0-9a-zA-Z-]*[0-9a-zA-Z])?)(\.[0-9a-zA-Z]([0-9a-zA-Z-]*[0-9a-zA-Z])?)+)$ The message resources are defined and, indeed, I can see in the Struts debug log that they're being looked up when the form is rendered: L4J 2004-03-31 19:52:00,945 DEBUG PropertyMessageResources getMessage(en_US,errors.required) L4J 2004-03-31 19:52:00,946 DEBUG PropertyMessageResources getMessage(en_US,logon.error.password.missing) L4J 2004-03-31 19:52:00,946 DEBUG PropertyMessageResources loadLocale(en_US) L4J 2004-03-31 19:52:00,946 DEBUG PropertyMessageResources getMessage(en_US,errors.required) L4J 2004-03-31 19:52:00,957 DEBUG PropertyMessageResources getMessage(en_US,logon.error.email.missing) They just never get pushed to the page. Here's what I'm using to get the form validation in my JSP: ... What have I missed? Thanks, L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tricky configuration?
Another option might be to use two URL mappings: *.do and /users/*. Would that get you what you want? L. amol k wrote: There are several ways to make this transparent to the user! I can send details if >you don't know how? Do send details if you can. Something like what Martin is suggesting looks like one way. Thanks. On 6/3/05, Ray Madigan <[EMAIL PROTECTED]> wrote: Why are you making your users type in the action anyway. Why don't you mask this so they don't know how you implemented it. There are several ways to make this transparent to the user! I can send details if you don't know how? -Original Message- From: amol k [mailto:[EMAIL PROTECTED] Sent: Friday, June 03, 2005 11:50 AM To: Struts Users Mailing List Subject: Re: Tricky configuration? Why not just map /do/* to the action servlet insted of *.do http://myserver/Login.do to http://myserver/do/Login, etc is not an issue but Making the users type http://myserver/do/user/blahblah instead of http://myserver/user/blahblah is a usability issue. (will have to ultimately do that if there's no other option but I want to avoid /do before user/blahblah as far as possible) On 6/3/05, Rick Reumann <[EMAIL PROTECTED]> wrote: Why not just map /do/* to the action servlet insted of *.do Then all of these would go through Struts.. http://myserver/do/Login http://myserver/do/Logout http://myserver/do/user/blahblah This obviously wouldn't go through struts.. http://myserver/pages/blahblah.jsp amol k wrote the following on 6/3/2005 2:39 PM: Here is what I am trying to achieve: http://myserver/Login.do --> (maps to) LoginAction http://myserver/Logout.do --> (maps to) LogoutAction http://myserver/user/blahblah --> UserPageAction (notice that there is no .do in this case. blahblah can be replaced by anything at runtime) http://myserver/pages/blahblah.jsp --> not handled by ActionServlet (obviously) I am trying various combinations in web.xml and struts-config.xml (including configuring /user as a module) but havent yet found a decent solution. Any thoughts? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Rick - 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]
Nested properties in DynaActionForm
I'm probably missing something really obvious but I've been fiddling about with this for a while now. Maybe someone can spot what I'm doing wrong... I'm using DynaActionForms in my Struts app and I'd like to be able to reference a property like this: I tried a form declaration like this: but I get an error during request processing that 'iterationLength' is not a valid property. So then I tried: Struts appears to be trying to cope with this: DEBUG [http8080-Processor24] org.apache.commons.beanutils.BeanUtils - setProperty(DynaActionForm[dynaClass=ProjectEdit,startDate=,owner=,mode=,description=,iterationLength={},endDate=,status=,name=,doSave=], iterationLength.time, [1]) DEBUG [http8080-Processor24] org.apache.commons.beanutils.BeanUtils - Target bean = {} DEBUG [http8080-Processor24] org.apache.commons.beanutils.BeanUtils - Target name = time So it's getting the empty map as the target bean on which to set a property 'time'. But when I fetch the map from the form in my action, it's empty. Is there a way to do this? The reason I want to be able to write the property as "iterationLength.time", rather than collapsing it to 'iterationLengthTime' or something is for consistency with when I'm accesing the same property in other beans which aren't dynamically generated. Thanks, L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DynaActionForm / BeanUtils usage issue
Code in a unit test: DyanActionForm form = new DynaActionForm(); BeanUtils.copyProperties(bean, form); This results in a NullPointerException when BeanUtils calls form.getDynaClass().getProperties() (or something like that). BeanUtils is expecting dynaClass to be set, but DynaActionFrom gives me no way to set it, unless I create a sub-class. I had to single step through the BeanUtils code to figure out what was causing the NPE (complicated by the fact that BeanUtils 1.7.0 has an incorrect version listed in it's manifest :=( ). DynaActionFrom should probably either be abstract or provide a setter for dynaClass, given that it's currently impossible to create a valid instance without sub-classing. I'll file a bug report against BeanUtils to use guards around uses of getDynaClass() if we can't agree a way to ensure it's unnessesary. Can Struts do one of the following: - make DynaActionForm abstract - make the default constuctor require an initialization value for dynaClass I'm guessing the answer is no (for backwards compatibility reasons, although maybe not if a DynaActionFrom w/out dynaClass set is always invalid). In that case BeanUtils will need to be fixed. Ugly way to spend an evening, this :-) L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nested properties in DynaActionForm
But I set up iterationLength as a HashMap; I thought BeanUtils could handle maps, so it'd do getIterationLength.get("time"). Perhaps I'm mixing up BeanUtils and JSTL semantics. L. Hubert Rabago wrote: Nested properties with DynaActionForms actually require you to nest objects. :) Using a property name like "iterationLength.time" would be like saying "getIterationLength().getTime()", and this is what BeanUtils would try to do. Hubert On 6/7/05, Laurie Harper <[EMAIL PROTECTED]> wrote: I'm probably missing something really obvious but I've been fiddling about with this for a while now. Maybe someone can spot what I'm doing wrong... I'm using DynaActionForms in my Struts app and I'd like to be able to reference a property like this: I tried a form declaration like this: but I get an error during request processing that 'iterationLength' is not a valid property. So then I tried: Struts appears to be trying to cope with this: DEBUG [http8080-Processor24] org.apache.commons.beanutils.BeanUtils - setProperty(DynaActionForm[dynaClass=ProjectEdit,startDate=,owner=,mode=,description=,iterationLength={},endDate=,status=,name=,doSave=], iterationLength.time, [1]) DEBUG [http8080-Processor24] org.apache.commons.beanutils.BeanUtils - Target bean = {} DEBUG [http8080-Processor24] org.apache.commons.beanutils.BeanUtils - Target name = time So it's getting the empty map as the target bean on which to set a property 'time'. But when I fetch the map from the form in my action, it's empty. Is there a way to do this? The reason I want to be able to write the property as "iterationLength.time", rather than collapsing it to 'iterationLengthTime' or something is for consistency with when I'm accesing the same property in other beans which aren't dynamically generated. Thanks, L. - 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: Test whether an application resource is empty
Try: "> ... where 'name' is the name of the attribute your resource bundle is stored under. L. Chris Loschen wrote: Hi Wendy, Thank you very much for your reply. Yes, I also thought that I could test the key, then check to see if the value was empty. But just how to do it is eluding me. I think part of the problem might be this: USAGE NOTE - If you use another tag to create the body content (e.g. bean:write), that tag must return a non-empty String. An empty String equates to an empty body or a null String, and a new scripting variable cannot be defined as null. Your bean must return a non-empty String, or the define tag must be wrapped within a logic tag to test for an empty or null value. (from the Struts User Guide for bean:define at http://struts.apache.org/userGuide/struts-bean.html#define). I'm trying to do something like But it's failing (I think) because the bean:message returns an empty String. I would wrap it in a logic tag as suggested, but if I could do that, I'd just use the same logic for my logic:notEmpty tag instead. So finding a way to take that value and assign that to a variable which I can then test to see whether or not it's empty is what I'm trying to do. It was not my idea to add all of these empty i18n values: the i18n team did it. If I can't find a way to make this idea work, that's my alternate path. If that's the road I need to take, I can do it -- I was just hopeful I could do this a little more elegantly. Thanks for your input. Any further ideas? Chris -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Thursday, June 09, 2005 11:52 AM To: Struts Users Mailing List Subject: Re: Test whether an application resource is empty From: "Chris Loschen" <[EMAIL PROTECTED]> Quick synopsis: I have localized i18n messages defined in my tiles definitions which are sometimes empty. I need to test that the value associated with a given key is not empty before I proceed with further processing. I can test that the key is non-empty, but I haven't yet figured out how to test the same thing for the value. If you can test the key, then it would seem that removing the empty messages would solve the problem. Why are the empty ones there in the first place? Can you get rid of them? -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Siebel IT'S ALL ABOUT THE CUSTOMER Visit www.siebel.com This e-mail message is for the sole use of the intended recipient(s) and contains confidential and/or privileged information belonging to Siebel Systems, Inc. or its customers or partners. Any unauthorized review, use, copying, disclosure or distribution of this message is strictly prohibited. If you are not an intended recipient of this message, please contact the sender by reply e-mail and destroy all soft and hard copies of the message and any attachments. Thank you for your cooperation. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test whether an application resource is empty
You want to use the name of the attribute the resource bundle is stored under, not the name of the properties file. You're not specifying it in your Struts config so you want the following: ... L. Chris Loschen wrote: Thanks Laurie, I tried to set it up this way, but wasn't able to make it work. My struts-config file defines the message-resources parameter like so: So I tried putting that in, and also tried some variants like org.apache.struts.ApplicationResources and org.apache.struts.util.MessageResources in code like this: But it always returned false, even if there was a value for the key, so I apparently set up something wrong. I did get it working using the alternate path, however -- I set up a new tile in the tiles-defs file which was defined as a zero-length file in the default case and a small JSP for those cases where I had directions. The calling JSP looks like this: And the inserted tile (when I insert a non-zero-length file) looks like this: <% String directionsKey = (String) request.getAttribute("directionToUserKey"); %> That is working ok, though of course I don't have the flexibility of having a value for some locales and no value for other locales. That's not terribly important. By the way, just for my own learning: I initially tried to put the attribute in page scope, but I kept getting a null value: is page scope specific to a particular JSP (I would have thought that was tile scope...), or should it be available throughout the sub-elements of a given page? It works when I use request scope instead, but is that what is required here? Thanks again for everyone's help! Chris Loschen -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Thursday, June 09, 2005 7:07 PM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty Try: "> ... where 'name' is the name of the attribute your resource bundle is stored under. L. Chris Loschen wrote: Hi Wendy, Thank you very much for your reply. Yes, I also thought that I could test the key, then check to see if the value was empty. But just how to do it is eluding me. I think part of the problem might be this: USAGE NOTE - If you use another tag to create the body content (e.g. bean:write), that tag must return a non-empty String. An empty String equates to an empty body or a null String, and a new scripting variable cannot be defined as null. Your bean must return a non-empty String, or the define tag must be wrapped within a logic tag to test for an empty or null value. (from the Struts User Guide for bean:define at http://struts.apache.org/userGuide/struts-bean.html#define). I'm trying to do something like But it's failing (I think) because the bean:message returns an empty String. I would wrap it in a logic tag as suggested, but if I could do that, I'd just use the same logic for my logic:notEmpty tag instead. So finding a way to take that value and assign that to a variable which I can then test to see whether or not it's empty is what I'm trying to do. It was not my idea to add all of these empty i18n values: the i18n team did it. If I can't find a way to make this idea work, that's my alternate path. If that's the road I need to take, I can do it -- I was just hopeful I could do this a little more elegantly. Thanks for your input. Any further ideas? Chris -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Thursday, June 09, 2005 11:52 AM To: Struts Users Mailing List Subject: Re: Test whether an application resource is empty From: "Chris Loschen" <[EMAIL PROTECTED]> Quick synopsis: I have localized i18n messages defined in my tiles definitions which are sometimes empty. I need to test that the value associated with a given key is not empty before I proceed with further processing. I can test that the key is non-empty, but I haven't yet figured out how to test the same thing for the value. If you can test the key, then it would seem that removing the empty messages would solve the problem. Why are the empty ones there in the first place? Can you get rid of them? -- Wendy Smoak ___ Siebel IT'S ALL ABOUT THE CUSTOMER Visit www.siebel.com This e-mail message is for the sole use of the intended recipient(s) and contains confidential and/or privileged information belonging to Siebel Systems, Inc. or its customers or partners. Any unauthorized review, use, copying, disclosure or distribution of this message is strictly prohibited. If you are not an intended recipient of this message, please contact the sen
Re: Adding parameter to local forwards
If a redirect rather than a forward is acceptable, you can also look at ActionRedirect (new in 1.2.7). ActionForward fwd = mapping.findForward(...); ActionRedirect ar = new ActionRedirect(fwd); ar.addParameter("name", f.getString("name")); return ar; L. Michael Jouravlev wrote: Something like this: ActionForward af = mapping.findForward("showParentForm"); return new ActionForward( actionForward.getName(), actionForward.getPath() + "?drawing_id=24", actionForward.getRedirect() ); You must create a new instance of ActionForward, you cannot change existing one, since it is frozen. Michael. On 6/10/05, Yuniar Setiawan <[EMAIL PROTECTED]> wrote: Hi all, I have a configuration like this one below: now inside the SubmitDrawingUploadAction class usually i just need the following statement to forward to DrawingUpdate.do : return mapping.findForwards("showParentForm"); the question is, what if I want to add extra parameter?? so it would be forwarded into DrawingUpdate.do?drawing_id=24 how can I add that 'drawing_id' parameter from inside SubmitDrawingUploadAction class ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] using JSTL with escapeXML="false" for preview HTML
What's an 'html special space char'? Lixin Chu wrote: Hi, I am trying to preview a piece of html content. but the c:out with escapeXML=false can not handle space char correctly. is there an easy way to replace the ' ' with html special space char ? thanks lixin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP]onchange in the tag
Leandro_Dorileo/[EMAIL PROTECTED] wrote: onchange="javascript:form.action='value="myFormBean.myProperty"/>';form.submit();"> You can't nest JSP custom tags like that. If you can use JSTL, this will work: If you can't use JSTL you'll have to resort to a runtime expression: HTH, L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Test whether an application resource is empty
Doh, I'm an idiot! :-( What I suggested is like trying to call getFoo() on the resource bundle bean, where 'Foo' is what ever <%=directionToUserKey.toString()%> evaluates to. Clearly not what's needed. The following works for me: using Struts bean/logic Just replace 'errors.cancel' with '<%=directionToUserKey.toString()%>' and you should be set. Sorry for the confusion, L. Chris Loschen wrote: Thanks again, Laurie, but for some reason it still returns false every time, even if there is something under that key. I'm pretty sure I followed your directions exactly: Although I did have to pull the key back out of the request in my second tile -- do I have to do that here as well? I may have to give up for now, since I have it working the other way, but I'm still curious what I did wrong. Chris -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Friday, June 10, 2005 2:49 PM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty You want to use the name of the attribute the resource bundle is stored under, not the name of the properties file. You're not specifying it in your Struts config so you want the following: ... L. Chris Loschen wrote: Thanks Laurie, I tried to set it up this way, but wasn't able to make it work. My struts-config file defines the message-resources parameter like so: So I tried putting that in, and also tried some variants like org.apache.struts.ApplicationResources and org.apache.struts.util.MessageResources in code like this: key="<%=directionToUserKey.toString()%>"/> But it always returned false, even if there was a value for the key, so I apparently set up something wrong. I did get it working using the alternate path, however -- I set up a new tile in the tiles-defs file which was defined as a zero-length file in the default case and a small JSP for those cases where I had directions. The calling JSP looks like this: And the inserted tile (when I insert a non-zero-length file) looks like this: <% String directionsKey = (String) request.getAttribute("directionToUserKey"); %> That is working ok, though of course I don't have the flexibility of having a value for some locales and no value for other locales. That's not terribly important. By the way, just for my own learning: I initially tried to put the attribute in page scope, but I kept getting a null value: is page scope specific to a particular JSP (I would have thought that was tile scope...), or should it be available throughout the sub-elements of a given page? It works when I use request scope instead, but is that what is required here? Thanks again for everyone's help! Chris Loschen -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Thursday, June 09, 2005 7:07 PM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty Try: "> ... where 'name' is the name of the attribute your resource bundle is stored under. L. Chris Loschen wrote: Hi Wendy, Thank you very much for your reply. Yes, I also thought that I could test the key, then check to see if the value was empty. But just how to do it is eluding me. I think part of the problem might be this: USAGE NOTE - If you use another tag to create the body content (e.g. bean:write), that tag must return a non-empty String. An empty String equates to an empty body or a null String, and a new scripting variable cannot be defined as null. Your bean must return a non-empty String, or the define tag must be wrapped within a logic tag to test for an empty or null value. (from the Struts User Guide for bean:define at http://struts.apache.org/userGuide/struts-bean.html#define). I'm trying to do something like But it's failing (I think) because the bean:message returns an empty String. I would wrap it in a logic tag as suggested, but if I could do that, I'd just use the same logic for my logic:notEmpty tag instead. So finding a way to take that value and assign that to a variable which I can then test to see whether or not it's empty is what I'm trying to do. It was not my idea to add all of these empty i18n values: the i18n team did it. If I can't find a way to make this idea work, that's my alternate path. If that's the road I need to take, I can do it -- I was just hopeful I could do this a little more elegantly. Thanks for your input. Any further ideas? Chris -Original Mess
Re: Test whether an application resource is empty
Chris Loschen wrote: As I understand it, this would return the error only if there are no messages at all in the application resource, which is not at all likely in this context. We're testing whether a particular application resource (that is, a particular key-value pair in the application resource file) is empty, not the whole file. No, it should return the error only if the resource named resource string exists. The key is the 'special' property name 'message(foo)', which translates into 'messages.getMessage("foo"). For me, if 'foo' is a valid message key I get the body of the tag displayed; if 'foo' is not defined in my resource bundle, I don't. That said, I still didn't get the results I had hoped for with the new version either, unfortunately. I didn't get any errors, but it returned true even when the value was empty. For example, when I had an application resource key set up like so: module.admin.manageHierarchy.businessStruc.add.directionToUser= Hmm, I hadn't tried that; I just tested it and it worked for me. And my JSP code is set up like this: It returns notEmpty as true, because I get this in the page: I presume it must be testing that the key exists and is non-zero-length rather than testing the value. Oh well. That's odd. Here's a copy/paste of my test, which works as expected: test 1 property="message(errors.cancel.missing)"> test 2 <% String foo = "errors.cancel.missing"; %> test 3 That gives me a single paragraph, 'test 1'. Works whether 'errors.cancel.missing' is actually missing, or defined with an empty value as in your example. If it doesn't work for you I'm out of ideas! :-/ L. Chris -Original Message- From: Nitish Kumar [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 12:54 AM To: 'Struts Users Mailing List' Subject: RE: Test whether an application resource is empty I dont understand some things here, If the application resource is empty above code would throw this error, "Define tag cannot set a null value". So how does this code helps in checking wether an application resouce is empty? Am I missing some thing here? or may be the subject is misleading.. Thanks and Regards, Nitish Kumar Tavant Technologies Ltd Bangalore -Original Message- From: Laurie Harper [mailto:[EMAIL PROTECTED] Sent: Sunday, June 12, 2005 6:30 AM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty Doh, I'm an idiot! :-( What I suggested is like trying to call getFoo() on the resource bundle bean, where 'Foo' is what ever <%=directionToUserKey.toString()%> evaluates to. Clearly not what's needed. The following works for me: using Struts bean/logic Just replace 'errors.cancel' with '<%=directionToUserKey.toString()%>' and you should be set. Sorry for the confusion, L. Chris Loschen wrote: Thanks again, Laurie, but for some reason it still returns false every time, even if there is something under that key. I'm pretty sure I followed your directions exactly: key="<%=directionToUserKey.toString()%>"/> Although I did have to pull the key back out of the request in my second tile -- do I have to do that here as well? I may have to give up for now, since I have it working the other way, but I'm still curious what I did wrong. Chris -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Friday, June 10, 2005 2:49 PM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty You want to use the name of the attribute the resource bundle is stored under, not the name of the properties file. You're not specifying it in your Struts config so you want the following: ... L. Chris Loschen wrote: Thanks Laurie, I tried to set it up this way, but wasn't able to make it work. My struts-config file defines the message-resources parameter like so: So I tried putting that in, and also tried some variants like org.apache.struts.ApplicationResources and org.apache.struts.util.MessageResources in code like this: key="<%=directionToUserKey.toString()%>"/> But it always returned false, even if there was a value for the key, so I apparently set up something wrong. I did get it working using the alternate path, however -- I set up a new tile in the tiles-defs file which was defined as a zero-length file in the default case and a small JSP for those cases where I had directions. The calling JSP loo
Re: Test whether an application resource is empty
What you're missing is the next line of code which performs the test. The define just makes the resource bundle available. As long as you have at least one message resource bundle defined in struts-config.xml the line you quote won't fail. L. Nitish Kumar wrote: I dont understand some things here, If the application resource is empty above code would throw this error, "Define tag cannot set a null value". So how does this code helps in checking wether an application resouce is empty? Am I missing some thing here? or may be the subject is misleading.. Thanks and Regards, Nitish Kumar Tavant Technologies Ltd Bangalore -Original Message- From: Laurie Harper [mailto:[EMAIL PROTECTED] Sent: Sunday, June 12, 2005 6:30 AM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty Doh, I'm an idiot! :-( What I suggested is like trying to call getFoo() on the resource bundle bean, where 'Foo' is what ever <%=directionToUserKey.toString()%> evaluates to. Clearly not what's needed. The following works for me: using Struts bean/logic Just replace 'errors.cancel' with '<%=directionToUserKey.toString()%>' and you should be set. Sorry for the confusion, L. Chris Loschen wrote: Thanks again, Laurie, but for some reason it still returns false every time, even if there is something under that key. I'm pretty sure I followed your directions exactly: Although I did have to pull the key back out of the request in my second tile -- do I have to do that here as well? I may have to give up for now, since I have it working the other way, but I'm still curious what I did wrong. Chris -----Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Friday, June 10, 2005 2:49 PM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty You want to use the name of the attribute the resource bundle is stored under, not the name of the properties file. You're not specifying it in your Struts config so you want the following: ... L. Chris Loschen wrote: Thanks Laurie, I tried to set it up this way, but wasn't able to make it work. My struts-config file defines the message-resources parameter like so: So I tried putting that in, and also tried some variants like org.apache.struts.ApplicationResources and org.apache.struts.util.MessageResources in code like this: key="<%=directionToUserKey.toString()%>"/> But it always returned false, even if there was a value for the key, so I apparently set up something wrong. I did get it working using the alternate path, however -- I set up a new tile in the tiles-defs file which was defined as a zero-length file in the default case and a small JSP for those cases where I had directions. The calling JSP looks like this: And the inserted tile (when I insert a non-zero-length file) looks like this: <% String directionsKey = (String) request.getAttribute("directionToUserKey"); %> That is working ok, though of course I don't have the flexibility of having a value for some locales and no value for other locales. That's not terribly important. By the way, just for my own learning: I initially tried to put the attribute in page scope, but I kept getting a null value: is page scope specific to a particular JSP (I would have thought that was tile scope...), or should it be available throughout the sub-elements of a given page? It works when I use request scope instead, but is that what is required here? Thanks again for everyone's help! Chris Loschen -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Thursday, June 09, 2005 7:07 PM To: user@struts.apache.org Subject: Re: Test whether an application resource is empty Try: "> ... where 'name' is the name of the attribute your resource bundle is stored under. L. Chris Loschen wrote: Hi Wendy, Thank you very much for your reply. Yes, I also thought that I could test the key, then check to see if the value was empty. But just how to do it is eluding me. I think part of the problem might be this: USAGE NOTE - If you use another tag to create the body content (e.g. bean:write), that tag must return a non-empty String. An empty String equates to an empty body or a null String, and a new scripting variable cannot be defined as null. Your bean must return a non-empty String, or the define tag must be wrapped within a logic tag to test for an empty or null value. (from the Struts User Guide for bean:define at http://struts.apache.org/userGuide/struts-bean.html#define). I
Wildcard action paths
I didn't get any response to this last time so I'm asking again... :-) I'd like to replace URLs like this: /Sections/Subsections/?section=Section1&subsection=SubSection1 with URLs like this: /Sections/Section1/Subsections/Subsection1 An action mapping like this will match that URL: The problem is, there's then no way to get what the wildcards matched in the view (JSP). For reasons discussed elsewhere I don't want to put a different action in front of each view, so I need a more general solution. I'd like to sub-class ForwardAction and put the wildcard matches from the URL into a map which can then go into request context. But how can I pass the matches *into* the action? I can't user the 'parameter' attribute since it's already used to specify where to forward to. I thought about this: But the wildcard URL matching stops working if I do that and anyway I don't think dereferencing the matches would work in that context. So, any other suggestions? The only thing I can think of right now is overloading 'parameter', something like parameter=".tiles.mytile;section={1},subsection={2}" and doing the necessary fixup in my action class. Can anyone suggest anything better? L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wildcard action paths
Van wrote: The problem is, there's then no way to get what the wildcards matched in the view (JSP). For reasons discussed elsewhere I don't want to put a different action in front of each view, so I need a more general solution. This seems so obvious to me that I'm probably missing something about your requirements. Why can't you access the HttpServleRequest.getRequestURI() method and then process the returned URI string in your subclass of the Struts ForwardAction? The execute method for an Action class gets the incoming request object as one of the parameters. Your subclass can process the URI for the section and subsection values and set them as request attributes. For that matter, the request object is available to your JSP pages as well: http://tinyurl.com/9jn4d Of course, you would have to write scriptlet logic or define a JSP custom tag to encapsulate the logic to parse for the section/subsection values in order to handle it directly in the JSPs. All easily doable though. I'm just not seeing what the problem is here. The problem with that approach is duplication of information: you have to know the URL structure in the action / tag / whatever that does the URL parsing, as well as in struts-config.xml. And I don't need a single pattern, there would be a number of them, so the URL parsing would quickly get messy. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wildcard action paths
Michael Jouravlev wrote: On 6/13/05, Laurie Harper <[EMAIL PROTECTED]> wrote: I didn't get any response to this last time so I'm asking again... :-) I'd like to replace URLs like this: /Sections/Subsections/?section=Section1&subsection=SubSection1 with URLs like this: /Sections/Section1/Subsections/Subsection1 You don't want to solve this with mod_rewrite, do you? No, I don't want to require Apache. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wildcard action paths
Van wrote: > Okay. So maybe this isn't the only wildcard mapping you will have. Still, you could have one SectionAction class for this particular wildcard mapping. That would be a vast improvement over status quo. How many different wildcard mappings do you have in this application? Almost every page will be delivered through a wild-carded action path. We're talking a few tens of patterns with varying amounts of similarity. You could pass one request parameter that indicated which wildcard pattern was involved. If you don't want to have branching logic, you could even make this additional request parameter be a property name and store in your application properties file the regular expression to use against the incoming request URL to pull out the matching wildcard values. That should scale generally to any number of different wildcard mappings using a single Action class that was driven by these regular expressions coming from your application properties file. That's still multiplying the number of places the patterns must be stored and processed, and since Struts already does everything I want except (apparently) a way to pass the results along that seems like a bad idea. Looks like my original approach (overloading 'parameter') will have to do. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Wildcard action paths
I ended up writing an action which let me do this: The action splits the parameter, builds a map from the name=value pairs and sticks it in request scope then resets parameter. Except it doesn't; ActionMapping.setParameter() throws a runtime exception, so I have to painfully construct a duplicate with the updated 'parameter' value (or wrap it in a proxy, which would be a lot better than the 14 lines of mNew.setFoo(mapping.getFoo()) I have now! Ugh. I wish this wasn't so messy :-( L. Don Brown wrote: To add to your original solution: write your own subclass of ActionConfig which overrides getParameter() to return the tiles-needed part of the parameter attribute. Additional methods will let you retrieve other parts. This way, your Action doesn't have to know about parsing; it can pull clean values out of the ActionConfig subclass. Anyways, I know what you mean about this being difficult. The set-property seems like a perfect solution, until you realize it is processed by digester at deploytime, not request-time like the parameter attribute. I think the lack of the ability to pass multiple request-time values to the Action is a serious deficiency in Struts right now. Don On 6/15/05, Laurie Harper <[EMAIL PROTECTED]> wrote: Van wrote: > Okay. So maybe this isn't the only wildcard mapping you will have. Still, you could have one SectionAction class for this particular wildcard mapping. That would be a vast improvement over status quo. How many different wildcard mappings do you have in this application? Almost every page will be delivered through a wild-carded action path. We're talking a few tens of patterns with varying amounts of similarity. You could pass one request parameter that indicated which wildcard pattern was involved. If you don't want to have branching logic, you could even make this additional request parameter be a property name and store in your application properties file the regular expression to use against the incoming request URL to pull out the matching wildcard values. That should scale generally to any number of different wildcard mappings using a single Action class that was driven by these regular expressions coming from your application properties file. That's still multiplying the number of places the patterns must be stored and processed, and since Struts already does everything I want except (apparently) a way to pass the results along that seems like a bad idea. Looks like my original approach (overloading 'parameter') will have to do. L. - 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: Wildcard action paths
Don, that absolutely rocks, you're the man! :-) Really, that's exactly what I expected and wanted to do in the config file, and that code snipet makes things even cleaner. You've just given me the means to collapse an ugly hack into a nice, clean, properly encapsulated solution. Thank you for that. Is this in CVS head, or posted as a patch somewhere? L. Don Brown wrote: Ok, but even if that is what she was wanting, it could still use the same struts config syntax I pointed out: ... Then in PathInfoForwardAction: for (Iterator i = mapping.getProperties().entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry)i.next(); String key = (String)entry.getKey(); String value = (String)entry.getValue(); ... } In this way, you still have the clean configuration, and still your Action can take any number of parameters and do something with them. Don On 6/17/05, Van <[EMAIL PROTECTED]> wrote: On 6/17/05, Don Brown <[EMAIL PROTECTED]> wrote: Ok, what about this: I added the ability to pass multiple request-time values to the Action using the ActionConfig properties. This means, in your case, your struts config would look like: ... In your PathInfoForwardAction, you can now access those values using: ... = mapping.getProperty("foo"); ... = mapping.getProperty("bar"); You may have missed that this is only one of 10 or more different wildcard action mappings in Laurie's application. At least, that is my understanding now. So, there are different foo/bar names for some of them and Laurie wanted *one* action to process them all. Of course, this approach can still work even with that more general requirement like so: ... In your PathInfoForwardAction, you can now extract your wildcard mapping info: ... = mapping.getProperty("wildcards"); // Then split it up into the separate wildcard mapping segments // with no assumptions about what the foo/bar names will be. ... -Van -- - Mike "Van" Riper [EMAIL PROTECTED] Thanks for bringing this up as it has been a problem of mine that I haven't revisited since before properties were added to ActionConfig by Joe I believe. Hopefully this should make things more simple and straightforward. Don On 6/17/05, Laurie Harper <[EMAIL PROTECTED]> wrote: I ended up writing an action which let me do this: The action splits the parameter, builds a map from the name=value pairs and sticks it in request scope then resets parameter. Except it doesn't; ActionMapping.setParameter() throws a runtime exception, so I have to painfully construct a duplicate with the updated 'parameter' value (or wrap it in a proxy, which would be a lot better than the 14 lines of mNew.setFoo(mapping.getFoo()) I have now! Ugh. I wish this wasn't so messy :-( L. Don Brown wrote: To add to your original solution: write your own subclass of ActionConfig which overrides getParameter() to return the tiles-needed part of the parameter attribute. Additional methods will let you retrieve other parts. This way, your Action doesn't have to know about parsing; it can pull clean values out of the ActionConfig subclass. Anyways, I know what you mean about this being difficult. The set-property seems like a perfect solution, until you realize it is processed by digester at deploytime, not request-time like the parameter attribute. I think the lack of the ability to pass multiple request-time values to the Action is a serious deficiency in Struts right now. Don On 6/15/05, Laurie Harper <[EMAIL PROTECTED]> wrote: Van wrote: Okay. So maybe this isn't the only wildcard mapping you will have. Still, you could have one SectionAction class for this particular wildcard mapping. That would be a vast improvement over status quo. How many different wildcard mappings do you have in this application? Almost every page will be delivered through a wild-carded action path. We're talking a few tens of patterns with varying amounts of similarity. You could pass one request parameter that indicated which wildcard pattern was involved. If you don't want to have branching logic, you could even make this additional request parameter be a property name and store in your application properties file the regular expression to use against the incoming request URL to pull out the matching wildcard values. That should scale generally to any number of different wildcard mappings using a single Action class that was driven by these regular expressions coming from your application properties file. That's still multiplying the number of places the patterns must be stored and processed, and since Struts already does everything I want except (apparently) a way to pass the results along that seems like a bad idea. Looks like my original approach (overloading 'parameter') will have to do. L. ---
Re: HTML file generated by JSP is truncated...why?...Please help!...source attached
You're running into a limitation of the JVM I think. Java classes can only have a maximum of 64Kb (?) data heap. If you have a very large JSP, the generated Java source will contain enough string data to exceed that. In my last job our application had one JSP that was sufficiently large and complex to run into this. Quite often the JVM would actually crash when Tomcat tried to compile the JSP! If that is indeed the problem, you should be able to solve it sections in separate files and re-assembling them with includes in the original JSP. L. O. Oke wrote: Thank you all. Source code attached and also below. Please note that it appears to be a maximum number of xters problem; I am saying this because when I deleted some blank lines from my JSP source, more HTML code was generated. The problem is that I do not know where this size is set. Nevertheless, the source code are as follows: JSP === <%@ page language="java"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> "> size="20" maxlength="20"> key="fieldLabel.transferred_on"/> http://localhost/moneyTrans/pages/jsp/reports/repsLOV.jsp', 550, 550, document.forms[0].userRole.value);" property="collectn_rep_id" size="10" maxlength="20" disabled="true"> key="fieldLabel.rep_emp"/> key="fieldLabel.from_currency"/> key="fieldLabel.exchange_rate"/> onchange="document.forms[0].exchange_rate.value = getExchangeRates(document.forms[0].from_country.value + document.forms[0].to_country.value);"> disabled="true"> size="12" maxlength="22" disabled="true"> key="fieldLabel.payable_amount"/> size="22" maxlength="22"> size="28" maxlength="40"> size="20" maxlength="20" disabled="true"> size="22" maxlength="22"> http://localhost/moneyTrans/pages/jsp/reports/payOutPointsLOV.jsp', 550, 550 );"/> size="30" maxlength="30"> key="fieldLabel.payout_addr_code"/> size="10" maxlength="10"> size="10" maxlength="10"> key="fieldLabel.payout_rep_branch_id"/> maxlength="2"> http://localhost/moneyTrans/pages/jsp/reports/sendersLOV.jsp', 550, 550 );" property="sender_id" size="28" maxlength="30" disabled="true"> size="20" maxlength="20"> size="20" maxlength="20"> key="fieldLabel.sender_id_type"/> size="12" maxlength="22" disabled="true"> key="fieldLabel.status"/> size="22" maxlength="22"> key="fieldLabel.bene_fname"/> size="20" maxlength="20"> size="20" maxlength="20"> key="fieldLabel.bene_id_type"/> size="20" maxlength="20"> size="20" maxlength="20"> key="fieldLabel.updated_by"/> size="20" maxlength="20"> size="20" maxlength="20"> key="fieldLabel.cancelled_by"/> size="20" maxlength="20"> size="20" maxlength="20"> Save Register Transfer Query Mode Get Transfer Delete Transfer name="enableFields"> type="text/javascript">
Re: long struts-config.xml file
Craig McClanahan wrote: Validation against the DTD requires two things: * Using the DOCTYPE declaration (as shown above) in the outer configuration file * Setting the servlet init parameter "validating" to "true" in /WEB-INF/web.xml for the Struts ActionServlet It doesn't matter whether you use XML entities or not. One note of caution: validation also requires complying with the document order specified by the DTD, which can constrain the way you break the file out into external entities (they have to reassemble in valid document order). I'm not familiar enough with the DTD to know if this'll be a factor for a struts-config.xml, or if Struts / Digester is sensitive to document order (if you turn off validation). L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Serializing object with null pointers (performance?)
I would expect the performance of serializing a null object reference to be trivially different than serializing a primitive value. In fact it may be slightly worse due to the overhead of writeObject(). Unless you're doing a hell of a lot of serialization and profiling has shown that it's causing a performance bottleneck I wouldn't touch what you have. L. Yaakov Chaikin wrote: Hi all, I have the following situation. I have a Vo model that is in essence a domain/business object model. Of course, a particular screen doesn't need the entire model to be loaded with data. So, what I was thinking is 1) Make all class variables objects (as opposed to primitives, most are objects anyway) 2) Make all class variables NULL, unless I need it for a particular screen. This way, I won't have to carry data around the wire that I don't need. The question I have is this. What performance hit, if any, do I get by passing around an object with null pointers in it? How do they get serialized? Is this a good idea in general or am I just imagining that passing around null pointers saves me "THAT MUCH"? Thanks, Yaakov. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Serializing object with null pointers (performance?)
Yaakov Chaikin wrote: As for the question, I'd expect a null object reference to be 24 bit, which should be smaller than most primitives. That's useful info. How do you know this? I just want some way to verify this. "24 bit" didn't sound likely to me, so I checked. Compare the serialized forms of these two trivial examples: public class IntMember implements Serializable { private int myField; } serializes to 'M-,[EMAIL PROTECTED]@^Ntest.IntMember^P?2M->[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]@' public class IntegerMember implements Serializable { private Integer myField; } serialises to 'M-,[EMAIL PROTECTED]@^Rtest.IntegerMember2lM-(&[EMAIL PROTECTED]@[EMAIL PROTECTED]/lang/Integer;xpp' So the serialized form of a null reference depends on the length on the fully qualified class name and is thus (somewhat) unconstrained. The Java Serialization Specification is the place to look for verification if empiracle proof isn't enough. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accessing nested properties
Change property="bar.test" to property="test"; assuming foos_array is an array of Bar then, within the iterate tag body, 'foos' is bound to an instance of Bar on each iteration. L. Fredrik Bostrom wrote: Hi list, How do I access a nested property in an iterated object? I've got two classes like this (heavily simplified and stripped): class Foo { Bar bar = new Bar(); } class Bar { int test = 10; //any value } In my jsp-page, I'm iterating an array of foo-objects and I want to access the test-field in the Bar-class from within the iteration. How do I do that? This is what I'd like to do: //do something But this doesn't work... Any ideas? Regards, Fredrik Boström - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to pass Jstl param implicit Object to html:link
'params' is a JSTL implicit object; I don't think it's required to be bound to a bean in any scope. Also, the 'name' attribute is looking for the name of a bean, not a value. You'll need to bind the request parameter map to a name in some scope first I think, something like: (not tested) L. Jose María wrote: Hi, I think that I do not explained too good. My idea is pass a Map with multiple keys and values, the html:link documentation says that you can pass multiple params to an action with a Map Object in name attribute. I want to pass the object implicit "param" (Map) defined in Jstl, but I obtain the error "Can not find bean in any scope". Well, nothing else, if anyone knows how to do it, please response. Sample: http://url/action/show?date=&type= I want to pass this parameters to other action: ... Thank you in advance¡¡ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to use multiple tiles definitions files for multi channel
Michael Mattox wrote: In the tiles documentation webapp, it's stated: "A mechanism similar to Java properties files is used for definitions files : you can have one definition file per key. The appropriate definition is loaded according to the key." I'd like to use this to have different tiles for web & wap devices. Can someone explain how to do this? I cannot find any information on how this works, I've searched everywhere. I see how it's done for the language based on the Locale, but not for a user defined key in the session. Struts doesn't provide anything specifically for this. There's all sorts of ways you could approach it; one possibility would be to map user agent header strings to local variants and define separate resource bundles for web vs. wap. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: running tomcat on port 80
That would produce a bind exception (address already in use) rather than permission denied. Balasubramaniam, Sezhiyan wrote: Make sure that you don't have any other processes using port 80. This problem may come when other process already uses the same port. -Original Message- From: Tony Smith [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 21, 2005 9:44 AM To: Struts Users Mailing List Subject: running tomcat on port 80 Hi, Can I run Tomcat 5.0 on port 80? After setting 80 as port number in the server.xml and starting tomcat, I got the following error message: SEVERE: Error starting endpoint java.net.BindException:permission denied:80 Thanks, Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.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: How to pass Jstl param implicit Object to html:link
It is, by definition (at least in a JSTL aware environment). L. Zarar Siddiqi wrote: Make sure params is of type java.util.Map. - Original Message - From: "Laurie Harper" <[EMAIL PROTECTED]> To: Sent: Tuesday, June 21, 2005 12:48 PM Subject: Re: How to pass Jstl param implicit Object to html:link 'params' is a JSTL implicit object; I don't think it's required to be bound to a bean in any scope. Also, the 'name' attribute is looking for the name of a bean, not a value. You'll need to bind the request parameter map to a name in some scope first I think, something like: (not tested) L. Jose María wrote: Hi, I think that I do not explained too good. My idea is pass a Map with multiple keys and values, the html:link documentation says that you can pass multiple params to an action with a Map Object in name attribute. I want to pass the object implicit "param" (Map) defined in Jstl, but I obtain the error "Can not find bean in any scope". Well, nothing else, if anyone knows how to do it, please response. Sample: http://url/action/show?date=&type= I want to pass this parameters to other action: ... Thank you in advance¡¡ - 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: [OT] running tomcat on port 80
And on Windows Tomcat may need to run as Administrator (not sure on that). Running Tomcat as root (or Administrator) may not be the best idea, though. The best place to explore this further would be tomcat-users. L. mario nee wrote: in Unix system you must have root permission to open a port under 1024. Mario Neè XMoon founder http://www.xmoon.org Tony Smith wrote: How can I set the permission? It is my box, viturally I can do whatever I want. Thanks, --- Dave Newton <[EMAIL PROTECTED]> wrote: Tony Smith wrote: Hi, Can I run Tomcat 5.0 on port 80? After setting 80 as port number in the server.xml and starting tomcat, I got the following error message: SEVERE: Error starting endpoint java.net.BindException:permission denied:80 Sure, you can run it on any port you want, if you have permissions to that port. Evidence would suggest that you do not. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Discover Yahoo! Find restaurants, movies, travel and more fun for the weekend. Check it out! http://discover.yahoo.com/weekend.html - 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: How to use multiple tiles definitions files for multi channel
Michael Mattox wrote: The text I quoted above was from the tiles documentation, which claims Tiles *is* able to do this. I just can't figure out how. I'm now wondering if this text is incorrect and tiles does not offer this. Hmm, I had a quick look and saw the section you quote; there doesn't seem to be anything else on the page about it though :-( The problem isn't related to resource bundles, the problem is I need separate JSPs for web & wap. I'd like to have a tiles-defs-web.xml associated with a session key "device" value "web" and tiles-defs-wap.xml associated with a session key "device" value "wap". Default would be "web". Is this possible? It seems like an easy thing to do. Sounds like it should be after all, according to the 'Multi-channels' block you quoted. I don't recall seeing an example anywhere so if you figure out how it works, post back to the list, I'd be interested to know too :-) L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation & Anchoring
I'm not sure if you can tell the browser to scroll to an anchor from within the page (rather than in the URL). It would have to be done using Javascript, HTML doesn't provide this. Other than Javascript, I can think of two possibilities: 1) in your JSP, check for errors and, if they exist, render a browser-side redirect as the response where the redirect is to the same URL but with the anchor appended. You'd have to put any data the page needed into session scope (or append it to the redirect URL) to maintain it across the redirect, though. 2) if the input to the validating action is a path to a JSP (as opposed to a Tile name or action), you can add the anchor there. I.e. in struts-config.xml for your action, you'd include input="/path/to/page.jsp#anchor" That way, if validation fails, it'll forward to the 'input' path which includes the anchor you need to target. HTH, L. Dylan Stamat wrote: Thanks Wendy ! The problem I'm running into is that since I'm using a DynaValidationForm, and errors are found, I'm never even reaching my Action... so, the setting of the anchor in the request wouldn't work. I would somehow need to determine if there "were" errors on the JSP page itself (like the struts tag "html:errors" does)... and then apply the necessary logic. Any ideas ? Thanks ! == Dylan On 6/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: From: "Dylan Stamat" <[EMAIL PROTECTED]> When validation finds that there are errors, and returns to the form page with displayed errors... I want to anchor to the lower part of the large form page... so, only the errors and the form shows... not the text above. Anybody have any ideas on how to do this !? I've tried about 100 different hacks, with no luck. The problem is that when the page is rendered (when the links and form's action are determined) you can't _know_ whether or not there will be errors. It hasn't been submitted yet... the user hasn't even seen it. See if this helps: http://wiki.wendysmoak.com/cgi-bin/wiki.pl?JumpToAnchor You'd probably want to test for the presence of errors, and skip setting the request attribute. -- Wendy Smoak - 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: trouble passing multiple parameters using
Are you sure stockingStoreSalesReviewForm.getStoreNumber() is returning valid data? L. Phani wrote: Here is my code in the JSP page: <% java.util.HashMap params = new java.util.HashMap(); params.put("storeNo",param1); params.put("storeName",param2); pageContext.setAttribute("storeInfo", params); %> Click Here In the Action class: String storeNumber = (String)request.getParameter("storeNo"); I am getting null in the storeNumber. What went wrong!! Any help appreciated... Thanks. Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation & Anchoring
Oh, right, no... The browser doesn't see the new URL (and hence the anchor) with a forward. It'd work if you configured struts to redirect to the input view instead of forwarding, but then you have the same caveats about preserving state across the redirect... L. Dylan Stamat wrote: Oh, and Laurie, just so you know, putting an anchor on a mappings input JSP page won't work. That was tried in one of my 1000 attempts :) On 6/22/05, Dylan Stamat <[EMAIL PROTECTED]> wrote: Thanks for your comments everybody I fiinally found the answer :) I'm still using the DynaValidatorForm, and basically just had to do what Laurie recommended in her 2nd point. I just need to check for messages on the JSP page using the messagesPresent logic tag... ie: </tt><tt>setTimeout('self.scrollBy(0,500)', 300); </tt><pre style="margin: 0em;"> Using "document.location" would cause an infinite loop, so I basically needed to scroll down the page using a timeout. *Phew... Struts has so many crazy tags, I learn new ones every day :D Thank to all that helped, and let me know if you have any suggestions/questions. Thanks ! == Dylan On 6/22/05, Laurie Harper <[EMAIL PROTECTED]> wrote: I'm not sure if you can tell the browser to scroll to an anchor from within the page (rather than in the URL). It would have to be done using Javascript, HTML doesn't provide this. Other than Javascript, I can think of two possibilities: 1) in your JSP, check for errors and, if they exist, render a browser-side redirect as the response where the redirect is to the same URL but with the anchor appended. You'd have to put any data the page needed into session scope (or append it to the redirect URL) to maintain it across the redirect, though. 2) if the input to the validating action is a path to a JSP (as opposed to a Tile name or action), you can add the anchor there. I.e. in struts-config.xml for your action, you'd include input="/path/to/page.jsp#anchor" That way, if validation fails, it'll forward to the 'input' path which includes the anchor you need to target. HTH, L. Dylan Stamat wrote: Thanks Wendy ! The problem I'm running into is that since I'm using a DynaValidationForm, and errors are found, I'm never even reaching my Action... so, the setting of the anchor in the request wouldn't work. I would somehow need to determine if there "were" errors on the JSP page itself (like the struts tag "html:errors" does)... and then apply the necessary logic. Any ideas ? Thanks ! == Dylan On 6/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: From: "Dylan Stamat" < [EMAIL PROTECTED]> When validation finds that there are errors, and returns to the form page with displayed errors... I want to anchor to the lower part of the large form page... so, only the errors and the form shows... not the text above. Anybody have any ideas on how to do this !? I've tried about 100 different hacks, with no luck. The problem is that when the page is rendered (when the links and form's action are determined) you can't _know_ whether or not there will be errors. It hasn't been submitted yet... the user hasn't even seen it. See if this helps: http://wiki.wendysmoak.com/cgi-bin/wiki.pl?JumpToAnchor You'd probably want to test for the presence of errors, and skip setting the request attribute. -- Wendy Smoak - 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: How to encode byte array as url parameter
Just to add to your options ;-), here's another suggestion: convert the byte[] to an integer (store it in a BigInteger). BigInteger can give you a string representation in whatever base you want. Base 10 would give you a purely numeric but rather long string; base 16 (hex) would be more compact. But you can go all the way up to base 62 (same principle as hex notation, but using [a-cA-Z0-9]). I think that probably gives you the most compact URL-safe representation, though I'm not sure. Compare URL-encoded Base64 vs. this technique and see which works best for you. L. David Erickson wrote: Thanks the base64 combined with URLEncoder should work great. -David -Original Message- From: Michael Jouravlev [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 22, 2005 1:36 PM To: Struts Users Mailing List Subject: Re: How to encode byte array as url parameter Base64 will not work, because its charset includes + and / ASCII characters. So you might write something like strToHex() (or whatever its name is), for example see Cryptix library, Hex utility class. Or you can just use that class directly. On the other hand, you may use Base64, and then URLEncoder.encode(). Michael. On 6/22/05, David Erickson <[EMAIL PROTECTED]> wrote: Hi I am wondering how I can take a byte[] and use it as a URL parameter? I have tried converting it to a string using varying character sets, but when I call string.getbytes I never get back my original array. Any help would be greatly appreciated. Thanks David - 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: ValidatorActionForm and java script validation....
Yes, that's the point of ValidatorForm / ValidatorActionForm. The validation rules are looked up according to the action mapping 'name' or 'path' attribute, respectively. It shouldn't make any difference if the actions use the same form. L. Lucas Bern wrote: Hi guys does anybody know if the java script validation of validator framework can be used with ValidatorActionForm, I need to perform diferent validations in diferent action that used the same form i would like these validations be performed in the client... Thanks Lucas - 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo Abrí tu cuenta aquí - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ValidatorActionForm and java script validation....
Doh, scatch that; the 'name' attribute in the action mapping is, of course, the form name, so what I said is true of ValidatorActionForm only. Yawn. Bed time! L. Laurie Harper wrote: Yes, that's the point of ValidatorForm / ValidatorActionForm. The validation rules are looked up according to the action mapping 'name' or 'path' attribute, respectively. It shouldn't make any difference if the actions use the same form. L. Lucas Bern wrote: Hi guys does anybody know if the java script validation of validator framework can be used with ValidatorActionForm, I need to perform diferent validations in diferent action that used the same form i would like these validations be performed in the client... Thanks Lucas - 1GB gratis, Antivirus y Antispam Correo Yahoo!, el mejor correo web del mundo Abrí tu cuenta aquí - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error-page behavior
The problem is that by the time the error occurs in your JSP, the response has already been committed. When Tomcat tries to issue the redirect to the error page, it fails. Your only recouse is to increase the size of the response buffer. To be robust, the buffer would need to be at least as large as your heaviest page... Not great, but about all you can do. BTW, using a Struts action for the error page should be fine I think; a 'resource' in a web application is anything addressed by a URL, effectively. Just make sure that your error page processing is robust -- i.e. it needs to catch and handle any exceptions itself. L. Neil Aggarwal wrote: Wendy: I tried setting my error page directive to: java.lang.Throwable /errorPage.jsp I am still getting an IllegalStateException. That seems weird to me. Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Friday, June 24, 2005 6:53 PM To: Struts Users Mailing List Subject: Re: Strange error-page behavior From: "Neil Aggarwal" <[EMAIL PROTECTED]> The reason I need to execute code is for me to send an error report to the site admin. Have you tried using an actual file (.jsp or .html) that does nothing but forward or redirect to the Struts action? Or perhaps... can you just call the whatever-sends-the-email from the JSP? Let me know if you get to work with a path that's not an actual file, I haven't been able to find anything definitive that says you can't, but it never worked for me. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error-page behavior
I don't know of a way of setting the response buffer size globally either, but setting it on a per-page basis is probably a good idea anyway; that way you can set it larger for heavier pages without incurring the overhead of a larger buffer where it's not needed. L. Martin Gainty wrote: Neil- Best that I can surmise is setBufferSize(int size) method in the ServletResponse interface Anyone else? Martin- - Original Message - From: "Neil Aggarwal" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" Sent: Friday, June 24, 2005 9:09 PM Subject: RE: Strange error-page behavior Laurie: Is there an app-wide way to set the buffer size or do I need to put a page buffer directive in each of my JSPs? Thanks, Neil -- Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com FREE! Valuable info on how your business can reduce operating costs by 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Friday, June 24, 2005 7:32 PM To: user@struts.apache.org Subject: Re: Strange error-page behavior The problem is that by the time the error occurs in your JSP, the response has already been committed. When Tomcat tries to issue the redirect to the error page, it fails. Your only recouse is to increase the size of the response buffer. To be robust, the buffer would need to be at least as large as your heaviest page... Not great, but about all you can do. BTW, using a Struts action for the error page should be fine I think; a 'resource' in a web application is anything addressed by a URL, effectively. Just make sure that your error page processing is robust -- i.e. it needs to catch and handle any exceptions itself. L. Neil Aggarwal wrote: > Wendy: > > I tried setting my error page directive to: > > java.lang.Throwable > /errorPage.jsp > > > I am still getting an IllegalStateException. > > That seems weird to me. > > Neil > > > -- > Neil Aggarwal, JAMM Consulting, (214) 986-3533, www.JAMMConsulting.com > FREE! Valuable info on how your business can reduce operating costs by > 17% or more in 6 months or less! http://newsletter.JAMMConsulting.com > > >>-Original Message- >>From: Wendy Smoak [mailto:[EMAIL PROTECTED] >>Sent: Friday, June 24, 2005 6:53 PM >>To: Struts Users Mailing List >>Subject: Re: Strange error-page behavior >> >> >>From: "Neil Aggarwal" <[EMAIL PROTECTED]> >> >>>The reason I need to execute code is for me to send an error report >>>to the site admin. >> >>Have you tried using an actual file (.jsp or .html) that does >>nothing but >>forward or redirect to the Struts action? Or perhaps... can >>you just call >>the whatever-sends-the-email from the JSP? >> >>Let me know if you get to work with a path that's >>not an actual >>file, I haven't been able to find anything definitive that >>says you can't, >>but it never worked for me. >> >>-- >>Wendy Smoak >> >> >> - >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - 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] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: configure DTD version to use for validation of struts-config
nicole.wollgast wrote: the DOCTYPE I am using is: http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";> Your doctype declaration is inconsistent: you specify version 1.0 in the public identifier and 1.1 in the system identifier. You need to fix the public identifier to also reference verson 1.1. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: String as Parameterwith html:link
http://struts.apache.org/userGuide/struts-html.html#link You can use paramId, paramName and paramPropery to supply a single parameter w/out building a map, though that still requires the parameter value to be stored in a bean in some scope. There's no way to supply arbitrary values directly (i.e. not from a bean or map) unfortunately. L. Franz-Josef Herpers wrote: Hi, I have a question concerning the Struts-HTML-Tag . I want to generate a link to an action with one parameter which is a hardcoded String (not a value of a bean property which is present in a scope). And I don't want to use the url-Attribut but the action-Attribut to generate the link to the action. One example link could be: http://mydomain/setLocale.do?lang="de";. What I'm doing now is: create a HashMap with one entry and use the name-Attribut: lang That works fine, but just out of curiosity: Is there really no possibility to just provide a string via an attribute of html:link which then is appended literally to the generated URL as a parameter. And if not is there a special reason for it? Regards Franz -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Strange error-page behavior
Neil Aggarwal wrote: I am using Tiles to construct the site. I set the page buffer on my layout page and the content page to a large value and I still get the IllegalStateException. Does the tiles:insert tag cause a problem? Hmm, maybe Tiles is fluching the response somewhere along the line... not sure. Try setting flush="false" on any Tiles 'insert' or 'get' tags. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem accessing elements of Collection inside logic:iterate (II)
Riemann Robert (Platinion) wrote: Hello everyone, (a second post since my mail editor just made the posting unreadable... sorry!) I need your help with a tricky problem, where I do not see any explanation currently: I try to construct a table with all data items stored in a database using Hibernate. There is a Form bean for the data items themselves and a form bean with a Collection (ArrayList) with the list of all such data items. Here is the relevant JSP code ... name="InterfacesOverviewForm" property="interfacesItems" type="Presentation.form.InterfacesInputForm"> property="mainId" size="2"/> property="interfacesItems"> No Interfaces data items stored yet. No Interfaces data items available. In my OverviewInterfacesAction I do the following: ... // read data from the persistence layer Collection lDTOList = lService.readData(); // the list of form beans ArrayList lFormInterfacesList = new ArrayList(); // convert DTO's to form beans lFormInterfacesList = (ArrayList) convert(lDTOList); // set the form bean collection into the form lForm.setInterfacesItems(lFormInterfacesList); // place the form with the collection into the request pRequest.setAttribute("InterfacesOverviewForm",lForm); // done return (pMapping.findForward(Constants.SUCCESS)); } I would expect that in my JSP, The iterate gets in each iteration one form after the other out of the collection and that I have access to the properties of the collection elements as in line (**) Unfortunately there are two effects that I cannot explain: 1) With the code as above I get an Exception stating, that bean InterfacesOverviewData cannot be found in any scope Maybe convert() is returning null? 2) If I start the JSP with a name="InterfacesOverviewForm" type="Presentation.form.InterfacesOverviewForm"/> I still get a different exception, but this time stating, that there is no getter method for property mainId in form InterfacesOverviewForm, which is correct since that form contains a Collection with elements which all have a property mainId and getter getMainId(). Yes, but your bean:define binds IngerfacesOverviewData to an instance of interfacesOverviewForm, not to the element type. 3) If I try to access the Collection instead of a property in line (**), i.e. I change the line to: property="interfacesItems" size="150"/> Then I see the the ArrayList printed (I provided a toString() method in the InterfacesInputForm (i.e. the form which represents an element of the Collection), thoug obviously the Collection is there and can be accessed. With or without the bean:define? Shouldn't that be name="InterfacesOverviewForm"? 4) A further observation which I cannot explain might indicate that the heart of my error in not caused by the logic:iterate tag itself: both branches of the surrounding logic:present and logic:empty checks, i.e.,logic:present and logic:notPresent and logic:empty and logic:notEmpty are executed (with the code as described until (3)) That sounds a bit odd... I'd suggest adding some debugging code to the JSP to print out everything in the various scopes to make sure everything's as you expect it. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Populating Form objects without Struts?
Take another look at BeanUtils -- that's what Struts uses to auto-populate ActionForms from the request. You should be able to do the same thing in your app pretty easily using, e.g. BeanUtils.populate(form, request.getParameters()) or something similar. L. Greg Pelly wrote: In previous projects where I have used ActionForms, I have always used Struts.I am currently working on a project that, for various reasons, does not use Struts. Is there a way to harvest the advantages of ActionForms without Struts? In particular, I have a form that the user fills out with checkboxes and a "comments" section. There are many of them: the business logic dictates that the form contain 3 "zones." Each zone has between 4 and 10 questions. Each question has a checkbox and a "comment" field. Ideally I would create a bean with a series of Zone objects which contain Question objects which each contain a boolean "checked" and a String "comment"--problem solved. However, I haven't ever done this without Struts, so I don't know of any way to have the values populated in an Object sent with the form submission--the action servlet usually takes care of that. Is there a tool for doing this or any suggested workaround without Struts? Sorry if I'm missing something completely obvious: a quick scan of previous posts and the LazyList and BeanUtils APIs didn't make any lights go on. Thanks, Greg -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Populating Form objects without Struts?
Since Greg isn't using Struts, its health is not at issue ;-) Mark Galbreath wrote: Yes - use .NET or JSF; Struts is dead. ~mark -Original Message- From: Greg Pelly [mailto:[EMAIL PROTECTED] Sent: Monday, June 27, 2005 9:24 PM Is there a way to harvest the advantages of ActionForms without Struts? *** This email and any file transmitted with it may be confidential and is intended solely for the use of the individual or entity to whom it is addressed. If you received this email in error please notify the DBM Service Desk by forwarding this message to [EMAIL PROTECTED] This email has been scanned by networkMaryland Antivirus Service for the presence of computer viruses. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation for select box
Goswami, Raj wrote: I have a Select box which has all the states. The first option is 'Select One.' I need to display an error message if none of the state is selected. I am using DynaActionForm and the xml config file for validation. I put the value of 'Select One' as '-1' and it displayed the error message first time the form is submitted. The subsequent submits of the same screen, doesn't display the select error again, even though it shows the other text errors. How is your validation defined? I haven't this, but my first thought would be to declare it as depends="required" and use an empty string for the 'Select One' option's value. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts modules and prefix matching
Argh, I just wasted an hour trying to figure out how to access the new module I just defined in my Struts application before finally finding a note in the docs [1] that only extension mapping is supported with modules :-( Has anybody ever looked at lifting that restriction? I have everything set up with prefix mapping and I really don't want to switch... I'd rather forego modules if it comes to it. If nobody's looked at making prefix mapping work with modules, does anyone have any idea what would be involved and/or how feasible it is? (based on the 1.2 code base if possible, I'd rather not move to an unreleased build.) L. [1] http://struts.apache.org/userGuide/configuration.html#dd_config_modules (section 5.4.2, right at the end) -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action path matching
Given the following action mappings, I can reach every JSP bar one: The problem mapping is "/pathtest/one/*/two/" (or "/pathtest/one/*/two/**", depending on how you look at it...) Basically, the former is never matched. Requests to ".../two/" and ".../two/whatever..." are both matched by the path with the '**' wildcard expression. I can probably live with this, given that the ".../two" mapping (no trailing '/') works as expected, but it's inconsistent with the behaviour for single-* mappings. Is this intentional? Is there a way around it? L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: quick simple question
ori wrote: currently i map all *.do requests to the action servlet. i have an action at myHost/action.do. i also want myHost/action to map to that same struts action. how can i do this? thanks a lot. You only have two options for URL mapping: prefix or extension. In other words, you can say 'map any URL beginning ... to this servlet', or 'map any URL ending ... to this servlet'. Also, according to the docs, Struts will break if you have more than one URL mapping to the same action servlet. So, possibility one: create two servlet definitions in web.xml, named differently, and map one as usual to '*.do' and the other to '*action'. I'm not sure that'll work, though, and probably isn't as general as you want. Possibility two: you can't do this from within standard Struts and will have to use something like mod_rewrite. Possibility three: use prefix mapping instead, so your URL would be http://.../do/action and you don't have to worry about '.do' on the end of the URL. Bottom line: there's no way to have a general rule which says 'map .../X and .../X.do to the same thing' for arbitrary X. Maybe if you explain why you want to, the list can suggest alternative approaches. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: quick simple question
That gets very messy for static content; you either end up having to serve it all yourself instead of letting Tomcat do so, returning a 302 pointing to a different webapp, or putting Apache in front of Tomcat to 'catch' requests for static content and serve them without calling Tomcat... L. Ed Griebel wrote: What about using a custom RequestProcessor? It would be a huge hack, but you could map *everything* to struts action (map "/*" to struts action) and then check inside the request processor if it's a valid struts action, and if not, forward appropriately. Although the "appropriately" part is a bit of a hand-wave, as you need to forward the request back to the web server. -ed On 6/29/05, Laurie Harper <[EMAIL PROTECTED]> wrote: ori wrote: currently i map all *.do requests to the action servlet. i have an action at myHost/action.do. i also want myHost/action to map to that same struts action. how can i do this? thanks a lot. You only have two options for URL mapping: prefix or extension. In other words, you can say 'map any URL beginning ... to this servlet', or 'map any URL ending ... to this servlet'. Also, according to the docs, Struts will break if you have more than one URL mapping to the same action servlet. So, possibility one: create two servlet definitions in web.xml, named differently, and map one as usual to '*.do' and the other to '*action'. I'm not sure that'll work, though, and probably isn't as general as you want. Possibility two: you can't do this from within standard Struts and will have to use something like mod_rewrite. Possibility three: use prefix mapping instead, so your URL would be http://.../do/action and you don't have to worry about '.do' on the end of the URL. Bottom line: there's no way to have a general rule which says 'map .../X and .../X.do to the same thing' for arbitrary X. Maybe if you explain why you want to, the list can suggest alternative approaches. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error deploying struts webapp to sunone 6.1
What does your taglib directive look like? Where is the TLD file withing the webapp? Richard Reyes wrote: Hi All, I have a working struts webapp ( working in tomcat 5 ), now i need to deploy this app to a sunone web server 6.1. Upon copying the whole webapp folder to the new instance I have encountered this filenot found exception... Any help will be appreciated. Anybody know on a doc that properly deploys webapp to this web server. Error: --- ApplicationDispatcher[] WEB2649: Servlet.service() for servlet jsp threw exception org.apache.jasper.compiler.CompileException: /netcomm/serverpages/login.jsp(1,0) WEB4059: can't find /struts-bean.tld (File not found) at org.apache.jasper.compiler.JspParseEventListener.handleDirective(JspParseEventListener.java:831) at org.apache.jasper.compiler.DelegatingListener.handleDirective(DelegatingListener.java:125) at org.apache.jasper.compiler.Parser$Directive.accept(Parser.java:255) at org.apache.jasper.compiler.Parser.parse(Parser.java:1157) at org.apache.jasper.compiler.Parser.parse(Parser.java:1115) at org.apache.jasper.compiler.Parser.parse(Parser.java:) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:239) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:227) at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.loadJSP(JspServlet.java:764) at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.access$000(JspServlet.java:624) at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:401) at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:363) at javax.servlet.http.HttpServlet.service(HttpServlet.java:908) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:772) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:471) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054) at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:992) at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:551) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412) at javax.servlet.http.HttpServlet.service(HttpServlet.java:787) at javax.servlet.http.HttpServlet.service(HttpServlet.java:908) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:772) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:471) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412) at javax.servlet.http.HttpServlet.service(HttpServlet.java:787) at javax.servlet.http.HttpServlet.service(HttpServlet.java:908) at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161) at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580) -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is there any Jsp template like Smarty template ?
Heh, 'capabile'? I'd agree with that in maven's case... ;-) Simon Chappell wrote: Some of us don't like any of them! http://uab.blogspot.com/2005/06/ides-we-dont-need-no-stinking-ides.html Simon On 6/29/05, Mark Galbreath <[EMAIL PROTECTED]> wrote: Sun's Creator Studio rulez the inexpensive Java IDE world; JetBrain's IDEA rulez the $300+ IDEs. Eclipse isn't worth a shit. But REAL programmers prefer ed or vi. ~mar k -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Serialization and no-arg constructor. Is it needed?
Yaakov Chaikin wrote: Here is the line from the spec: A Serializable class must do the following: . Have access to the no-arg constructor of its first non-serializable superclass What does this mean and why do you need this requirement? But it does It means that if you have an inheritance hierarchy and any class in that hierarchy implements serializable, that class's parent must provide a no-arg constructor. That's necessary so that the serializable class can be instantiated by the deserialization process. seem to say that you do NOT need your class declared with "implements Serializable" to have a no-arg constructor, correct? Correct. Neither does the class need to declare 'implements Serializable' if a parent class already does so. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Checkbox question
Apte, Dhanashree (Noblestar) wrote: ... I would like to have the vaue of the field temporaryId passed back. right now, with what i have, i just get a String array called temporaryId and temporaryId[0] = "temporaryId", temporaryID[1]="temporaryId". I want the actual value of the temporaryId attribute back instead of just "temporaryId". That's because you've explicitly set value="temporaryId". Either remove the value attribute, or use an expression to set it to what you want instead of a static string. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Passing collection Objects from html form to Action class
Huh? All you have to do is render the collection as a set of hidden fields on the form and treat the data the same way as the string value. L. Mark Benussi wrote: Sadly you cannot unless you make the scope of the form session. I find it limiting to say the least! -Original Message- From: Phani [mailto:[EMAIL PROTECTED] Sent: 30 June 2005 16:14 To: Struts Users Mailing List Subject: Passing collection Objects from html form to Action class I have a Collection Object in my JSP which I am able to display using display Tag. I want to render those collection objects when I submit my html form, so that I can retrieve them in my Action class as form property. If it is a string, I can render it as hidden field.. And in the Action class I can just say, String name = myForm.getName(); How can I achieve the same thing for a collection object. Thanks, Phani. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] check role - isUserInRole in jstl
See also the standard Struts logic tags, particularly logic:present: http://struts.apache.org/userGuide/struts-logic.html#present L. Lindholm, Greg wrote: I've used the Jakarta taglibs-request tags to do this. <%@ taglib uri="http://jakarta.apache.org/taglibs/request-1.0"; prefix="req" %> -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Grzegorz Stasica Sent: Thursday, June 30, 2005 12:48 PM To: user@struts.apache.org Subject: check role - isUserInRole in jstl I've a code like that but I get an error that namespace has to be specified. IsUserInRole is a function so probably I invoke it incorectlly. How can I check user's role in jstl? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action path matching [BUG]
Extending the test cases listed below, I believe I've found a bug in the path matching logic. Given the following pair of action mappings: Struts allways matches the latter. That is, it matches with "/pathtest/**/suffix" whether the submitted URL ends with "/suffix" or not. Has anyone seen this? Anyone have a fix or work-around? L. Laurie Harper wrote: Given the following action mappings, I can reach every JSP bar one: The problem mapping is "/pathtest/one/*/two/" (or "/pathtest/one/*/two/**", depending on how you look at it...) Basically, the former is never matched. Requests to ".../two/" and ".../two/whatever..." are both matched by the path with the '**' wildcard expression. I can probably live with this, given that the ".../two" mapping (no trailing '/') works as expected, but it's inconsistent with the behaviour for single-* mappings. Is this intentional? Is there a way around it? L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action path matching [BUG]
Oops, never mind, error between keyboard and chair... Laurie Harper wrote: Extending the test cases listed below, I believe I've found a bug in the path matching logic. Given the following pair of action mappings: Struts allways matches the latter. That is, it matches with "/pathtest/**/suffix" whether the submitted URL ends with "/suffix" or not. Has anyone seen this? Anyone have a fix or work-around? L. Laurie Harper wrote: Given the following action mappings, I can reach every JSP bar one: The problem mapping is "/pathtest/one/*/two/" (or "/pathtest/one/*/two/**", depending on how you look at it...) Basically, the former is never matched. Requests to ".../two/" and ".../two/whatever..." are both matched by the path with the '**' wildcard expression. I can probably live with this, given that the ".../two" mapping (no trailing '/') works as expected, but it's inconsistent with the behaviour for single-* mappings. Is this intentional? Is there a way around it? L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j log
Vijay K Anand wrote: Hi Here goes my log4j property file log4j.rootLogger=ERROR, A2 log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender log4j.appender.A2.Threshold=DEBUG log4j.appender.A2.file=npi_log log4j.appender.A2.append=true log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %c - %m%n here is the code where i want to log static Logger logger = Logger.getLogger(HighLevelAction.class.getClass()); logger.debug("test"); th eproblem is : it is not logging anything Two things: As someone else pointed out, you've set the logging level to ERROR but you're logging using debug, so the log message isn't going to show up. Either change the root logging level to DEBUG, or add lines like the following to your config: log4j.logger.package-name=DEBUG where 'package-name' is the package (or fully qualified class) name for which you want debug logging. Second, where you construct the logger instance, you have ...class.getClass(). You don't want the getClass() call. I.e. your code should read static Logger logger = Logger.getLogger(HighLevelAction.class); L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Marking fields having errors
Or see the errorClassId attributes on the the form tags. L. Rauf Khan wrote: Hi, In ur application resources file, u can add this errors.header=Error List errors.footer= here color = anycolor Regards Khan On 7/5/05, Kalra, Ashwani <[EMAIL PROTECTED]> wrote: Hi, Does struts has any facility to show fields having validation error in red color or mark it in some way? Thanks Ashwani -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: stopOnFirstError
I'm not sure why stopOnError isn't working for you, but why would you *not* want to show as much validation information as possible? I hate forms that tell me I've filled in one field incorrectly, only to complain about another when I fix the reported error... L. EROL TEZCAN wrote: Any suggestion ? EROL TEZCAN <[EMAIL PROTECTED]> wrote:Hi, I want to alert to user, when the first error occured on the ActionForm . To do this I am using stopOnFirstError ppoperty in struts-config.xml like this But all erros are displayed on the JSP page. My ActionForm ' s type is ValidatorForm and I am using sturts 1.1 How can I define this ? Erol __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Help
Frasso, Anthony wrote the following on 7/5/2005 5:34 PM: <% ProjectsBean projectsBean = new ProjectsBean(); projectsBean.populate(); pageContext.setAttribute("pojectsBean", projectsBean); %> Any scope should work. Also make sure the Project object includes the appropriate (JavaBeans compliant) getter methods for the properties you want to displey. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and Generics
I'd say it depends on how Struts processes the form bean declaration. Assuming it's using straight reflection, I don't see why generics wouldn't work. However, Kent, you will need to correct your XML: the error you're seeing is becuase what you have can't be parsed (it's not well formed). Give this a try and see if it works: L. Nitesh Naveen wrote: Generics is a Java 5.0 feature... Don't think the features with 5.0 are introduced to Struts framework yet! Thanks & Regards, Nitesh _ Disclaimer: Information contained and transmitted by this e-mail is confidential, proprietary, and legally privileged data of Cordiant Technologies that is intended for use only by the addressee. If you are not the intended recipient, you are notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited and you are requested to delete this e-mail immediately and notify the originator. Any views expressed by an individual do not necessarily reflect the view of Cordiant Technologies. The recipient should scan this email and any attachments for viruses as Cordiant Technologies is not liable for the presence of viruses in this email. Cordiant Technologies does not accept liability for any errors or omissions as the internet communications cannot be guaranteed to be timely, secure, error or virus-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete. To know more about Cordiant Technologies, please visit http://www.cordiant.com _ -Original Message- From: Kent Boogaart [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 06, 2005 1:11 PM To: user@struts.apache.org Subject: Struts and Generics Hi there, I'm wondering whether it's possible to use generics with struts. Something like: I tried doing this (with my class names of course) and I get this exception on startup: javax.servlet.ServletException: Can't get definitions factory from context. Thanks, Kent - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Which request is used in automatic Validation when the requirements aren't met?
Thai Dang Vu wrote: Perhaps I stated it unclearly. I am using automatic validation, not manual validation (which uses validate method of the form bean). If the requirements aren't met, Struts will lead us to the input page (in my case the /WEB-INF/provider/addprovider.jsp) without going to the execute method of the AddProviderAction class. So my question is: is there any place I can interrupt the request before the addprovider.jsp appears and displays the errors (I use in that page)? You weren't unclear, but Jeff's response was correct. He pointed out that your input can be an action, which can then do whatever you need, instead of a JSP. You just need to change your action mapping so the 'input' attribute names the mapping for your AddProviderAction rather than pointing at a JSP directly. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using struts forms as Value Objects: your opinion?
Vincent wrote: I'm currently designing and developping an enterprise J2EE application based on Struts. In this application there's a layer of Data Access Object which abstract the underlying persistent storage. For populating my struts' *Form I've imagined first a transfert between forms and DAO based on Value Object, associated with helper classes for translating from one type to another. And I realized that struts Form can be in some situations quite good transfert objects, and by doing so we economize development of both helper classes and VO classes. What do you thing about using forms as VO? Do you think it's a dirty solution? Forms are often mirrors of the database's table. Personally I prefer to keep form beans and value objects seperate, for two key reasons: 1) form beans generally should consist of String data to facilitate round-tripping of invalid inputs. I like to constrain them to a clearly defined role of marshaling data 'into' and 'out of' the presentation layer, i.e. across the boundary between presentation and application. 2) value objects should use typed interfaces to ensure marshaling to and from presentation format (string types) is pushed as far up the application stack as possible. This also enables other, potentially type-aware, presentation / client tiers to be built on top of the same value objects (e.g. for a web-services interface). To address Micheal's question (why not just make value objects and business objects the same thing?), I'd point out that it can be valuable to distinguish between business rules and application logic. I find my business objects often have functionality I don't want called directly from the presentatin layer, particularly when using a mediation layer between the two. Essentially, though, it comes down to the complexity of the problem vs. the complexity of the solution. The more complex the application, the more it makes sense to partition responsibilities. For very simple applications it makes sense to collapse layers together. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logic iterate
Why can't you just change your JSP? In other words, why does the markup you would like to use not work for you? It looks fine to me. L. Vijay K Anand wrote: Hi All I have a problem in logic iterate .. I would like to dispaly checkbox in each row of the iteration like instead of Any help brothers?? Here goes the code name="user"/> name="user"/> name="user"/> -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Tiles Question
[EMAIL PROTECTED] wrote: I am using Struts Tiles to layout my site. I have a vboxmenu design which contains 4 menu levels: I am wanting to control when the Authenticated menu and the Admin Menu are displayed. For example, only display the admin menu if the user is in the Admin Role. I know that the taglib tld has a role attribute, but the dtd for tiles-def does not. Has anyone created anything simular with tiles? As far as I'm aware, there's no way to do that at the tiles level. You could either wrap the tags in your JSP with or similar, or make the test in the JSP for the individual tiles, which may be cleaner. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: generate image by servlet for large amount of requests
Using a servlet seems reasonable. Whether or not you code will scale adequately really depends on how generateMap() is implemented. If it can process calls at the rate you anticipate needing you'll be fine. If it can't you'll have to optimize it, introduce caching, use client-side pre-fetching of image data á la Google Maps, whatever. L. Tony Smith wrote:r Any ideas? --- Tony Smith <[EMAIL PROTECTED]> wrote: Let's think about maps.yahoo.com. I do not know how they handle millions of request and generate the map pictures quickly. If I use a servlet, in the post or get method I use: BufferedImage mapImage = myTookKit.generateMap(String address); response.setContentType("image/png"); OutputStream os = response.getOutputStream(); ImageIO.write(buffer, "png", os); os.close(); Is servlet a good choice? If I use servlet, is the code above good enough to handle hundreds of request? Is the choice of BufferedImage a good one? What special technique I need to implement "myTookKit" to make it faster? I am thinking about JNI. Thanks, __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator, sutrts-config and form-property's types
Actually, BeanUtils can convert from String to a variety of Java types; Date just doesn't happen to be one of them by default. However, it's generally recommended to use String properties in action forms exclusively so that invalid user inputs can be re-displayed as entered. For example, if you ask for a data and the user enters 'Barney', date parsing is going to fail wherever it occurs. If the form uses type Date, there's no way you can represent the invalid input 'Barney' in the form, so you can't redisplay it to the user for correction. Hence use of String valued form properties. If you don't care about round-tripping bad inputs this way, you can always register additional converters with BeanUtils to handle the String to X conversions you need. L. Borislav Sabev wrote: Hi all, The problem I'd like to discuss is how Validator works with form properties. IMHO there is a contradiction (or maybe I don't know how to resolve this problem - in this case, please help me) with types of Form properties. The end result is that if I want to use the Validator, all my form properties MUST be java.lang.String, otherwise Struts (in fact BeanUtils and ConvertorUtils) throws org.apache.commons.beanutils.ConversionException. So why should specify the type of form properties if Validator so and so doesn't work with any other type than java.util.String. To clarify the problem here is an example: I have this form: and here is the snippet of my validation.xml file that should check that the dates entered are in some special format: datePattern -MM-dd datePattern -MM-dd The idea behind this is that I want the parameters that are coming with the request, to be "translated" to their expected types once and only once! So if you try this, you will get org.apache.commons.beanutils.ConversionException (thrown from RequestProcessor if I remember correctly). As soon as I set this the validator starts to work correctly. So here I see at least 2 problems: 1. I'm forced again to parse the String properties of the form to proper java.util.Date objects (or whatever other type it has to be) 2. because of 1. , my date format string now is in 2 places instead of one place i.e. I have a support problem So IMHO this is a "framework" inconsistency since. Please tell me if I do something wrong or this is one of "known limitations". Borislav - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using struts forms as Value Objects: your opinion?
Ted Husted wrote: In my own work, I tend to think of an enterprise-grade application as a set of overlapping rings, like the Olympics logo. * http://www.olympic.org/ In the Blue ring... Nice analogy! :-) -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using struts forms as Value Objects: your opinion?
Michael Jouravlev wrote: On 7/7/05, Laurie Harper <[EMAIL PROTECTED]> wrote: Is not it easier to have one nested VO/BO with string properties, than to copy properties back and forth from action form to VO? I use web framework only to expose my real objects to the outer world. If you don't mind your VOs/BOs being untyped then sure, I guess it's easier. Personally I'd rather use strongly typed interfaces as far as possible. 2) value objects should use typed interfaces to ensure marshaling to and from presentation format (string types) is pushed as far up the application stack as possible. This also enables other, potentially type-aware, presentation / client tiers to be built on top of the same value objects (e.g. for a web-services interface). I think I do not agree with this one. Let's take it as a design requirement that application that we build is a webapp. It potentially can have different interfaces. This would mean, that: * input data is stingified because of HTTP * Struts is not the only front end Just because the transport protocol is HTTP doesn't mean you're only dealing with string data though. If I add a web services layer, I'll want ot talk in terms of domain types. If I want to add some other RPC mechanism the same will be true. Therefore, it is much easier to create BO/VO with dual string/typed interface or with string interface only. It would do validation and conversion to native datatype internally instead of doing it in validate() method. I believen that this is more flexible approach. What are you going to do with your validation code, if you are told to move from Struts to WebWork or Tapestry? I don't see the difference between having dual string/typed properites and having the same thing split between two classes, other than making the one class more confusing and error prone to use. Most of my validation is handled by the Validator framework right now which, admitedly, ties things to Struts to some extent (though there's no reason I couldn't pull Validator 'down' a level and use it under some other presentation technology if it didn't provide an equivalent. L. On 7/8/05, Craig McClanahan <[EMAIL PROTECTED]> wrote: Form beans are part of the *view* tier, not the model ... their purpose in life is to represent the server side state of the HTML elements on a form, even if that state is invalid (i.e. not currently passing all the validations). That way, you can reproduce what the user typed so he or she can fix it, rather than presenting them with a completely blank screen. (This is why you generally use string fields in a form bean). This is one way to look at things. Another way is to use VO/BO for input/output directly. When I use existing data, I load it into BO and display it. When I modify it, I update BO using its string properties. If I decide to cancel updates, I siply remove the BO from memory, no database changes needed. If I create a new object, I create a new BO and fill it in. Until I persist it, it hangs in the session. If I decide to cancel, then I remove it, and database would not even know that I was about to insert an object. In a component oriented framework like JSF or Tapestry, you don't need to worry about keeping track of this state information ... the components do it for you. JSF still differentiates "real" object (whatever it might be, a real business object or a VO) from visual component data, which I don't like. From my point of view, it is much easier to have an object with an ID, to view/edit it, or to delete it. Therefore, I do not need viewstate for UI components. I only need to store my object somewhere like in session while I work with it. I want my widgets and my view to be as dumb as possible. All data and state that I need is in real objects, I do not need artificial viewstate to duplicate it. I can understand why JSF or ASP.NET went this route with UI objects and viewstate: to abstract from the model/business layer. They do not want to establish a firm contract with business/persistence layer. They do not want to require a certain BO lifecycle or the datatype limitations. But I as a developer find this inconvenient. Web frameworks designers focus on their framework, while I as an application designer, focus on business data, business process and business state. Take ActiveX. There is a contract, there are interfaces, methods and datatypes defined. Just build an object according to the protocol, and you will be able to have design-time interface, runtime interface, everything. Web frameworks do not want to have strict contracts with data layer probabaly to be more flexible. I would take contract over flexibily anytime. Presuming that this is a flexible contract ;-) Michael. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ -
Re: Using struts forms as Value Objects: your opinion?
Michael Jouravlev wrote: /** * Flag that demo mode is on */ private boolean isDemo; public boolean getIsDemo() { ... } public setIsDemo(boolean isDemo) { ... } ... and my methods *would be commented in javadoc* too, it would be much better than current approach with lots of lines and comments for each getter/setter. Three properties commented in current approved Java style, and you already lost in the code. This sucks. Funny, I used to be *sure* you could do something like that, and just yesterday went looking through the Javadoc tool documentation trying to figure it out. Don't know where I got the idea you could do this from... It would be so nice if there was a 'Properties' section in Javadoc, along with Fields and Methods, that skipped getters / setters unless explicitly documented and just described each property with 'readable' and 'writeable' flags, using standard JavaBeans conventions to identify properties. Of course, there's no reliable place to store the Javadoc since properties may or may not have associated fields... :-( -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using struts forms as Value Objects: your opinion?
Rick Reumann wrote: (By the way I pass in an optional default format in my constructor as shown above, but my converters have a setFormatPattern(..) method that can change the format at any time) Don't you end up with thread safety issues calling setFormatPattern() though? I would want to call setFormat (or setLocale() or something) on a per-request basis to cater to the individual user. Does BeanUtils ensure a new ConvertUtilsBean is instantiated each time? If so, I really like the idea of setting up all my common converters once on startup instead of in each request :-) L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Parameterized messages
Rick Reumann wrote: N G wrote the following on 7/12/2005 4:14 PM: Is it possible to use the resource properties for keys as well as args? For example, Properties: test.val1=hello {0} test.val2=world So, what I am trying to accomplish is to have the above statement output: hello world However, it outputs: hello test.val2 Not sure if you could nest bean:message, I'm guessing no, but I know a way around it using JSTL. (fmt:message acts the same as bean:message it will pull from your ApplicationResources)... If you decide to use JSTL fmt:message just remember to put something like this in your web.xml: javax.servlet.jsp.jstl.fmt.localizationContext ApplicationResources (assumes ApplicationResources is your properties file found in root of classes at least the above works for me.. might be a better way) It's worth bearing in mind that doing this sort of thing can make localization difficult since sentance structure varies from language to language. Whilst that would be easy to work around in this simple example (by changing both test.val1 and test.val2 in the resources), it can be a lot less straighy forward if the text you're inserting (text.val2) isn't just a single word. Particularly in languages where the value of text.val2 would be dependent on the context in which it was used... Parameter substitution is best reserved for simple value insertion rather than building up composite phrases if you want to remain flexible for localization. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterate over list in in list in form bean.
Michael Jouravlev wrote: Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL) is not possible? I don't know about 'possible' but JSP 1.2 includes JSTL 1.1, so why would you want to? L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Iterate over list in in list in form bean.
Michael Jouravlev wrote: On 7/12/05, Laurie Harper <[EMAIL PROTECTED]> wrote: Michael Jouravlev wrote: Does the above mean that "Struts + JSP 1.2 + JSTL 1.0" (no Struts-EL) is not possible? I don't know about 'possible' but JSP 1.2 includes JSTL 1.1, so why would you want to? http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html "Standard-1.1 (JSTL 1.1) requires a JSP container that supports the Java Servlet 2.4 and JavaServer Pages 2.0 specifications. Standard-1.0 (implementation of the JSTL 1.0 specification) requires a JSP container that supports the Java Servlet 2.3 and JavaServer Pages 1.2 specifications." Michael. Oops, I mis-read 1.2 as 2.0! Doh... -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with action forward while using Frames
syed abrar wrote: Hello All, I have a problem.I have two frames with two different jsps.And after selecting the options(checkboxes) in the second frame the control goes to the Action class.After processing the request the control has to be passed to other jsp page(which have declared in struts-config.xml file).But after I return the ActionForward the jsp page is opening in the second frame itself without closing the opened frame. Can any one please help me Short of doing fancy things with Javascript, the way to achieve that would to to specify the first frame as the target (target='...') for the form submission in the second frame. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forward path entry in Struts-config
rajiv verma wrote: Hi, I want to place my JSPs under the WEB-INF directory[login directory]. How ths struts-config entries should look in this case. If I try to add the following forward--entry: But, this by default looks everything under the context[root]. Any solution to this? I know there is forward pattern, I was trying to make use of it, but does not seem to work. Thanks, Rajiv Have you tried with a path of /WEB-INF/login/welcome.jsp and redirect set to false? As Michael points out you wont be able to do this using redirects, but forwards should work OK. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts and multi-level access - please give me your ideas how to restructure..
Not sure what a .def file is, but I think you're on the right track with combining them and using conditional logic within the JSP to control what's displayed based on user role. Look at for a simple way to wrap role-dependent markup in your JSPs: http://struts.apache.org/userGuide/struts-logic.html#present L. Aleksandar Matijaca wrote: Hi there, I have an application that I am working on that requires two different role levels (administrator and user). The administrator, will have some extra links visible to them. I want to use only one struts-config file. I am currently running into a scalability issue -- here is what I mean: The someAdministratorPath.def has a jsp with different kind of a menu structure - for administrators only, and someUserPath.def has a jsp with a subset of different menu structures -- the only real difference between the two .def files is a single jsp. Somehow the above seems awkward and unscalable to me, and I am afraid I will run into a problem later. I know that I can probably put in some and there discriminate between a User and Administrator, but somehow, that seems like a band-aid solution. If you have any idea on how to restructure this thing, please let me know. Thanks, Alex. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select default value overwriting bean value
The html tags don't support what you want directly; if you specify a 'value' attribute it always takes precedence. You can set the default in the form bean (either in your setup action, or using or similar in the JSP page) and not use a value attribute or, if that's not possible, you can use an expression for the value attribute to get the behaviour you want. For example, assuming there is a bean named 'selectedCountry' with the value 'US', you could use something like the following: HTH, L. Ansley, Tom wrote: Hi Ichy, I did think about that but the way my global settings are set the default value for country is found in the jsp page. Maybe I need to rethink this. I was just hoping there might be another workaround. i.e. somehow first check the bean and if nothing then use the default value. Yes, getCountryID() is a method of the ActionForm. Thanks Tom -Original Message- From: ichy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 14, 2005 10:06 AM To: Struts Users Mailing List Subject: Re: html:select default value overwriting bean value Hi, Tom did you try to use ActionForm#reset() to set default value for countryID to US ? getCountryID() you are talking is a method of ActionForm, right? ichy -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Token element wrapped with a div tag
[EMAIL PROTECTED] wrote: Just curious as to why in the JSP the token is wrapped in a div tag? value="383952ea7a0093448e02f3f0d635865b"> I'm using v1.2.7. What does your JSP look like? L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] olipmic rings metaphor - LDAP?
Frank W. Zammetti wrote: Not sure I have an answer for that :) My guess would be because of the first letter in the acronynm: Lightweight. Otherwise, your question seems reasonable to me. Yep, the 'lightweight' is certainly a key factor. LDAP is optimized toward high read volume, low write volume applications so directories can genereally serve queries faster than RDBMSs at the expense of slower updates. In practice, though, LDAP is non-transactional and a poor substitute for a database if you need to do more than provide a repository for user profile information. LDAP directories are typically used for identity management solutions, for centralizing user profile data and for 'white pages' type contact databases. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: another mutliple file uploading question
dumbQuestionsAsker _ wrote: Im new to Struts, and I want to upload multiple files using only one tag. I made some googleling but I did not find anything working, only "that's not possible"-like answers. So my question is simple, is it really impossible to upload multiple files usng only one ? Simple answer is yes; just renders renders an HTML type='file'/> element so you need one tag per input field you want on your form. If what you want is to have multiple files submitted through the same request parameter, though, you should be able to bind N tags to a single form bean property. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help needed - struts internatonalization
Ramesh Mekkara, ASDC Chennai wrote: I have an Application built on EJB-Struts framework. I need to implement internationalization on all jsp pages which we view. How can it be done ? That's a big topic... :-) You might want to be a bit more specific about what you need to know, but as a starting point take a look at the tag in Struts [1] and the format taglib in JSTL [2]. L. [1] http://struts.apache.org/userGuide/struts-bean.html#message [2] http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing param as part of URL path
You can do this using wildcard action mapping paths: http://struts.apache.org/userGuide/building_controller.html#action_mapping_wildcards L. Brian Lalor wrote: I'm working on a product catalog display application that uses the same logic and code, but takes a common parameter for *every request*, specifying the specific catalog to use. The application is a web service of sorts, and has no state stored between requests. I would like to use URLs of this schema and embed the catalog param in the path: http://host/root/CATALOG1/action.do http://host/root/CATALOG2/action.do I prefer this idea to specifying a request parameter (?catalog=1) for every action. I was thinking that I would somehow capture CATALOG1 and CATALOG2 and stick them into the request, but I'm not sure how to go about it. It this functionality that Struts already has, do I need to implement a filter, or should I subclass the main ActionServlet? Thanks in advance, B -- __ / / / __/ Brian Lalor "If you still have gas, you're not lost." / _ \/__ \ [EMAIL PROTECTED] -- Jacques Strappe /_.__// http://bravo5.org/ -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to populate a FormFile?
lk wrote: I want an field to show the name of a file I get from a database. I've tried to populate the field with a FormField object I instantiate with the name of the file. But there is something wrong as I get in the html field something like: value="[EMAIL PROTECTED]"> What does your JSP and CustomFormFile code look like? It looks like you're using ${field} where you need ${field.name} or something like that. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I remember now why I said I usually use my VO in my ActionForm
Rick Reumann wrote: The reason I often end up using my Value Object directly in my ActionForm is because rarely do I ever end up with a nice simple case where the users are submitting simple form fields. Typically I end up with cases where I have to deal with a bunch of nested beans. It gets INCREDIBLY cumbersome to try to duplicate the same exact nested structure with objects in a form bean that need to represent the same exact nested structure of the objects. I'd be curious for those of you that 'only' use straight properties in your ActionForm deal with this? How do you deal with a situation where you have to edit for example a master detail record that contains nested objects? It's so much easier dealing with the VOs for this kind of stuff. I found myself faced with the same question recently, and couldn't figure out a solution. The 'obvious' solution was to use Map-typed properties in my DynaActionForm declaration, but that didn't work :-( If anyone knows how to define dynamic forms that emulate nested properties I'd love to hear about it! L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Question re. StrutsCatalogRedirectToInputPage
I just read the StrutsCatalogRedirectToInputPage wiki entry [1] and have a question: given that failed validation causes the action not to be called, where exactly am I supposed to call Action.saveMessages()? Is this even required? Shouldn't it be handled by the validator already? L. PS, the entry closes with a note referencing the 'next Struts version'; next after what? http://wiki.apache.org/struts/StrutsCatalogRedirectToInputPage -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FormDef [was Re: I remember now why I said I usually use my VO in my ActionForm]
Hubert Rabago wrote: Well, since you asked. The current FormDef dev build supports defining dynamic forms that have nested properties. https://formdef.dev.java.net/servlets/ReadMsg?list=users&msgNo=116 Awsome, I clearly need to check this out :-) I have an article to illustrate how the new feature is used: http://www.rabago.net/struts/formdef/dev/nested.htm Looks good; I have a bunch of code for converting between forms and POJOs. Looks like FormDef can replace most of it. A couple of questions based on the article: 1) Given that FormDef is using DynaBeans / DynaForms under the covers, am I right in assuming that form properties would need to be accessed with expressings like ${EmployeeForm.map['address'].map['city']} outside of Struts tags and similar BeanUtils aware contexts? 2) My usage of Struts and form beans may not be compatible with FormDef's nested property support, based on this paragraph: It is important to note that when using this technique, the form bean should be prepopulated and placed in session scope (the default setting in Struts). This allows Struts to reuse the form definition that was initialized before the form was created, with the employee field containing the correct dyna properties. The problem is, I don't do pre-population of forms: I rely on Struts to instantiate the form bean an put it in scope (which I'm pretty sure is request, not session, scope). I then fill the form in using a JSP tag if necessary (i.e. the first time the form is displayed, I call a tag to populate it). So will the techniques described in the article work with this scheme? FormDef can also support a collection of nested form beans, though I haven't had the time to write up an article for that. Some explanation for it has been provided in the FormDef user list though: https://formdef.dev.java.net/servlets/BrowseList?list=users&by=thread&from=230908 Again based on the article, am I right in thinking that I have to write code to use this feature (i.e. it's not purely form definition based)? At any rate, I'll take a closer look. Thanks, L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: passing param as part of URL path
Brian Lalor wrote: Hey, cool! The two books that I can find (of the 3 I own) only cover up to Struts 1.1. The link Laurie sent contains some more info on the wildcard mappings, but it appears that you've gotta use a custom ActionMapping class[1, 2], with the className property of the /> element. I succumbed to a dangerous instinct (hm, I wonder if I can repurpose something from the existing ActionMapping for my needs?) and it paid off. The setParameter() method is: [A] general purpose configuration parameter that can be used to pass extra information to the Action instance selected by this Action. Struts does not itself use this value in any way. So I should be able to use Yep, that works, though if your action already uses 'parameter' (e.g. if you're extending ForwardAction, DispatchAction, etc.) then overloading the attribute with the wildcard matches gets messy. To work around that, grab a recent nightly build. That will let you do the following: i.e. you can use the substitution patterns in set-property. This gives you a lot more flexibility :-) Credit to Don Brown for making that possible. For more info, see: http://article.gmane.org/gmane.comp.jakarta.struts.user/108298/match=wildcard+action http://article.gmane.org/gmane.comp.jakarta.struts.user/108300/match=wildcard+action http://article.gmane.org/gmane.comp.jakarta.struts.user/108328/match=wildcard+action L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question re. StrutsCatalogRedirectToInputPage
So if I'm understanding correctly, the only thing that needs to change to make this all work nicely is for automatic validatain to save errors with session scope. The code is already there to support redirect-to-input and to clear the errors out of the session again, right? That sounds like it could be a simple change with a big benefit if I'm right :-) L. Michael Jouravlev wrote: I wrote this er... piece originally. You are right, the problen and solution are explained badly. The original point was that "input" property is a sucky one and should not be used at all. One of the reasons was that it could not redirect. But turned out that it actually can redirect, so I added the whole paragraph of how to redirect to "input". But this really does not help because error messages are gone. So, I personally _never_ use evil "input" property. Instead, I call validate() manually from an action class, and manually save errors. If you want to save errors from an action form, you can save reference to session in reset() method, and then use it in validate(). The problem is that reset() is not called for request-scoped forms (I think so, I do not remember now clearly...). So, you stuck. Therefore, the recommendation should be: if you want to redirect on error, * do not use "input" property * do not use automatic validation Call validate() manually from action class and save errors to session manually. Starting from 1.2.6 these errors are removed automatically after they accessed. I will change the wording in this entry, thanks for pointing out. Michael. P.S. "Next" means 1.3 if I am not mistaken. The code is there, in SVN. On 7/15/05, Laurie Harper <[EMAIL PROTECTED]> wrote: I just read the StrutsCatalogRedirectToInputPage wiki entry [1] and have a question: given that failed validation causes the action not to be called, where exactly am I supposed to call Action.saveMessages()? Is this even required? Shouldn't it be handled by the validator already? L. PS, the entry closes with a note referencing the 'next Struts version'; next after what? http://wiki.apache.org/struts/StrutsCatalogRedirectToInputPage -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie / -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY OT ANN] My new project is beta
FYI, I didn't even get as far as the JNLP on my Mac; I got a page telling me I needed version 1.4 of the Java plugin and a link to a .exe... netsql wrote: We still have some JNI issues in Mac. :-( .V Simon Chappell wrote: I tried it on my Mac (OS X 10.3.9) and while it triggered the JNLP download, nothing happened after that. Bummer. :-( Simon On 7/15/05, netsql <[EMAIL PROTECTED]> wrote: roomity.com to check it out. it should help you use mail lists. It's RiA/JDNC (CoR). There should be updates weekly and it should release in days. hope you like. .V - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] documentation versions [was Re: actionservlet init-params]
Wendy Smoak wrote: Keep in mind, however, that the "official" online website actually comes from the current source code, so it will diverge from the documentation for the latest GA release as changes are made. You may find things online that do not apply to your version of Struts, which is why you should install the struts-documentation.war locally and refer to it if you need the exact docs for your version. I've always found this a bit odd (and it's by no means a Struts-only thing!) -- wouldn't it make more sense for the online documentation to correspond to the current release and clearly seperate documentation covering unreleased features? That way, the web site is a current reference (as opposed to a 'future reference') which ought to reduce user confusion ("the docs say XXX but it doesn't work with the release I downloaded...") The trouble is, different projects have different conventions for publishing the documentation corresponding to particular releases. Struts includes a struts-documentation.war; some projects have release-specific sections on the web site; some bundle static HTML in the release download; etc.) So, the right place to look for reference documentation on release X of package Y is... err... well, not obvious for most Y... Sorry, just a pet peeve of mine ;-) L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY] What technology do you use for authentication and authorization?
I posted some thoughts in response to this and Greg's entry to my blog: http://www.holoweb.net/laurie/archives/2005/07/16/86 Unfortunately, I don't seem to be able to post to Greg's comments (it keeps asking me to login again)... Would somebody be so kind as to post the link there for me? L. Craig McClanahan wrote: (It's still Friday here on the Pacific Coast, so I'll sneak in a late question) One of my colleagues at Sun, Greg Murray, is spec lead for the next rev of the Servlet API. He has recently written a blog asking for input on what you'd like to see in the next version: http://weblogs.java.net/blog/gmurray71/archive/2005/07/got_servlets.html My particular question (well, questions :-) for the Struts community: * What technology do you currently use for authentication and authorization in your web applications? * If you use the container managed security faciities of your container, does it completely meet your needs? If not, what else would you like to see? * If you don't use container managed security (i.e. the facilities defined in the servlet and J2EE, err, Java EE specifications), what capabilities would you need to have available before you'd consider using the container facilities? For maximum positive benefit to the world, please cc your responses both here and reply to Greg's blog (at the URL listed above). Of course, you're welcome to comment (on the blog) about any other features you'd like to see the Servlet spec standardize, but tonight I'm particularly interested in this particular aspect. Craig -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question re. StrutsCatalogRedirectToInputPage
Michael Jouravlev wrote: On 7/16/05, Laurie Harper <[EMAIL PROTECTED]> wrote: So if I'm understanding correctly, the only thing that needs to change to make this all work nicely is for automatic validatain to save errors with session scope. The code is already there to support redirect-to-input and to clear the errors out of the session again, right? That sounds like it could be a simple change with a big benefit if I'm right :-) I personally do not need automatic validation, because I switched to dispatch action, and I need to process every call, even if input data is invalid. Even further, I would prefer everything to be manual. Action.execute() would get called, and I would call ActionForm.reset(), ActionForm.populate(), ActionForm.validate() and whatnot. It is much easier for me to see the code. As long as validate is set to false, that's the way it works and that's the way it would continue to work. All I'm saying is that most of the caveats in the StrutsCatalogRedirectToInputPage piece would go away if the validator framework saved errors to session scope. Then you could use redirect to input in place of forward to input whether using automatic validation or not, no? L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY] What technology do you use for authentication and authorization?
Thanks! Craig McClanahan wrote: Forwarded. Craig On 7/16/05, Laurie Harper <[EMAIL PROTECTED]> wrote: I posted some thoughts in response to this and Greg's entry to my blog: http://www.holoweb.net/laurie/archives/2005/07/16/86 Unfortunately, I don't seem to be able to post to Greg's comments (it keeps asking me to login again)... Would somebody be so kind as to post the link there for me? L. Craig McClanahan wrote: (It's still Friday here on the Pacific Coast, so I'll sneak in a late question) One of my colleagues at Sun, Greg Murray, is spec lead for the next rev of the Servlet API. He has recently written a blog asking for input on what you'd like to see in the next version: http://weblogs.java.net/blog/gmurray71/archive/2005/07/got_servlets.html My particular question (well, questions :-) for the Struts community: * What technology do you currently use for authentication and authorization in your web applications? * If you use the container managed security faciities of your container, does it completely meet your needs? If not, what else would you like to see? * If you don't use container managed security (i.e. the facilities defined in the servlet and J2EE, err, Java EE specifications), what capabilities would you need to have available before you'd consider using the container facilities? For maximum positive benefit to the world, please cc your responses both here and reply to Greg's blog (at the URL listed above). Of course, you're welcome to comment (on the blog) about any other features you'd like to see the Servlet spec standardize, but tonight I'm particularly interested in this particular aspect. Craig -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: FormDef [was Re: I remember now why I said I usually use my VO in my ActionForm]
Hubert Rabago wrote: On 7/16/05, Laurie Harper <[EMAIL PROTECTED]> wrote: I then fill the form in using a JSP tag if necessary (i.e. the first time the form is displayed, I call a tag to populate it). So will the techniques described in the article work with this scheme? It probably won't. For one thing, the FormDef set/getFormUtils methods need resources available to the Action object, such as the ActionMapping. Damn, that's pretty much a deal-breaker for me, since I have a requirement to avoid using 'setup' actions in front of my JSPs. I'll take a look at FormDef anyway and see if there's any way round it, but it sounds like I'm SOL on this one!... L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I need help running an example
Stéphane Zuckerman wrote: First of all, you should understand that using JBoss, Tomcat (which implicitly is run under JBoss), or any other application server doesn't change anything. If you embed the right libraries (jar, ear, war, whatever), everything should work fine for your server. Anything else is a problem coming from your web app. Not necessarily. The code snipet below is checking for an authenticated user's authroized roles. If the app is depending on contain managed security, it's dependant on vendor-specific configuration. Simply deploying the war file isn't enough to get it working. This piece of code just means that if the role "Administrator" has been defined for the current user, then it should display the "submit" button. Otherwise, the submit does nothing. Right. So you need to follow the documentation supplied with the application and/or look up the relevant info in the JBoss docs on setting up the required users and roles. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/laurie - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]