Re: [S2] Famoso Double conversion problem in S2 2.0.11.1!
I think this may be caused by this bug : https://issues.apache.org/struts/browse/WW-3018 On Sat, Feb 28, 2009 at 9:25 PM, Milan Milanovic milanmilanov...@yahoo.com wrote: No solutions ? Could maybe this be a problem, in this code: s:iterator ... ... s:url id=refUrl action=setValue s:param name=refValue1 value=refValue / /s:url ... /s:iterator refValue1 is of type Double in my action class, and I have DoubleConverter defined for its conversion, but my refValue is of simple type double, which is read from the list in iterator. When I click to this link, conversion is not invoked, why ? -- Thx, M. Milan Milanovic wrote: When generated in jsp, this link looks like this: \a id=c_5442.00 showerror=true targets=refValues dojotype=struts:BindAnchor href=# Set value But when clicked nothing happes, it doesn't event came to conversion. (Note: I added \ before a because this forum show this code as a link only). -- M. Milan Milanovic wrote: Hi, I have again problem with Double conversion. I have a link in my page for double values: s:iterator ... ... s:url id=refUrl action=setValue s:param name=refValue value=refValue / /s:url s:a id=c_%{refValue} href=%{refUrl} theme=ajax targets=refValuesSet value/s:a ... /s:iterator In the form where refValue is entered I'm using my DoubleConverter conversion, and I checked with Firebug, refValue is set good, e.g., c_4550.0. But when I click to this link above, I get 45500.0. Famoso zero is added!! Then I tried to define conversion properties for a class who have refValue attribute to my custom DoubleConvereter, but in this case click on the link Set value doesn't do anything! It is like a dead link. I checked also with Firebug and it is e.g., c_4550. What is the problem here and how can I solve it ? -- Regards, M. -- View this message in context: http://www.nabble.com/-S2--Famoso-Double-conversion-problem-in-S2-2.0.11.1%21-tp22248310p22266388.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: s:url - escapeAmp Problem
From the documentation : http://struts.apache.org/2.1.2/docs/url.html escapeAmp : Specifies whether to escape ampersand () to (amp or not So I guess in order to have the url showing you need to set escapeAmp to false ... On Wed, Jan 7, 2009 at 10:14 AM, Himanshu Rathore mymailsubscript...@gmail.com wrote: Hi, Can anyone please tell me what I'm doing wrong? s:url id=url action=register_load escapeAmp=true s:param name=userId value=%{userId}/ s:param name=callingPage value='callingPage'/ /s:url URL is still showing me amp; instead of . -- Regards, Himanshu Rathore - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Pls covert this code to struts 2.1
You assign the value 'documentTypes' to the property 'name' of the bean tag. From the documentation : http://struts.apache.org/2.0.14/docs/bean.html name = The class name of the bean to be instantiated (must respect JavaBean specification) So that is the reason for the ClassNotFoundException ... Friendly greetings, Bert VdB On Tue, Jan 6, 2009 at 7:44 AM, taj uddin tajuddi...@yahoo.com wrote: Hi, My application was developed on struts 1.2 and i was struck up with a problem when i try to convert that code into struts 2.1 version. So, pls convert the code given below which was developed using struts 1.2 api into struts 2.1. The code is: bean:define id=documentTypesCollection name=ReferenceDocumentForm property=documentTypes/ html:select name=ReferenceDocumentForm property=referenceDocument.documentType size=1 html:option value=-1Select/html:option html:options collection=documentTypesCollection property=code labelProperty=desc/ /html:select Where- documentTypes is a list in the form named ReferenceDocumentForm. I tried converting the above code using struts 2.1 tags as given below: s:bean id=documentTypesCollection name=documentTypes/ s:select label=%{getText('referenceDoc.type')} name=referenceDocument.documentType required=true list=documentTypes headerValue=select headerKey=-1 size=1 listKey=code listValue=desc/ Where-documentTypes is a list with getters and setters in my action class When i run the application, I'm facing the problen shown below: 11:48:30,120 ERROR [Bean] Could not instantiate bean java.lang.ClassNotFoundException: documentTypes at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:147) at org.apache.struts2.components.Bean.start(Bean.java:121) at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:54) at org.apache.jsp.nfpa.add_005fedit_005freferencedocument_jsp._jspx_meth_s_005fbean_005f0(add_005fedit_005freferencedocument_jsp.java:156) at org.apache.jsp.nfpa.add_005fedit_005freferencedocument_jsp._jspService(add_005fedit_005freferencedocument_jsp.java:112) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292) at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:139) at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at
[ANN] May 20 - Writing JPA Applications by Patrick Linskey at Google in Silicon Valley
This is a free event open to the general public. So, please forward this announcement on to other interested parties. The full meeting announcement including directions to meeting site at Google in Silicon Valley is here: https://sv-web-jug.dev.java.net/servlets/NewsItemView?newsItemID=5601 Advanced Registration is required to be part of give-away drawing. You can register at: http://sv-web-jug-4.eventbrite.com/ Agenda: 18:30-19:00 Arrive mingle -- Food drinks provided by Google 19:00-20:30 Writing JPA Applications Presentation Description: In this talk, Patrick explores the Java Persistence API, and examines some common practices for how to write applications that use JPA. Patrick will focus more on API usage than on mapping configuration, and will look at the bootstrapping and runtime behavior of JPA applications. You will learn about JPA's optimistic locking semantics, including the benefits of optimistic read locks. Patrick looks at when it's appropriate to use the different facilities of the Java Persistence Query Language (JPQL), and also discusses common extensions to the spec, including performance caching, pessimistic locking, and fetch strategies. --- | Michael Van Riper | http://weblogs.java.net/blog/van_riper/ | http://www.linkedin.com/in/vanriper | Silicon Valley Web JUG | mailto:[EMAIL PROTECTED] | https://sv-web-jug.dev.java.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Indexed nested beans
Hi all, I'm trying to get multiple levels of indexed, nested beans working. I've tried a variety of solutions but I keep getting xwork or ognl exceptions. Here's what I've tried (loosely): public class MyAction implements Action, StrutsStatics { private ListPackageBean packages; public ListPackageBean getPackages() { return this.packages; } public ListPackageBean setPackages( ListPackageBean packages ) { this.packages = packages; } } public class PackageBean { private ListElementBean elements; public ListElementBean getElements() { return this.packages; } public ListElementBean setElements( ListElementBean packages ) { this.elements = elements; } } public class ElementBean { private String property1; private String property2; // getters and setters } I refer to the properties in my inputs as packages[0].elements[0].property1. When I POST, I get a NullPointerException in OgnlRuntime.getField (targetClass is null). I tried using built-in arrays (PackageBean[] and ElementBean[]) and I get an OgnlException (source is null in setProperty( null, property1 )). I try initializing these to new PackageBean[0] and new ElementBean[0] and I get IndexOutOfBoundsException. I tried pre-populating my collections (List...) with a few empty beans in both my action and PackageBean but I get the source is null exception again... I also tried the getPackage( int index ) and setPackage( int index, PackageBean pkg ) style getters and setters all the way through (initializing the lists with empty beans as necessary) with no success. Am I way off on my thoughts of how nested beans and indexed properties work? Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
(SOLVED) Indexed nested beans
I was missing the getPackages() method :( - Scott Scott Van Wart wrote: Hi all, I'm trying to get multiple levels of indexed, nested beans working. I've tried a variety of solutions but I keep getting xwork or ognl exceptions. Here's what I've tried (loosely): public class MyAction implements Action, StrutsStatics { private ListPackageBean packages; public ListPackageBean getPackages() { return this.packages; } public ListPackageBean setPackages( ListPackageBean packages ) { this.packages = packages; } } public class PackageBean { private ListElementBean elements; public ListElementBean getElements() { return this.packages; } public ListElementBean setElements( ListElementBean packages ) { this.elements = elements; } } public class ElementBean { private String property1; private String property2; // getters and setters } I refer to the properties in my inputs as packages[0].elements[0].property1. When I POST, I get a NullPointerException in OgnlRuntime.getField (targetClass is null). I tried using built-in arrays (PackageBean[] and ElementBean[]) and I get an OgnlException (source is null in setProperty( null, property1 )). I try initializing these to new PackageBean[0] and new ElementBean[0] and I get IndexOutOfBoundsException. I tried pre-populating my collections (List...) with a few empty beans in both my action and PackageBean but I get the source is null exception again... I also tried the getPackage( int index ) and setPackage( int index, PackageBean pkg ) style getters and setters all the way through (initializing the lists with empty beans as necessary) with no success. Am I way off on my thoughts of how nested beans and indexed properties work? Thanks, Scott - 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]
[ANN-OT] February 19 - Stateful Applications that Scale Like Stateless Ones by Orion Letizi at Googleplex in Silicon Valley
Advanced Registration is required to be part of give-away drawing. You can register at: http://sv-web-jug.eventbrite.com/ This is a free event open to the general public. So, please forward this announcement on to other interested parties. The online meeting announcement is here: https://sv-web-jug.dev.java.net/servlets/NewsItemView?newsItemID=5425 18:30-19:00 Arrive mingle -- Food drinks provided by Google 19:00-20:30 Stateful Applications that Scale Like Stateless Ones talk by Orion Letizi TALK DESCRIPTION Within every innocent web application lies a sleeping monster. There comes a time when every successful web application outgrows its single-machine architecture. Whether for high-availability, scalability, or both, the adult web application must grow to live on more than one application server. That's when the latent beast strikes: the State Monster. The most recent accepted wisdom about solving application state problems in a scaled-out production architecture is to make your web application stateless—i.e., externalize all application state out of the application tier so that any application server can serve any user request. Unfortunately for the owners of such applications, making it stateless is hard to do, corrupts the programming and data model of the application, and pushes the problem out to other pieces of infrastructure that are ill-equipped to handle it. Stateless programming is hard on the application developer, hard on the application infrastructure, and hard on the application. There must be a better way to write business applications. In this talk, we will discuss the current stateless application paradigm, its shortcomings, and a new alternative using Terracotta's open-source availability and scalability technology for the Java Virtual Machine. Please be sure to preregister at http://sv-web-jug.eventbrite.com/ so you will be eligible for our raffle. We will be Using Jim Weaver's JavaFX Spinning Wheel for our raffle. You can learn more about the project at: http://learnjavafx.typepad.com/weblog/2008/01/spinning-wheel.html Currently, the prizes include: * IntelliJ IDEA license from JetBrains * Ajax Security from Addison Wesley * Pro JSF and Ajax: Building Rich Internet Components from Apress * Filthy Rich Clients from Addison Wesley (2 copies) * Professional Hibernate from Wrox Press * Professional Java Development with the Spring Framework from Wrox Press * Professional Ajax 2nd Edition from Wrox Press This meeting was organized by the Silicon Valley Web Developer JUG and is being co-hosted by the Silicon Valley JUG. -- | Michael Van Riper | http://weblogs.java.net/blog/van_riper/ | http://www.linkedin.com/in/vanriper | Silicon Valley Web Developer JUG | mailto:[EMAIL PROTECTED] | https://sv-web-jug.dev.java.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Every action is getting called twice
On 2/11/08, Charbel Abdul-Massih [EMAIL PROTECTED] wrote: What am I doing wrong? Every request to an action goes into the actions' execute method twice... This is going to sound unrelated, but, do you use Firefox browser with Firebug enabled to test your code. I ran into one weird problem myself where I was seeing double executions when Firebug was enabled. That may not be the problem in your case, but, your symptoms are similar to my situation where this was indeed the culprit. If you normally test with Firebug enabled, disable it and try your test again to see whether that changes things at all. Good Luck, Van -- | Mike Van Riper | http://weblogs.java.net/blog/van_riper/ - | Silicon Valley Web Developer JUG | mailto:[EMAIL PROTECTED] | https://sv-web-jug.dev.java.net - | Silicon Valley Google Technology User Group | mailto:[EMAIL PROTECTED] | http://sv-gtug.org - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Upload exception in Struts2
Hi all, I'm using Struts 2 (2.04) and running it on Tomcat 5.5.20 (*Nix machine). When I trace the log, I get this 2007-11-22 10:13:40,158 - ERROR org.apache.struts2.dispatcher.multipart.MultiPartRequest(JakartaMultiPartRequest.java:130) - org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Exception filling buffer with data from underlying input stream: not an EAGAIN status, so perhaps disconnected client? 2007-11-22 10:13:40,231 - ERROR org.apache.struts2.interceptor.FileUploadInterceptor(FileUploadInterceptor.java:227) - Processing of multipart/form-data request failed. Exception filling buffer with data from underlying input stream: not an EAGAIN status, so perhaps disconnected client? How does this appear? Any idea? How to avoid this ? Thanks in advance, Van - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Upload exception in Struts2
Thank for your feedback, But that release is used in my active project and I don't want to upgrade it now. So have you ever get that error? is it be because of struts version? Thanks, Van On Nov 22, 2007 6:07 PM, Alexis Pigeon [EMAIL PROTECTED] wrote: Hi Van, On 22/11/2007, Le Van [EMAIL PROTECTED] wrote: Hi all, I'm using Struts 2 (2.04) and running it on Tomcat 5.5.20 (*Nix machine). When I trace the log, I get this 2.0.4 never qualified as a GA release : http://struts.apache.org/downloads.html#PriorReleases The first GA release of Struts 2 was 2.0.6. Latest GA release is 2.0.11, you should really consider upgrading prior any debugging... cheers, alexis - 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: login and session
Hi, You should use interceptors provided by struts 2 for authenticating the user. The interceptor provide you with easy coding according to AOP. You can take a look at the sample application accompanying with struts2 distribution, that is mailreader. Tuyen Dinh On 10/16/07, Lizzy Borden [EMAIL PROTECTED] wrote: Hello, I am starting to learn struts2 and I need some help. I have done a login form, if the loginAction returns SUCCESS I forward to a index.jsp, if it returns ERROR I forward to login.jsp page again. When the authentication is good I create a Session var called logged-in and I set it to true: Map session = ActionContext.getContext().getSession(); session.put(logged-in,true); There is another action, the logoutAction, that remove the Session var. Then I have done a loginCheck.jsp file I include in the index.jsp in order to avoid unauthorized accesses. The loginCheck,jsp file looks like this: %@ taglib prefix=s uri=/struts-tags % %@ page language=java contentType=text/html import=java.util.*% html head titleCheck validate!/title /head body % try{ response.getWriter ().println(DEBUG:+request.getSession().getAttribute(logged-in)); if (request.getSession().getAttribute(logged-in).equals(true)){ // do nothing! }else{ response.sendRedirect(request.getContextPath()+/auth/login.jsp); } }catch(Exception e){ //e.printStackTrace(); response.getWriter().println(exception!); response.sendRedirect(request.getContextPath()+/auth/login.jsp); } % /body /html So, if the logged-in is setted to true, it's ok. Since the logged-in is removed if I try to access the Session it generates an exception so, if the exception happens I redirect to login.jsp page, but this redirect dosen't work. why? How can I did wrong? Can I also replace this code with the s:if test=#session.logged-in !='true' redirect else do nothing...but it doesn't work too. So the questions are: 1- why my redirection in the catch segment does not work? how can I handle it? 2- writing the jsp code instead of struts tag is correct? Have I to use the s:if .. tags ?? thanks lizzie -- View this message in context: http://www.nabble.com/login-and-session-tf4634204.html#a13233578 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to code getting user principal in struts based project
Hi, I just guess your problem. If you have used struts 2.x, you can easily get credential information via Action POJO. In your case, creating a new Action named LoginAction with 2 properties username, password, then create a new User class. In the LoginAction, get username and password passed in User object, put it into session if authenticated. Here is a piece of code for demo: public class User implements Serializable { private String username; private String password; public User(String username, String password) { this.username = username; this.password = password; } } Public class LoginAction { private String username; private String password; public execute() { User user = new User(getUserame(), getPassword()); } } On 10/16/07, Zhang, Larry (L.) [EMAIL PROTECTED] wrote: In my Struts based J2EE application, I need to get user's login information (user principal), and based on the login id, I will create the user object and then put it into the session. I am wondering where is the best place to put this code in. I read some info and it sounds like I should put this code in CustomRequestProcessor (which extends TilesRequestProcessor)'s processValidate method, please let me know if this is something correct. Thanks. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OGNLException on passing request parameters in redirect-action type
Hi, I am configuring the struts.xml for my simple example like this: package name=dashboard namespace=/ extends=application action name=dashboard class=com.example.web.action.Dashboard interceptor-ref name=authnz/interceptor-ref result name=success/WEB-INF/jsp/dashboard.jsp/result result name=login type=redirect-action param name=actionNamelogin/param param name=namespace/accounts/param param name=nextUrlhttp://www.example.com/dashboard.html /param /result /action /package deploy and run application: http://example.com/dashboard.action, there is an exception throwed, log details is below: Oct 14, 2007 4:23:18 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register INFO: Parsing configuration file [struts-default.xml] Oct 14, 2007 4:23:18 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register INFO: Parsing configuration file [struts-plugin.xml] Oct 14, 2007 4:23:18 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register INFO: Parsing configuration file [struts.xml] Oct 14, 2007 4:23:18 PM org.apache.struts2.config.Settings getLocale WARNING: Settings: Could not parse struts.locale setting, substituting default VM locale Oct 14, 2007 4:23:19 PM com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory clinit INFO: Setting DefaultObjectTypeDeterminer as default ... Oct 14, 2007 4:23:26 PM com.opensymphony.xwork2.util.OgnlUtilinternalSetProperty WARNING: Caught OgnlException while setting property 'nextUrl' on type ' org.apache.struts2.dispatcher.ServletActionRedirectResult'. ognl.NoSuchPropertyException: org.apache.struts2.dispatcher.ServletActionRedirectResult.nextUrl at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java :132) at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty( OgnlValueStack.java:68) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1670) at ognl.ASTProperty.setValueBody(ASTProperty.java:101) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.Ognl.setValue(Ognl.java:476) at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186) at com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty( OgnlUtil.java:360) at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76) at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:49) at org.apache.struts2.impl.StrutsObjectFactory.buildResult( StrutsObjectFactory.java:95) at com.opensymphony.xwork2.DefaultActionInvocation.createResult( DefaultActionInvocation.java:195) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult( DefaultActionInvocation.java:342) at com.opensymphony.xwork2.DefaultActionInvocation.invoke( DefaultActionInvocation.java:253) at org.apache.struts2.impl.StrutsActionProxy.execute( StrutsActionProxy.java:50) at org.apache.struts2.dispatcher.Dispatcher.serviceAction( Dispatcher.java:504) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter( FilterDispatcher.java:419) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:206) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage( PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter( PageFilter.java:55) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:206) at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter( ActionContextCleanUp.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter( ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke( StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke( StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke( ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke( StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service( CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java :844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process( Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java :447) at java.lang.Thread.run(Thread.java:619) Oct 14, 2007 4:23:26 PM
Has anyone developed a web app using struts 2 and agegi security framework?
I am now developing my own management suite using struts 2, and I also intend to use acegi for security, but very few document available for such integration. Has any one successfully integrated the acegi framework into struts 2? Any suggestion is appreciated. Thanks
Re: Struts URLs for perfectionists like Ebay's URLs
Hi, Vinny i also try urlrewrite but cannot get it work with struts 2's action, only work with static html files. would you pls give give me some sample app or guides to have my urls go from this : /myAction.do?p1=v1p2=v2 to /myAction/p1,v1/p2,v2/ best regards, - Original Message - From: Vinny [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, October 02, 2007 10:29 PM Subject: Re: Struts URLs for perfectionists like Ebay's URLs Also, you might want to look at URLRewrite http://tuckey.org/urlrewrite/ That is what I've been using in S1 and S2 to have my urls go from this : /myAction.do?p1=v1p2=v2 to /myAction/p1,v1/p2,v2/ I'm also using the zero config and code behind plugins in struts2 that also work to hide the extention. I use urlfilter in addition to the plugins to customize the look of my url parameters. On 10/1/07, Piero Sartini [EMAIL PROTECTED] wrote: Am Montag 01 Oktober 2007 23:33:01 schrieb Emi Lu: Is there a way to hide .action .do by using filter url-pattern? Have a look at http://code.google.com/p/smarturls-s2/wiki/WalkThrough (last paragraph: Extensionless URLs) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The Street Programmer http://streetprogrammer.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Silicon Valley Code Camp at Foothill College on Oct. 27-28
This is a free event by and for the developer community in Silicon Valley. I've been promoting this event within the local Java developer community. I'll also be leading one technical session at this Code Camp based on my experiences converting to S2 from WebWork2 and the ways we use S2 now in our consumer web site (krillion.com): Details of My Sessions http://tinyurl.com/35e4fo Code Camp is a new type of community event where developers learn from fellow developers. All are welcome to attend and speak.The Code Camp Manifesto consists of six points: (1) by and for the developer community; (2) always free; (3) community developed material; (4) no fluff – only code; (5) community ownership; (6) never occur during working hours. What can you expect at the Silicon Valley Code Camp? Two full days of talking about code with fellow developers. Sessions will range from informal chalk talks to presentations. There will be a mix of presenters, some experienced folks, for some it may be their first opportunity to speak in public. And we are expecting to see people from throughout the Northern California region and beyond. Attendance is free, but space is limited so you need to register in advance. Here is the home page for the event: http://www.siliconvalley-codecamp.com It is not too late to signup to lead your own technical session too. Session submission will remain open until about a week before the event. After that, they will be assigning time slots at meeting spaces to the submitted sessions based on the interest level expressed in each topic. Whether you to choose to present or just to participate, it would be great to meetup with other S1 and S2 developers in the area at this event. If you are interested, you can either respond to this thread or contact me directly off list. If there is enough interest, we can schedule an informal Struts BOF session during the weekend sometime too. Cheers, Van -- Mike Van Riper [EMAIL PROTECTED] http://weblogs.java.net/blog/van_riper/ Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net JUGs International MAP http://tinyurl.com/ynktb2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts - open windows without javascript
On 9/27/07, Slattery, Tim - BLS [EMAIL PROTECTED] wrote: how to open a new browser windows in Struts without to use javascript code in jsp page? Opening a new page is a client-side function. Since Struts is a server-side system, there's no way to do this. You could use the target attribute of the form... tag, which instructs the browser to open a new window for the result of the form. That's as close as you're going to get. Same goes for the link a ... tag. The attribute you add to make your form/link requests open a new browser window/tab is: target=_blank Technically, this will open a new window without javascript. It is just adding an HTML attribute to your form or link tags in your generated HTML response. No javascript required. -Van -- Mike Van Riper [EMAIL PROTECTED] http://weblogs.java.net/blog/van_riper/ Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net JUGs International MAP http://tinyurl.com/ynktb2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts - open windows without javascript
On 9/27/07, Slattery, Tim - BLS [EMAIL PROTECTED] wrote: You could use the target attribute of the form... tag, which instructs the browser to open a new window for the result of the form. That's as close as you're going to get. Same goes for the link a ... tag. The attribute you add to make your form/link requests open a new browser window/tab is: target=_blank Technically, this will open a new window without javascript. It is just adding an HTML attribute to your form or link tags in your generated HTML response. No javascript required. One caveat on the target attribute: it doesn't exist in xhtml 1.1. Wow! I did not know that. Google to the rescue. Found this related information online: snippet JavaScript window object solution: Javascript provides a partial solution to the problem by passing the href attribute to the window object's open method, and returning a value of false. The false return from the event handler prevents the web browser from following the link specified in the href attribute. a href=http://www.TexaStar.com; onclick=window.open(this.href); return false; onkeypress=window.open(this.href); return false;TexaStar/a This previous example provides an onclick event handler for those using a pointing device, and an onkeypress event handler for those using a keyboard. However, when JavaScript isn't enabled, the link is processed as normal, providing a possibly adequate fallback mechanism, but failing to produce the designer's desired result. /snippet So, it does require a small amount of javascript to make it work in an XHTML 1.1 compliant manner. This snippet above comes from the following online source: http://www.texastar.com/tips/2004/target_blank.shtml - Van -- Mike Van Riper [EMAIL PROTECTED] http://weblogs.java.net/blog/van_riper/ Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net JUGs International MAP http://tinyurl.com/ynktb2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts URLs for perfectionists like Ebay's URLs
Here is another approach suggested by Peter Hilton. On 20 Sep 2007, at 06:37, Vo Van Thuong wrote: I've just read your article at http://www.lunatech-research.com/archives/2005/07/29/struts-urls, and i find it very useful for me. I'm glad if it helps you. would you pls give me some idea about Ebay's url. http://antiques.listings.ebay.com/Antiquities-Classical-Amer_W0QQcoactionZcompareQQcoentrypageZsearchQQcopagenumZ1QQfromZR2QQftrtZ1QQftrvZ1QQsabfmtsZ1QQsacatZ37903QQsaobfmtsZinsifQQsocmdZListingItemList I'm wondering why they do that, It looks like they have replaced ? = and in the query string with letters, because search engines sometimes treat URLs with a query string differently. and how they do that? Can i also implement something like that? Sure. You need to do two things. First change the characters in URLs that appear in HTML your application generates. In JSP or JSF you could use a custom tag for that. Second, in the web server use some kind of rewriting such as Apache mod_rewrite or a Servlet filter to translate the characters back again before they are used by your application. Peter - Original Message - From: hezjing [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Friday, September 21, 2007 3:00 PM Subject: Re: Struts URLs for perfectionists like Ebay's URLs I think that is called URL's parameter encryption. You may want to take a look at http://www.avedatech.com/Products/QueryCrypt/index.jsp, I haven't try it by myself though. On 9/20/07, Vo Van Thuong [EMAIL PROTECTED] wrote: Hi Vinny, I'd like users to access to my website by URLs like Ebay's: http://listings.ebay.com/_W0QQcoactionZcompareQQcoentrypageZsearchQQcopagenumZ1QQfromZR2QQftrtZ1QQftrvZ1QQsabfmtsZ1QQsacatZQ2d1QQsaobfmtsZinsifQQsocmdZListingCategoryList In which we can't see which one is get parameters which one is value obviously. I've already read an article at http://www.lunatech-research.com/archives/2005/07/29/struts-urls Which gives guides to remove the request extension (.do), the parameter and value from urls. eg: customer.do?method=editid=42 /customer/edit/42 Thanks for quick response. - Original Message - From: Vinny [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, September 20, 2007 12:54 PM Subject: Re: Struts URLs for perfectionists like Ebay's URLs Can you give an example of what you are trying to do? There a few plugins/tools/filters that can effect urls in struts and webapps in general - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hez - 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: [s2] Struts head tag KILLS ( 10s) page load time
On 9/20/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have the same problem. I'm using ajax and the response time of my pages are over 40s sometimes with the s:head theme=ajax / include. Can someone tells me if this has been fixed in struts 2.1 ? Is there a work around to this problem ? The best workaround that I have found is to Just Say NO to the built in support for Dojo and instead to use Prototype judiciously. All my ajax logic is done that way. I don't use the builtin ajax support in s2 at all. This has worked well for the level of ajax support I need in my own webapp development these days. YMMV. -Van -- Mike Van Riper [EMAIL PROTECTED] http://weblogs.java.net/blog/van_riper/ Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net JUGs International MAP http://tinyurl.com/ynktb2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts URLs for perfectionists like Ebay's URLs
Hi Vinny, I'd like users to access to my website by URLs like Ebay's: http://listings.ebay.com/_W0QQcoactionZcompareQQcoentrypageZsearchQQcopagenumZ1QQfromZR2QQftrtZ1QQftrvZ1QQsabfmtsZ1QQsacatZQ2d1QQsaobfmtsZinsifQQsocmdZListingCategoryList In which we can't see which one is get parameters which one is value obviously. I've already read an article at http://www.lunatech-research.com/archives/2005/07/29/struts-urls Which gives guides to remove the request extension (.do), the parameter and value from urls. eg: customer.do?method=editid=42 /customer/edit/42 Thanks for quick response. - Original Message - From: Vinny [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, September 20, 2007 12:54 PM Subject: Re: Struts URLs for perfectionists like Ebay's URLs Can you give an example of what you are trying to do? There a few plugins/tools/filters that can effect urls in struts and webapps in general - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts URLs for perfectionists like Ebay's URLs
Hi, I'm very interested in Ebay's Urls, would someone pls give me some ideas about Ebay's Urls. why they do that and can i also make my Urls like Ebay's? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 2.0.9 with the dynamic tree
Hi, I also had the same problem, and have found the solution: + create a new folder named ajax under folder template (template has same level as WEB-INF and put the attached file tree.ftl in that folder (template\ajax\tree.ftl) + try this new function, in which parameter nodeId is replaced with message function treeNodeSelected(message) { dojo.io.bind({ url: s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action' /?nodeId=+message.node.widgetId, load: function(type, data, evt) {}, mimeType: text/html }); }; Hope this would help, Thuong template\ajax - Original Message - From: Session A Mwamufiya [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, September 17, 2007 11:08 PM Subject: Re: struts 2.0.9 with the dynamic tree Please, has anyone figured out how to make the tree selection work with struts 2.0.9? The showcase example, the way it stands doesn't work for 2.0.9 (it didn't work for 2.0.6 either, but I found a hack that involved changing the struts-core jar file). I thought it was supposed to be fixed in 2.0.9. Any updates on this? Thanks, Session Hi, I recently upgraded to struts 2.0.9, and now my tree viewer doesn't respond to node selections any more. Here's my jsp script: script function treeNodeSelected(nodeId) { dojo.io.bind({ url: s:url value='/tags/ui/ajax/dynamicTreeSelectAction.action' /?nodeId=+nodeId, load: function(type, data, evt) {}, mimeType: text/html }); }; dojo.event.topic.subscribe(treeSelected, this, treeNodeSelected); /script s:tree theme=ajax rootNode=%{treeRootNode} childCollectionProperty=childrenNodes nodeIdProperty=id nodeTitleProperty=name treeSelectedTopic=treeSelected /s:tree The action that's suppose to execute when a selection is made is dynamicTreeSelectAction; but it never gets called (I use logging in the execute() and setNodeId() methods) Has anyone gotten around this problem? - 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]
iterator with only an int as input value
Hi, i'm wondering if there is anyway to use s:iterator like this: s:iterator value={1..pagesNum} s:property value=top/ /s:iterator should be the same as below, if pagesNum=5: s:iterator value={1,2,3,4,5} s:property value=top/ /s:iterator Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iterator tag with only an int as input value
Hi, i'm wondering if there is anyway to use s:iterator like this: s:iterator value={1..pagesNum} s:property value=top/ /s:iterator should be the same as below, if pagesNum=5: s:iterator value={1,2,3,4,5} s:property value=top/ /s:iterator Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ajax using XMLHttpRequest and Struts
On 9/11/07, aarthy [EMAIL PROTECTED] wrote: I am stuckup in this issue for a week.Please somebody help me on this please. Frank W. Zammetti wrote: Something is wrong in your JSP... looks like that stack trace was cut off, but your beyond the AJAX parts at this point, you need to find the error in your JSP. As Frank said, you have issues with your JSP. If you literally cut/pasted your JSP logic into the email, then I can see at least two separate problems with this snippet that would fail at compile time of the JSP when converting it into a servlet. You have scriptlet logic to start the for-loop and no matching scriptlet logic to close the for loop. Even worse, your for-loop iteration logic is totally whack. I am not saying this will fix it, but, the for-loop will at least be properly closed and reasonably defined when this snippet is changed from this: select name=TVShowSelect %int i = 0; ArrayList ch = (ArrayList) request.getSession().getAttribute(characters); String[] s = new String[ch.size()]; ch.toArray(s); for (Iterator it = s.length; it.hasNext();) { String name = (String)it.next(); % option%=name%/option /select To this: select name=TVShowSelect % ArrayList ch = (ArrayList) request.getSession().getAttribute(characters); String[] s = new String[ch.size()]; ch.toArray(s); for (int i = 0; i s.length; i++) { String name = s[i]; % option%=name%/option % } % /select I don't recommend this kind of scriptlet logic in the JSPs. If you are going to do this though, you could at least try compiling the scriptlet code in a test Java file first or use an IDE like IntelliJ IDEA that will detect obvious compile issues with your scriptlet logic in JSP files. Good Luck, Van -- Mike Van Riper [EMAIL PROTECTED] http://weblogs.java.net/blog/van_riper/ Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net JUGs International MAP http://tinyurl.com/ynktb2 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActiveMQ Problem migrating from WebWork 2.2.2 to Struts 2.0.9
Yup! I had updated build process to exclude the spring plugin, but, I never did a full rebuild that would have nuked it from my distribution. Doh! I'm not past this problem. I'm even see struts tags execute in the JSPs forwarded to from my actions. However, I am now hitting my head on a problem with the interaction of Sitemesh with Struts 2.0.9. The WW2.2 tags which have been converted to S2.0.9 tags which are working fine in the main JSPs being evaluated are failing with an NPE on the first struts tag encountered in my sitemesh decorator JSP file. I'll start a new thread with a more appropriate topic for my current problem. -Van P.S. I already found the Wiki docs about sitemesh integration, but, that was not enough in my case. :-( On 8/3/07, Don Brown [EMAIL PROTECTED] wrote: Struts 2 behaves quite differently based on what plugins are installed. Looks like you are using the Spring plugin, which it sounds like you shouldn't be. Remove the struts2-spring-plugin-VERSION.jar from your WEB-INF/lib. Don On 8/4/07, Van Riper [EMAIL PROTECTED] wrote: I'm running into trouble migrating my existing web application from WebWork 2.2.2 to Struts 2.0.9. We are using JSE6 (AKA JDK 1.6) and Tomcat 5.5.17. I did everything mentioned on the wiki plus a bunch more stuff: http://struts.apache.org/2.x/docs/webwork-2-migration-strategies.html If I ever get this working I promise to provide feedback to update this page based on my experiences migrating to Struts 2.0.9. To set things up, I was fairly quickly able to get to the point that I had a clean build of my webapp after swapping out WebWork and swapping in Struts 2.0.9. Hard as it may be to believe, we were not using Spring IoC. I had that turned off in my webwork.properties like so: ### Configuration for IoC Container ### webwork.objectFactory=spring However, it appears that S2 really wants some IoC container because I kept getting complaints with this commented out. So, I uncommented it in my renamed struts. properties file (added necessary listener in web.xml too) and included the latest Spring Framework jar file (2.0.6). This in turn gave me complaints about missing ActiveMQ classes and including the main jar file for latest ActiveMQ (4.1.1) didn't seem to help. That catches everyone up to my current situation. Here is the full console log output for my latest failed webapp startup: CONSOLE-OUTPUT cmd /c C:\java\apache-tomcat-5.5.17\bin\catalina.bat run Using CATALINA_BASE: C:\Documents and Settings\van\.IntelliJIdea60\system\tomcat_Unnamed_7c1b22c1 Using CATALINA_HOME: C:\java\apache-tomcat-5.5.17 Using CATALINA_TMPDIR: C:\svn\head\dev\projects\krillion\dist\catalina_bases\browser\dev\temp Using JRE_HOME:C:\java\jdk1.6.0 Connected to the target VM, address: '127.0.0.1:1866', transport: 'socket' Aug 3, 2007 4:11:03 PM org.apache.coyote.http11.Http11AprProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8000 Aug 3, 2007 4:11:03 PM org.apache.coyote.ajp.AjpAprProtocol init INFO: Initializing Coyote AJP/1.3 on ajp-8002 Aug 3, 2007 4:11:03 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 640 ms Aug 3, 2007 4:11:03 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Aug 3, 2007 4:11:03 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.17 Aug 3, 2007 4:11:03 PM org.apache.catalina.core.StandardHost start INFO: XML validation disabled 16:11:07,218 INFO [/]: Initializing Spring root WebApplicationContext 16:11:07,218 INFO ContextLoader: Root WebApplicationContext: initialization started 16:11:07,296 INFO XmlWebApplicationContext: Refreshing [EMAIL PROTECTED]: display name [Root WebApplicationContext]; startup date [Fri Aug 03 16:11:07 PDT 2007]; root of context hierarchy 16:11:07,500 INFO XmlBeanDefinitionReader: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] 16:11:07,718 INFO XmlWebApplicationContext: Bean factory for application context [EMAIL PROTECTED]: [EMAIL PROTECTED] 16:11:07,812 INFO DefaultListableBeanFactory: Pre-instantiating singletons in [EMAIL PROTECTED]: defining beans [connectionFactory,messageworkDestination,jmsTemplate,mapMessageFactory,textMessageFactory,actionMessageSender]; root of factory hierarchy 16:11:07,812 INFO DefaultListableBeanFactory: Destroying singletons in [EMAIL PROTECTED]: defining beans [connectionFactory,messageworkDestination,jmsTemplate,mapMessageFactory,textMessageFactory,actionMessageSender]; root of factory hierarchy 16:11:07,828 ERROR ContextLoader: Context initialization failed org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.activemq.ActiveMQConnectionFactory] for bean with name 'connectionFactory' defined in ServletContext resource [/WEB
[S2] Successfully migrated my WW-2.2 app to Struts-2.0.9
I had one last hiccup with the Sitemesh integration on S2. Although I am using the default JSP approach and didn't need the template support for Freemarker or Velocity provided by the Sitemesh plugin for S2, I did need to add the ActionContextCleanUp filter to my web.xml as recommended as part of this documentation for the sitemesh plugin that supports templating: http://struts.apache.org/2.0.9/docs/sitemesh-plugin.html Until I added the ActionContextCleanUp filter, I was getting an NPE for the first S2 tag encountered in my Sitemesh decorator JSP. My final working web.xml filter settings/mappings (not using the struts2-sitemesh-plugin though) are: !-- This filter allows sitemesh decorator's to access struts framework variables -- filter filter-namestruts-cleanup/filter-name filter-classorg.apache.struts2.dispatcher.ActionContextCleanUp/filter-class /filter !-- sitemesh gives us an overall page/panel definition -- filter filter-namesitemesh/filter-name filter-classcom.opensymphony.module.sitemesh.filter.PageFilter/filter-class /filter !-- Struts is attached as the last filter. Note that this must be placed AFTER other related filters (like SiteMesh) because if this succeeds and decides to send the request to struts, the rest of the filter chain is stopped. -- filter filter-namestruts/filter-name filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class /filter filter-mapping filter-namestruts-cleanup/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namesitemesh/filter-name url-pattern/*/url-pattern /filter-mapping filter-mapping filter-namestruts/filter-name url-pattern/*/url-pattern /filter-mapping I'm not sure why, but, I didn't need the extra cleanup filter for the WW-2.2 app. I may still run into some other minor hiccups during a full regression test run, but, things are basically working now. This was done on a SVN branch, but, I should be able to make the same changes in a matter of hours (thanks to IntelliJ) on our main trunk later this week after completing my regression testing on the branch. Phew! -Van Mike Van Riper [EMAIL PROTECTED] Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ActiveMQ Problem migrating from WebWork 2.2.2 to Struts 2.0.9
I'm running into trouble migrating my existing web application from WebWork 2.2.2 to Struts 2.0.9. We are using JSE6 (AKA JDK 1.6) and Tomcat 5.5.17. I did everything mentioned on the wiki plus a bunch more stuff: http://struts.apache.org/2.x/docs/webwork-2-migration-strategies.html If I ever get this working I promise to provide feedback to update this page based on my experiences migrating to Struts 2.0.9. To set things up, I was fairly quickly able to get to the point that I had a clean build of my webapp after swapping out WebWork and swapping in Struts 2.0.9. Hard as it may be to believe, we were not using Spring IoC. I had that turned off in my webwork.properties like so: ### Configuration for IoC Container ### webwork.objectFactory=spring However, it appears that S2 really wants some IoC container because I kept getting complaints with this commented out. So, I uncommented it in my renamed struts. properties file (added necessary listener in web.xml too) and included the latest Spring Framework jar file (2.0.6). This in turn gave me complaints about missing ActiveMQ classes and including the main jar file for latest ActiveMQ (4.1.1) didn't seem to help. That catches everyone up to my current situation. Here is the full console log output for my latest failed webapp startup: CONSOLE-OUTPUT cmd /c C:\java\apache-tomcat-5.5.17\bin\catalina.bat run Using CATALINA_BASE: C:\Documents and Settings\van\.IntelliJIdea60\system\tomcat_Unnamed_7c1b22c1 Using CATALINA_HOME: C:\java\apache-tomcat-5.5.17 Using CATALINA_TMPDIR: C:\svn\head\dev\projects\krillion\dist\catalina_bases\browser\dev\temp Using JRE_HOME:C:\java\jdk1.6.0 Connected to the target VM, address: '127.0.0.1:1866', transport: 'socket' Aug 3, 2007 4:11:03 PM org.apache.coyote.http11.Http11AprProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8000 Aug 3, 2007 4:11:03 PM org.apache.coyote.ajp.AjpAprProtocol init INFO: Initializing Coyote AJP/1.3 on ajp-8002 Aug 3, 2007 4:11:03 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 640 ms Aug 3, 2007 4:11:03 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Aug 3, 2007 4:11:03 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.17 Aug 3, 2007 4:11:03 PM org.apache.catalina.core.StandardHost start INFO: XML validation disabled 16:11:07,218 INFO [/]: Initializing Spring root WebApplicationContext 16:11:07,218 INFO ContextLoader: Root WebApplicationContext: initialization started 16:11:07,296 INFO XmlWebApplicationContext: Refreshing [EMAIL PROTECTED]: display name [Root WebApplicationContext]; startup date [Fri Aug 03 16:11:07 PDT 2007]; root of context hierarchy 16:11:07,500 INFO XmlBeanDefinitionReader: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] 16:11:07,718 INFO XmlWebApplicationContext: Bean factory for application context [EMAIL PROTECTED]: [EMAIL PROTECTED] 16:11:07,812 INFO DefaultListableBeanFactory: Pre-instantiating singletons in [EMAIL PROTECTED]: defining beans [connectionFactory,messageworkDestination,jmsTemplate,mapMessageFactory,textMessageFactory,actionMessageSender]; root of factory hierarchy 16:11:07,812 INFO DefaultListableBeanFactory: Destroying singletons in [EMAIL PROTECTED]: defining beans [connectionFactory,messageworkDestination,jmsTemplate,mapMessageFactory,textMessageFactory,actionMessageSender]; root of factory hierarchy 16:11:07,828 ERROR ContextLoader: Context initialization failed org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.activemq.ActiveMQConnectionFactory] for bean with name 'connectionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.activemq.ActiveMQConnectionFactory Caused by: java.lang.ClassNotFoundException: org.codehaus.activemq.ActiveMQConnectionFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198) at org.springframework.util.ClassUtils.forName(ClassUtils.java:201) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:327) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1075) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:282) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187
Re: s2: Base url in jsp's
On 6/21/07, Max Pimm [EMAIL PROTECTED] wrote: I am used to defining a base element in my pages but can't find the way to define this with struts 2. All suggestions welcome. I don't think you need struts 2 support to do this. I'm using webwork 2.2 currently and starting to monitor this list again in preparation for migrating our webapp codebase to struts 2. We also use Sitemesh for response decoration. So, our Sitemesh decorator sets the base element for our response during the execution of sitemesh response filter. The way we do it in JSP land is: base id=docBase href=%=request.getRequestURL()%/ No webapp framework support required. We give the base element an id because we have some javascript functions that need to access the base document URL dynamically. This makes it easy to do the element lookup by id via Javascript elsewhere. Cheers, Van Mike Van Riper [EMAIL PROTECTED] Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts Multipart
Hi, I got a strange problem... I got this error message When I try to do an upload in my application any idea ? javax.servlet.ServletException: Cannot find multipart class org.apache.struts.upload.CommonsMultipartRequestHandler, exception: org.apache.struts.upload.CommonsMultipartRequestHandler at org.apache.struts.util.RequestUtils.getMultipartHandler(RequestUtils.jav a:573) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:433) Michel Van Asten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Generic Selection Screen
Hi, I need a generic selection screen in my application. By Selection screen I mean 1° Two html select one for selectable items And an other for selected items 2° five buttons copy copy all remove remove all an d confirm. Very basic code... I just want to avoid copy paste the code for all the numerous list... One of the possibility is to use a general purpose property for the list... Just filled before display... But that's not very clean any other idea ??? Michel Van Asten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
expression evaluation
Hi, I have a list of user... I want to display some details and add two input images near each of them with edit and delete action associated... I planned to add a javascript to store the name of the clicked image in an hidden field. The problem I have is that the name I will get back is an expression users[0].uid Is there a standard or clean way to evaluate such expression at server side ? nested:iterate property=users tr td align=left width=15%nested:write property=uid//td td align=left width=25%nested:write property=name//td td align=left width=50%nested:write property=email//td td align=left width=10% nested:image property=uid src=img/iconedit2.gif /nested:image nested:image src=img/icondelete.gif /nested:image /td /tr /nested:iterate Regards, Michel Van Asten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT][ANN] Hands-On Flex Session in Moutain View, CA on Feb 7th
FYI, There are three important updates to share about this meeting: 1. We will be providing dinner (sponsored by Adobe) before this meeting . In addition to the usual water and soft drinks, there will also be pizza. 2. The Silicon Valley JUG (our sister JUG with a more general Java focus) is co-hosting this event. So, you can expect a larger turnout and a greater opportunity to network with your peers prior to the start of the talk between 6:30 and 7:00pm. 3. James Ward will also be leading follow-up truly hands-on Flex For Java Users sessions in the San Francisco Bay Area on Feb. 8 (Adobe San Francisco office) and March 22 (Adobe San Jose office). If you are interested, you will need to register in advance for one of the sessions online here: http://www.eventsadobe.com/jug/ The online meeting announcement has been updated to include all this new information: https://sv-web-jug.dev.java.net/servlets/NewsItemView?newsItemID=4567 [ tinyurl: http://preview.tinyurl.com/399hfr ] Finally, RSVPs are still requested by January 31st to [EMAIL PROTECTED] with the subject February Meeting RSVP. Please include your full name with RSVP email for submission to VeriSign Security in advance of the meeting. RSVPs will be accepted after that date, but, early RSVPs will be greatly appreciated. They help us to plan for the room configuration and refreshments. Thanks! Mike Van Riper [EMAIL PROTECTED] Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net A.K.A. Java Web Developer BayCHI BOF http://www.baychi.org/bof/java/ On 1/21/07, Van [EMAIL PROTECTED] wrote: James Ward (jamesward.org) is a Technical Evangelist for Flex at Adobe and Adobe's JCP representative to JSR 286, 299, and 301. In this session, James Ward will do live demonstrations and write code to show how easy it is to build sexy web apps with Java, Mozilla Tamarin, and Flex. The session will cover the programming model, Java Remoting, Pub/Sub messaging JMS integration, Data Synchronization, Hibernate integration, charting, cinematic experiences, and media integration. The detailed outline for the talk is posted online here: https://sv-web-jug.dev.java.net/servlets/NewsItemView?newsItemID=4567 [ tinyurl: http://preview.tinyurl.com/399hfr ] IMPORTANT: RSVP requested by January 31st to [EMAIL PROTECTED] with the subject February Meeting RSVP. Please include your full name with RSVP email for submission to VeriSign Security in advance of the meeting. RSVPs will be accepted after that date, but, early RSVPs will be greatly appreciated. They help us to plan for the room configuration and refreshments. Thanks! That's All Folks, Van - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT][ANN] Hands-On Flex Session in Moutain View, CA on Feb 7th
I'm guessing there are a fair number of Java web developer from Silicon Valley on this list. So, I thought this was worth sharing here. Although the primary topic is Flex, it is being discussed in the context of integrating this technology with web applications written in Java. The forwarded message below includes a link to the full online announcement with RSVP instructions and directions to the meeting site. This is a JUG meeting that is open to the public and free to attend. FYI, Van Mike Van Riper Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net -- Forwarded message -- From: Van [EMAIL PROTECTED] Date: Jan 20, 2007 8:35 PM Subject: Hands-On Flex Session at VeriSign on Feb 7th at 7pm To: [EMAIL PROTECTED] James Ward (jamesward.org) is a Technical Evangelist for Flex at Adobe and Adobe's JCP representative to JSR 286, 299, and 301. In this session, James Ward will do live demonstrations and write code to show how easy it is to build sexy web apps with Java, Mozilla Tamarin, and Flex. The session will cover the programming model, Java Remoting, Pub/Sub messaging JMS integration, Data Synchronization, Hibernate integration, charting, cinematic experiences, and media integration. The detailed outline for the talk is posted online here: https://sv-web-jug.dev.java.net/servlets/NewsItemView?newsItemID=4567 [ tinyurl: http://preview.tinyurl.com/399hfr ] IMPORTANT: RSVP requested by January 31st to [EMAIL PROTECTED] with the subject February Meeting RSVP. Please include your full name with RSVP email for submission to VeriSign Security in advance of the meeting. RSVPs will be accepted after that date, but, early RSVPs will be greatly appreciated. They help us to plan for the room configuration and refreshments. Thanks! That's All Folks, Van Mike Van Riper [EMAIL PROTECTED] Silicon Valley Web Developer JUG https://sv-web-jug.dev.java.net A.K.A. Java Web Developer BayCHI BOF http://www.baychi.org/bof/java/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to reduce redundant form code in JSPs?
On 1/2/07, Laurie Harper [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: - if you're using Struts 2, you could create a Struts 2 component / tag to handle this Not using S2 yet, but, WW 2.2 that S2 is based on has tag themes for the form tags. You can write your own theme extensions of base form tags to follow your convention for form field layout. I'd be surprised if that capability was lost in the merger. You can look at the xhtml theme as an example. It might even do something close enough to what you want already. I seem to recall that it layed out form fields as table rows with label in one column and field in adjacent column of same table row. -Van -- - Mike Van Riper [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Design
Hi, We have to developp a new application and we want to with a good design. Basically we have a set of functionalities (user management, user data control, user data conversion, ...) the availabilty of those functionalities is controlled via a dynamic menu. Hi planned to define one action for each functionality. But for the menu whats the best solution ? I see two solutions : 1° Adding an extra action for the menu and implement Action chaining if I need to jump back to the menu. 2° All the actions extends a base class wich implement menu management routine and I use global forward. Regards, Michel Van Asten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
iterate through two collections
Hi, I have two ArrayList that I need to iterate through: logic:iterate id=line indexId=indexId name=collection1 bean:write name=line / // write info contained in collection2 // something like this but not working?? bean:write name=collection2[indexed] / /logic collection1 and collection2 will always have the same number of records Any ideas? United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
HTML:FILE
Im trying to create a jsp page that can upload a file. Everything works, but I cannot apply my style to the Browse button: html:file property=theFile size=40 styleClass=browse_button / That displays the regular button I apply the same styleClass to the submit button and that works out fine: html:submit styleClass=submit_button / Any ideas on why it my style wont apply to the Browse button?? United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: render trademark symbol
OK... so I've been playing around with this for the pass day. 1. I don't want to store the trademark symbol as trade; in my lucene index. 2. I could write a method to detect the TM symbol and then encode it to trade; and then use the filter=false in the bean:write tag. But is there a more elegant way about this? -Original Message- From: Van Nguyen Sent: Tuesday, October 10, 2006 11:59 AM To: Struts Users Mailing List Subject: RE: render trademark symbol Ok... setting the filter to false works. Thanks! -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:26 AM To: Struts Users Mailing List Subject: Re: render trademark symbol Sorry, escapeXml is for c:out /, Nuawn is right, filter=false is what you are looking for. On 10/10/06, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: hi, set the filter attribute of bean:write tag to false and try - Original Message - From: Van Nguyen [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, October 10, 2006 6:14 PM Subject: RE: render trademark symbol Is escapeXml an attribute for the bean:write tag? I do not see that in the Struts 1.2.9 API. -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:05 AM To: Struts Users Mailing List Subject: Re: render trademark symbol bean:write may be escaping the amp; so maybe you could try adding escapeXml=false inside the bean:write tag. -ed On 10/10/06, Van Nguyen [EMAIL PROTECTED] wrote: That displays: (r) We need it to display: (tm) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 10:33 AM To: Struts Users Mailing List Subject: Re: render trademark symbol use #174; HTH M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Van Nguyen To: user@struts.apache.org Sent: Tuesday, October 10, 2006 1:13 PM Subject: render trademark symbol Hi, I'm using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.RoseT Convex Jointer It stores it in my bean as such. but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.RoseT Convex Jointer And it is being returned as the same string. Is there anything else that needs to be done to render the Trademark symbol as T? I've read online that HTML needs it to be trade; to render correctly. But I've tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either. the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? -- United Rentals Consider it done.⢠800-UR-RENTS unitedrentals.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.(tm) 800-UR-RENTS unitedrentals.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] United Rentals Consider it done.T 800-UR-RENTS unitedrentals.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail
render trademark symbol
Hi, Im using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.Rose Convex Jointer It stores it in my bean as such but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.Rose Convex Jointer And it is being returned as the same string Is there anything else that needs to be done to render the Trademark symbol as ? Ive read online that HTML needs it to be trade; to render correctly. But Ive tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: render trademark symbol
That displays: ® We need it to display: (tm) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 10:33 AM To: Struts Users Mailing List Subject: Re: render trademark symbol use #174; HTH M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Van Nguyen To: user@struts.apache.org Sent: Tuesday, October 10, 2006 1:13 PM Subject: render trademark symbol Hi, I'm using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.RoseT Convex Jointer It stores it in my bean as such. but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.RoseT Convex Jointer And it is being returned as the same string. Is there anything else that needs to be done to render the Trademark symbol as T? I've read online that HTML needs it to be trade; to render correctly. But I've tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either. the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? -- United Rentals Consider it done.⢠800-UR-RENTS unitedrentals.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: render trademark symbol
Is escapeXml an attribute for the bean:write tag? I do not see that in the Struts 1.2.9 API. -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:05 AM To: Struts Users Mailing List Subject: Re: render trademark symbol bean:write may be escaping the amp; so maybe you could try adding escapeXml=false inside the bean:write tag. -ed On 10/10/06, Van Nguyen [EMAIL PROTECTED] wrote: That displays: (r) We need it to display: (tm) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 10:33 AM To: Struts Users Mailing List Subject: Re: render trademark symbol use #174; HTH M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Van Nguyen To: user@struts.apache.org Sent: Tuesday, October 10, 2006 1:13 PM Subject: render trademark symbol Hi, I'm using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.RoseT Convex Jointer It stores it in my bean as such. but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.RoseT Convex Jointer And it is being returned as the same string. Is there anything else that needs to be done to render the Trademark symbol as T? I've read online that HTML needs it to be trade; to render correctly. But I've tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either. the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? -- United Rentals Consider it done.⢠800-UR-RENTS unitedrentals.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.(tm) 800-UR-RENTS unitedrentals.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] United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: render trademark symbol
Ok... setting the filter to false works. Thanks! -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:26 AM To: Struts Users Mailing List Subject: Re: render trademark symbol Sorry, escapeXml is for c:out /, Nuawn is right, filter=false is what you are looking for. On 10/10/06, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: hi, set the filter attribute of bean:write tag to false and try - Original Message - From: Van Nguyen [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, October 10, 2006 6:14 PM Subject: RE: render trademark symbol Is escapeXml an attribute for the bean:write tag? I do not see that in the Struts 1.2.9 API. -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:05 AM To: Struts Users Mailing List Subject: Re: render trademark symbol bean:write may be escaping the amp; so maybe you could try adding escapeXml=false inside the bean:write tag. -ed On 10/10/06, Van Nguyen [EMAIL PROTECTED] wrote: That displays: (r) We need it to display: (tm) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 10:33 AM To: Struts Users Mailing List Subject: Re: render trademark symbol use #174; HTH M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Van Nguyen To: user@struts.apache.org Sent: Tuesday, October 10, 2006 1:13 PM Subject: render trademark symbol Hi, I'm using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.RoseT Convex Jointer It stores it in my bean as such. but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.RoseT Convex Jointer And it is being returned as the same string. Is there anything else that needs to be done to render the Trademark symbol as T? I've read online that HTML needs it to be trade; to render correctly. But I've tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either. the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? -- United Rentals Consider it done.⢠800-UR-RENTS unitedrentals.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.(tm) 800-UR-RENTS unitedrentals.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] United Rentals Consider it done.T 800-UR-RENTS unitedrentals.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
custom tag and html:rewrite
Hey, I am writing a custom tag and I need to rewrite a link to an image from with the tag-code (by overiding the doStartTag method); I know that in a jsp-page you can do this with html:rewrite .. but how to do this from within java-code ? Any hints would be welcome. Jan -- View this message in context: http://www.nabble.com/custom-tag-and-html%3Arewrite-tf2330999.html#a6484600 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: custom tag and html:rewrite
Martin, I found the solution myself; here is the code: this gives me an url which is valid in the context of my application. Thanks for your response, Jan import org.apache.struts.taglib.TagUtils; ... TagUtils utils = TagUtils.getInstance(); String img = null; try { img = utils.computeURL(pageContext, null, null, /images/timeIcon.gif, null, null, null, null, false); System.out.println(img = + img); } catch (MalformedURLException e) { e.printStackTrace(); } Martin Gainty wrote: Hello Jan- I found this page to be quite helpful when manipulating image attributes http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/index.html#image Here is the javadoc for the doStartTag http://jakarta.apache.org/taglibs/sandbox/doc/image-doc/javadoc/index.html M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Van Stalle [EMAIL PROTECTED] To: user@struts.apache.org Sent: Monday, September 25, 2006 7:28 AM Subject: custom tag and html:rewrite Hey, I am writing a custom tag and I need to rewrite a link to an image from with the tag-code (by overiding the doStartTag method); I know that in a jsp-page you can do this with html:rewrite .. but how to do this from within java-code ? Any hints would be welcome. Jan -- View this message in context: http://www.nabble.com/custom-tag-and-html%3Arewrite-tf2330999.html#a6484600 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/custom-tag-and-html%3Arewrite-tf2330999.html#a6487985 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Oracle AS jsp:setProperty problem, Struts alternative?
Is there a Struts (1.3.5) alternative to the jsp:setProperty tag? jsp:setProperty works fine when it's close to the jsp:useBean tag, but when it's farther down the page, Oracle's JSP translator might put the setProperty translation in a separate method than the bean declaration in the output .java file. Kind of like this (simplified for sanity): public void renderPage() { MyBean bean; bean = pageContext.getAttribute( ... ); doTag(); } private void doTag() { bean.setValue( ... ); } Which obviously doesn't work.. but the translator doesn't know this. :) - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Oracle AS jsp:setProperty problem, Struts alternative?
Chris Pratt wrote: That's basically what the Struts bean: taglib and JSTL c: (core) taglib's are for. Give them a look. (*Chris*) c:set looks like it will work. I figured bean:... would have all I need, but IIRC some tags were deprecated because of some of the jsp:XXX tags. Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Out of topic, Oracle SEQUENCE
In PL/SQL: DECLARE new_user_id NUMBER; BEGIN INSERT INTO users ( user_id, user_name ) VALUES ( user_seq.NEXTVAL, 'userName' ) RETURNING user_id INTO new_user_id; END; So, similarly (though a little bit of a hack), in JDBC (since generatedKeys() or whatever they call it isn't supported, though been promised since Oracle 7-8?): // context: con is a java.sql.Connection CallableStatement stmt = con.prepareCall( {call + INSERT INTO users ( user_id, user_name ) + VALUES ( user_seq.NEXTVAL, ? ) + RETURNING user_id INTO ?} ); stmt.registerOutParameter( 2, java.sql.Types.NUMERIC ); stmt.setString( 1, userName ); stmt.executeUpdate(); long newId = stmt.getLong( 2 ); A few things, - Whitespace can be detrimental to the prepareCall statement. Don't put any spaces in {call. - Specify the column list before VALUES--Oracle won't guarantee column order across databases. - Get yourself a nice persistence layer (Hibernate?) :). HTH, Scott Daniel Chacón Sánchez wrote: Hi I know this the struts mail list, but I have a question and I hope that someone know the answer I'm using an oracle database, I have a sequence to obtain the nextval that will be the key of the row that I will insert, after the insert I need to know which is that value so I can tell the user with which value the row was inserted. Is there a sure fire way to do this, or am I stuck with select max(id) from table and hope nothing else has been inserted in that few milliseconds it takes to go from my insert statement to my select statement? Some code, for better explanation: CREATE SEQUENCE user_seq INCREMENT 1 MINVALUE 0 NOMAXVALUE START WITH 0 NOCACHE NOCYCLE insert into users values (user_seq .nextval, 'userName'); Then I need to know the value with which the row was inserted, how can I do that Thanks! Sorry fot the out of topic question - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: empty fields of an input form get default value after submitting
Laurie Harper wrote: Sandra Reichert wrote: Hi, I have an input form in jsp. After submitting empty fields (user entered nothing in input field) are set by default with specific values depending on their data typ. So an empty Integer field is set to 0, an String field to an so on. But i want to have a null value for empty fields. Or in other words: How can i decide if for example the 0 is entered by user or the default initialization. This is one of the many reasons you should prefer String-valued form bean properties, rather than using int/Integer, etc. That way, you can redisplay incorrect/invalid inputs for the user to edit and correct. What if the user types 'two' into a field that's backed by an Integer-typed property? Resetting it to 0 is clearly not what you want, but resetting it to null isn't great either. If you don't care about redisplaying input values and/or you really can't change your form properties to be String-typed, the best you can do it to re-configure the BeanUtils converters to use null as a default instead of 0. I use Long/Integer for hidden, state fields that the user won't see/can't change. I've been thinking of using them for option... values as well, since the user can't see those either. Idea being that the only way the user can change these values is by editing the HTML source. If they do that, all bets are off :). As long as it doesn't muck up the application. Though I should probably point out the people who are using my web apps are the same people who requested it, and no more. Things would obviously be a little different on a public web site if a user managed to edit someone else's profile by changing something like input type=hidden name=userId value=4 to another number on the system :). - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: name Attribute in html:form tag
Ashish Vijaywargiya wrote: Hi, Anybody of you know the specific reason of Why the name attribute is not provided in the html:form tag???. Thanks in advance. Regards Ashish Vijaywargiya Struts uses the name attribute to repopulate your form on submit. So if you have an action /someAction mapped to a form bean named myForm, it should look like html:form action=/someAction, and thus form name=myForm So in your JavaScript you can refer to document.myForm. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Extending tag libraries
This is a little OT, but it, uh, kind of has to do with Struts :). I'm interested in adding a few attributes to some of the struts tags. They're really only useful in the context of a specific web project I'm working on, so I'd really prefer not to edit the Struts TLD and implementation (for various other reasons too :). Problem is, a lot of these have to do with view/layout, so I wanted to use .tag files. Everything's fine if I extend a single property, say html:text property=blah /: %@ attribute name=property required=true type=java.lang.String % html:text property=${property} / Problem is, there are a lot more attributes, most are optional, and different permutations, etc. Is there a relatively easy way of doing this in .tag files? Do I have to use tag classes and, if so, is it possible to tell the JSP processor to re-compile the stuff I output so it doesn't write html:text property... / verbatim to the client? - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Creating new Session without invalidating the old one
[EMAIL PROTECTED] wrote: Hello! Is it possible to create a new session for an already logged in person (which has an actual session) without invalidating the existing session? It's necessary for me to have the old session before creating an additional one, because I have to get few datas from the old session for the new one. request.getSession(true) gives a new session, but only if the user doesn't have an existing session. OK this is an odd one, but I'll give it a shot. It seems like you want to transfer information from one session to another. So I'll offer up a hypothetical situation. You want a login dialog to pop up when the user's session times out (let's say after 15 minutes). After about 60 minutes the user decides to log back in, and you want session information to persist. Aside from this, I honestly can't see any reason why you'd need to have two sessions open. If you absolutely must, find a medium where you can persist the data (even if it's just serializing the objects to a file). If you didn't want the session to timeout in the first place, then don't set the timeout so low! You can set session timeout on a per-session basis with HttpSession.setMaxInactiveInterval. Combine this with HttpSessionListener and you can set up a mechanism with different timeouts per session, or with the appropriate authorization Action (a la struts) and have a timeout-per-user mechanism. At this point I'm just speculating. You'll need to give a reason _why_ you want to do this, because a lot of people (including myself) seem to be under the impression that you're working at the wrong solution to a problem that might not exist. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpSession facade
Madhav Bhargava wrote: I was going thru the struts source code and was in particular reading the way they have implemented the synchronizer token pattern for preventing multiple submits on transacional pages. I saw that they have synchronized on session ID attribute. Is it possible that multiple session share the same session ID? There is noting in the servlet API that mandates it. All I know is from tinkering around in the source myself. I think the idea behind a session facade is to provide a bridge between your typical session (want a session, get a session), and expected behavior in a clustered or multi-VM environment. In the latter case you might have two physical computers that process two different requests from the same user (with the same ID). The session needs to be serialized and sent between computers so each computer behaves as if they know about the original session equally well. Rather than sending every bit of session information to every machine (or in smaller environments, every process), the session facade handles management of session information in case this session information needs to be shared with another provider. Wow, that was fun. Anyways, while two or more users WON'T share the same session ID, the stuff still needs to be synchronized. One web request might be writing information to the session while another is trying to read it to service a subsequent request from the same user. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] migrate Struts app from jdk 1.4 to jdk1.5
Thibaut wrote: I migrate a Struts app from jdk 1.4 to jdk1.5 I have warnings I would like to solve : 1) the clone() function I have a Type Safety exeption with this kind of code : current.setUserRights((TreeSetInteger) this.userRights.clone()); 2) Cast make a warning : TreeSetJobTemplate mySet = (TreeSetJobTemplate) request.getSession().getAttribute(AcceSessionConstant.JOB_TEMPLATE); Depending on your IDE (I use Eclipse), you might be able to factor out the casts into separate methods, and add the @SuppressWarnings( unchecked ) to the new method. So instead of, public void myFunction() { current.setUserRights( (TreeSetInteger) )this.userRights.clone(); } You'd have a helper function: @SupressWarnings( unchecked ) public TreeSetInteger cloneUserRights( UserRights rights ) { return (TreeSetInteger)rights.clone(); } And use this method accordingly. Keep in mind that you should probably be absolutely certain about the real type of the object when you do this. The whole generic thing is simply syntactic sugar (the runtime still does the casts), and the warnings are there as a reminder. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [1.3] Session ActionMessages won't go away
Niall Pemberton wrote: The functionality to automtaically remove messages cached in the session was missing from Struts 1.3.x and only added recently in the Struts 1.3.5 version: http://issues.apache.org/struts/browse/STR-2883 http://svn.apache.org/viewvc?view=revrevision=412834 Are you using Struts 1.3.5? Also how are you configuring the ComposableRequestProcessor commands? Are you letting it pick up the default chain-config.xml shipped in the jar or do you have a custom (or tiles) one that you're specifying through the web.xml? If you have a custom one, does it include the new RemoveCachedMessages command? I have a custom one. Here's what I did: Added the following to web.xml: init-param param-namechainConfig/param-name param-value/WEB-INF/chain-config.xml/param-value /init-param Copied the chain-config.xml from struts-tiles-1.3.5.jar and stuck it in /WEB-INF/chain-config.xml. I don't see the RemoveCachedMessages command in the config; I'll grab it from the links you mentioned above. Is this the correct way to customize chain-config.xml? - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles JSP question
Adam Gordon wrote: Duh tiles:getAsString ... I was thinking to myself how rude a reply this was... then I noticed the sender was the same. Nicely done :). - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [1.3] Session ActionMessages won't go away
Niall Pemberton wrote: Dam, looks like I missed updating the tiles version of the chain-config.xml - the version in struts-core-1.3.5.jar has that command. Could you file a JIRA issue for this please: https://issues.apache.org/struts/browse/STR Okie, https://issues.apache.org/struts/browse/STR-2935 - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JAVA]How to get datatbase connection from lookup to datatsource name in a standalone java application
Jimmy Emmanual wrote: 1. Bind datasource to a file system context try { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, com.sun.jndi.fscontext.RefFSContextFactory); env.put(Context.PROVIDER_URL, file:/C:/temp/jndi); Problem with that is, if your JNDI clients look up values in your provider by things like java:/comp/env, binding them in the fscontext will fail on Windows :(. java: (ending with a colon) isn't an appropriate filename on Windows. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SELECT ... FOR UPDATE
Konrad Billewicz wrote: I know that my problem hasn't do much with JBoss but I decided to post it here. If you know more suitable place, show me it please. I have a Session EJB deployed on JBoss. I'm using JDBCTemplate (from Spring framework) to connect with Oracle 9i database (defined as datasource in JBoss). I tried to use SELECT ... FOR UPDATE statement but when I'm executing it, the application stops and waits forever. As far as I know it shouldn't. Rows in the database aren't blocked (I can make UPDATE or SELECT ... FOR UPDATE freely). What it can be? How to solve this problem? Sender: [EMAIL PROTECTED] Wow, how did this get here?... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JAVA]How to get datatbase connection from lookup to datatsource name in a standalone java application
temp temp wrote: My java standalone application wants connection to database with lookup to datasource name which is configured in the oc4j app server. Please guide me with some ideas to achieve this. You need to bind it yourself, to some provider. I use the DBCP provided with Tomcat (naming-factory-dbcp.jar); the context factory is org.apache.naming.java.javaURLContextFactory (that's not a typo, the class name begins with a lowercase letter). Then you create your InitialContext, create sub contexts for each component and bind your object to the last context. DBCP is an in-memory one that seems to beat the beta fscontext reference that Sun released. Oracle has a class 'com.oracle.naming.J2EEContext'. I suspect that's what OC4J uses. It also seems to have com.evermind.server.rmi.RMIInitialContextFactory. See if you can find javadocs for those. If you're grabbing a DataSource remotely from a running OC4J instance, I did a quick google search and found http://www.oracle.com/technology/products/ias/toplink/doc/1013/MAIN/_html/cachsyn007.htm .. it's for TopLink, but it uses JNDI and follows the same conventions that your standalone OC4J (or app server) is going to use--JMS or RMI (corba). HTH, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JAVA]How to get datatbase connection from lookup to datatsource name in a standalone java application
Caroline Jen wrote: Context ctx = new InitialContect(); DataSource ds = (DataSource)ctx.lookup(java:com/env/jdbc/DBName); Connection con = ds.getConnection(); Right, but that's assuming it's already bound, which is the hard part, and unless he's running it under OC4J, no such luck... - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[1.3] Session ActionMessages won't go away
Hi, I have something very close to the following in each of my pages (actually, just in the layout page for tiles, but whatever). Worked fine in Struts 1.2.9 (even though I'm not so sure it's the best way to print messages and errors, but oh well...) logic:messagesPresent message=true bean:message key=header.notice / ul html:messages id=message message=true libean:write name=message //li /html:messages /ul /logic:messagesPresent logic:messagesPresent message=false bean:message key=header.error / ul html:messages id=error message=false libean:write name=error //li /html:messages /ul /logic:messagesPresent I store my messages in the session so they'll persist even after a redirect. Unfortunately, in 1.3, when I call saveMessages( request.getSession(), messages ), the message appears properly, but continues to appear on subsequent page requests. Any ideas? - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] request.getServletPath() val not same in Filter Servlet
pantichd wrote: Hello, Sorry for posting this in Struts mailing list but I can't seem to get an answer on any other discussion groups. I've always had great results getting good answers here so here goes... I have a Filter in my app that uses the request.getServletPath() method to get the name of the page being invoked without the context path. This worked fine until I try to invoke a servlet. For example, if I invoke a url like http://localhost/app1/servlet/package.ServletName the result of calling request.getServletPath() is '/servlet'. However, if I make the same call when I'm in the servlet the result is '/servlet/package.ServletName' Why does it give a different result in the filter and the servlet? Thanks! AHH! http://tomcat.apache.org/faq/misc.html#invoker Use a different prefix or path for your servlets than servlet, no matter how tempting it is. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about Lookup dispatch action
mosho wrote: Yes, that's exactly the way it works. My navigation with lookupDispatchAction works perfectly. The problem arises when I have another to link instead of button to submit the form, how do I pass navigation parameter value then? The javascript with hidden field doesn't solve the problem. Is the hidden field within the html:form... (here) /html:form tags? - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about Lookup dispatch action
mosho wrote: Hi Scott, I added a unspecified() method in my action class and it works now. I am not able to understand though how it is working, unspecified() is called when parameter name doesn;t exist, right? I have a parameter name= navigation and its value is shown as {submitText}. But it calls unspecified method, for that value as it would have done if value is null. I am assuming it is calling unspecified() because it is not able to find the key name {submitText} I hope I read your reply correctly. You should NEVER EVER see {submitText} when you're stepping through Java, or in the log window, or in an exception stack trace!!! The ONLY place it should appear is in your JSP. In ALL OTHER PLACES, you should see the text that you put in your MessageResources.properties. If you're seeing {submitText} verbatim, then your JSP compiler is ignoring EL, or it's not written correctly. For this line in your JSP, hiddenField.value = ${submitText}; Go ahead and request your page in your browser, then go to view source. Scroll down to where this line should appear in the HTML, and make sure it says something like, hiddenField.value = Next; instead. Now there might be a workaround... I gave you the EL method because I find it much cleaner than embedding XML-like tags in JavaScript, but the following may also work in your JSP: hiddenField.value = 'bean:message key=button.next /'; This might work... I don't LIKE it, because it's an XML (tag library, whatever) tag inside JavaScript inside HTML in a JSP... but oh well. Note the quotes -- the outermost are single quotes, the innermost are double quotes. Double check them even if you copied/pasted them just to get into the habit. If you were using {submitText} in your post as a placeholder for the actual text that should appear to the browser, my apologies, though I hope you understand what I was getting at :). If this WAS the case, since you're not using EL, feel free to remove the lines I gave you in an earlier post, c:set var=submitText bean:message key=button.submit / /c:set As you don't need them. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Creating a DynaBean from an ActionForm on the fly
Is it possible to get a DynaBean object from an ActionForm programmatically? I need to create a copy of a form, but cloneBean isn't working. I have a map-based nested bean (which lets me do stuff like 'myform.child(ABC).name), but cloneBean does a SHALLOW (argh!) copy of the map so the original and the clone have the same map values. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: about overriding the excute method
Gomathi wrote: hai, what will happen when the execute () of action class is overrided by the subclass called dispatch action?. Regards gomes If you mean extending DispatchAction, your execute() method will get called. Unless you have a call to super.execute() (which then calls DispatchAction.execute()), your class will pretty much behave like a regular Action class, which kind of defeats the purpose of extending DispatchAction in the first place. If you need to do special processing before any of your methods are invoked, an idea is to override execute(), do some processing and ensure you call super.execute() somewhere appropriate. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: When my JSP calls the action class SErvlet Exception is thrown.
sheetal wrote: _Does anybody has any idea why is it so...(Why is the servlet exceotion thrown) Couple of things to check: - In struts-config.xml, make sure your package names and class names of your form-bean ... and action... tags are all spelled correctly, including case. - Do the same for your ActionForm and Action classes, and make sure they're in the packages you expect them to be in. - As a last resort, try cleaning the deployment context (undeploying), then clean-build your project and redeploy. In short, it's probably a typo. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form Validation
Chetan Pandey wrote: Is their a way to specify multiple inputs. Nope. A wise man once told me that validate=true is there only for convenience. So the workaround is to do something like 'validate=false', omit the input= tag, and add forwards like, action... forward name=add path=page.add / forward name=edit path=page.edit / /action public void create( ActionMapping mapping, ... ) { ActionErrors errors = form.validate( mapping, request ); if ( errors == null ) { errors = new ActionErrors(); } else if ( !errors.isEmpty() ) { saveErrors( errors ); return mapping.findForward( add ); } // Do some stuff // ... and success! myForm.setId( someObject.getId() ); return mapping.findForward( edit ); } So if it passes validation and everything checks out okay, it goes to the edit page to the newly added record. Otherwise it goes back to add. You can do the same thing for delete (ie: if you were editing a record, but suddenly lose the state of the record you're editing because the user is mucking about). This gives you more power over when and how to do validation, and what to do on pass/fail (sometimes you might have to repopulate a few of the ActionForm's values--which is something else you can't do with the validate=true shortcut). - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TagExtraInfo ,getVariableInfo
Raghuveer wrote: WHy exactly TagExtraInfo to be implemented. What makes difference it this is used and not used in teiclass in TLD file Example: MessagesTei extends TagExtraInfo { TagExtraInfo { public IterationTEI() { super(); } public VariableInfo[] getVariableInfo(TagData data) { Maybe in case you want to localize the information for the tag. Just a guess. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can we specify variables in html form tags action attribute
Chetan Pandey wrote: pageContext.setAttribute(propertyaction,propertyaction);% pageContext.setAttribute() is a standard map-based pattern. All of these use (key, value) and not (value, key) as you have above. Swap the two arguments. Remember your scope (third parameter). - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[SOLVED] Re: Auto render form bean as hidden fields
In case anyone's curious, here's the synopsis of my solution: - Manually annotate (Java 1.5) the private fields I want to track. - Have a base class that stores the original state (when a record is first loaded from the database, for editing, for example). - Write a class that walks through the annotated fields, getting their type from attributes (types are things like simple--hidden,text,etc--nested, or mapped), and writes input type=hidden... tags for each one. - Make a tag library to output the JS (exporting page context variables is a magical thing indeed) for checking for changes. - Unit test for a few days :) The tricky part was the map-based nested beans. The easy part was outputting the input type=hidden... tags. The hard part was realizing that BeanUtils.cloneBean does a shallow copy of Maps. Fortunately, the code that walked through the annotations was also able to deep-copy the bean. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about Lookup dispatch action
mosho wrote: Request[/planName] does not contain handler parameter named navigation In your struts-config.xml, are you including 'parameter=navigation' in your action mapping? A la: action path=/planName type=my.pkg.PlanNameAction name=planNameForm parameter=navigation ... /action The parameter gives you a place to pass additional data to your action. In the case of LookupDispatchAction, it uses it to find out which request parameter (in this case, navigation) it should look at to determine which method to call in your subclass. So your form will submit, and be stuff like: navigation=Next%20Record It looks messy, but that's OK. The framework takes it and translates it back into Next Record. Now in your subclass, you override getKeyMethodMap() right? And somewhere in there, you have something like, map.put( navigation.next.record, next ); Where next corresponds to the public ActionForward next( ActionMapping...) method you have defined in your subclass. And in your MessageResources.properties (or whatever the file's called in your web app), you have: navigation.next.record=Next Record See how everything links together? Now the button text you choose is likely different, but this flexibility is the reason you NEVER refer to the button by its text. Let Struts do that internally, only your users should see it. Just thought I'd give you a little background so you know what you're getting into; anyone correct me if I'm wrong :) Oh one last thing. Make sure you're NOT overriding execute() in your subclass. It's fine for regular Action-derived classes, but you're using LookupDispatchAction, which needs to run its own implementation of execute(). - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about Lookup dispatch action
Puneet Lakhina wrote: OK One more thing, if you need to call this javascript method even from ur submit button, to set the property value then you can do html:submit value=submitText onclick = return false;onClickSubmit() / Notice the return false there. In case of a link simply do a onclick=onClickSubmit() / I hope this was what you wanted. The return false; would have to go LAST, otherwise onClickSubmit() wouldn't get called. And as he's using LookupDispatchAction, the value=submitText would have to be removed and replaced with a child tag bean:message key=submit.text / instead. So it might look like: html:submit onclick=onClickSubmit(); return false bean:message key=submit.text / /html:submit - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about Lookup dispatch action
mosho wrote: Hi Scott, It doesn't seem to work. My submit buttons look like this: html:submit property=navigation value=Previous styleClass=button bean:message key=button.previous/ /html:submitnbsp;nbsp;nbsp; Now, if I have a link, how can I set the property navigation for it. onClickSubmit() pic.gif Well first you should probably get rid of 'value=Previous', since you should be (and are) setting the button text using bean:message.../. I didn't consider you were using regular buttons as well. In this case, the hidden field is going to be sent, and might muck up LookupDispatchAction when the user clicks a regular button. So what you might need to do is something like this: input type=hidden id=hiddenNavigation name=navigation value= disabled I can't guarantee having the disabled there will work, but it should prevent the web browser from sending an extra (blank) navigation property and possibly causing the bean helpers to discard the REAL navigation value (when a button is clicked). Then in your JSP: c:set var=submitText bean:message key=button.submit / /c:set script type=text/javascript function onClickSubmit() { var hiddenField = document.getElementById( hiddenNavigation ); hiddenField.disabled = false; hiddenField.value = ${submitText}; document.navigationForm.submit(); } /script Have fun, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Ready-made function somewhere to escape HTML?
Hello, I have user-entered input managed by a few custom tags (Java classes, not tag files), and I need to encode this stuff to escape any special HTML characters the user might type. Is there a special one in Struts I can/should use, or should I write my own? (Struts 1.2.9, Tomcat 5.5.17) - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Auto render form bean as hidden fields
Laurie Harper wrote: Scott Van Wart wrote: We have a requirement that the user be prompted if any changes have been made on a form, and they try to navigate away. I've divided this up Firstly, is the requirement to detect changes to the form compared to how it was last rendered, or compared to how it was *originally* rendered? I.e. do you have to be able to detect a difference in form state across multiple requests? Originally rendered. I need to render the hidden fields because it's a multi-user system, and I have other mechanisms that maintain concurrency--so by passing the fields back and forth as hidden, the process doesn't get disrupted by someone else changing it in the background (I can use my other methods of notifying the user that this has happened). Even then, all you really need is a Javascript object containing key/value pairs describing each form property's starting value. You shouldn't need to worry about server-side data types, collections, or anything else; just 'form field X has value Y'. There are a few things I need to worry about by design: - Child items listed on a page, and their order. - Multi-select dropdowns. - Multiple checkboxes (this one actually wasn't as difficult as I thought it was going to be). - Map-based nested beans (someForm.someChild(4).whatever--ahh, a simple key=value? Nope, whatever is a multi-checkbox). Right now I'm halfway through my implementation of generating a lot of stuff myself. Rather than using beanutils, I just add a @NavPrompt annotation to each private member of my ActionForm that I want to track. I've implemented basic ones (where I can just do document.form.whatever.value != ...), multi-selects (with a helper method), multi-checkboxes (with a helper method), but I still need to do nested beans and map-based beans. I decided to do it this way rather than simple key/value pairs to keep the JavaScript as simple as possible. It's also possible that with better knowledge of JavaScript I could reduce the amount of framework I need to write on the server, but writing Java code is far more fun than learning--let alone writing--JavaScript IMHO :). Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question about Lookup dispatch action
Christopher Goldman wrote: On Thu, 2006-08-17 at 14:26 -0700, mosho wrote: Hi All, I have multiple buttons on my form and I am using LookUpDistpatchAction to submit the form depending on which button is clicked. I have another requirement now, I have multiple images that are going to be links. I need to submit the form using onclick. So in my javascript, I will have to submit the form. How can I change/ set the value for my parameter? It is giving me error: Request[/selectLocation] does not contain handler parameter named navigation Thanks for your help, In your onclick handler for the images, change the (presumably) hidden form input field value: document.forms[form-name].elements[navigation].value = new-value Then, submit the form. This is in Firefox. Looks like it works for IE as well. Not really a Struts question -- just straight Javascript... Doesn't he need to match up the message resource values, like if he had, protected Map getKeyMethodMap() { Map map = new TreeMap(); map.put( form.create, create ); return map; } Then it would take a little trickery in the JSP to get the right values in the Javascript: c:set var=createLabel bean:message key=form.create / /c:set So the web browser passes the correct value, and the lookup map will work: function onClickCreate() { document.someForm.action.value = ${createLabel}; document.someForm.submit(); } That should do it I think... - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ready-made function somewhere to escape HTML?
Frank W. Zammetti wrote: Hi Scott... have a look at the ResponseHelpers class in Java Web Parts: http://javawebparts.sourceforge.net More precisely: http://javawebparts.sourceforge.net/javadocs/index.html The encodeEntities() method should do the trick. Ahh... that class name you mentioned made me think of a class I saw while stepping through some code... I think org.apache.struts.util.ResponseUtils#filter will do the trick :). Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
LookupDispatchAction using wrong resource bundle!
I have multiple resource bundles in addition to the default one in struts-config.xml: message-resources parameter=MessageResources null=false / !-- I put id, parameter and key, because I'm not convinced I know what each one does :( -- message-resources id=constraints parameter=constraints key=constraints factory=ca.indosoft.common.resource.ConstraintResourcesFactory null=true / In my Action: protected void create( ... ) { ... } // and so on... protected Map getKeyMethodMap() { final MapString, String map = new TreeMapString, String(); map.put( form.label.create, create ); map.put( form.label.update, update ); map.put( form.label.delete, delete ); map.put( form.label.clear, clear ); map.put( form.label.cancel, cancel ); map.put( form.label.new, makeNew ); return map; } But when I debug through it, in LookupDispatchAction.initLookupMap( HttpServletRequest, Locale ), it's using the ConstraintResourcesFactory! The only place I actually say 'bundle=constraints' is in my validation.xml, which doesn't get hit at all (my app fails because LookupDispatchAction is looking in the ConstraintResources class, and not MessageResources.properties): form name=myForm field property=title depends=required,maxlength msg name=required key=error.title.required / msg name=maxlength key=error.title.overflow / arg name=maxlength bundle=constraints key=title.length / /field /form Is this a bug, or an issue with my implementation? Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT]Scriptlets
Rahul Akolkar wrote: Yes, for reasons such as avoiding a heterogeneous programming model, improving readability etc. It also lets you trick your web design team into doing some coding through tag libraries without actually forcing them to write classic code :). j/k - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I can't put 'maxlength' validator values in my .properties file?
David Friedman wrote: I think you need to have at least Struts v1.2.8 unless you manually upgraded the Commons Validator jar up to version 1.2.0. If I understand correctly, validator versions before 1.2.0 (Struts 1.2.8) don't actually make use of the bundle attribute in your validator xml files. So, what version of Struts are you using (1.1.4?) and/or what version of the Commons Validator are you using? Have you tried replacing the commons validator jar? I think I read that some people have tried that for older versions but I'm not positive. Validator 1.1.4 (according to the manifest, and Eclipse seems to think the source syncs up properly so I'm convinced), the one that came with Struts 1.2.9 (which I'm using too). I'll try updating the validator, thanks! - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I can't put 'maxlength' validator values in my .properties file?
David Friedman wrote: I think you need to have at least Struts v1.2.8 unless you manually upgraded the Commons Validator jar up to version 1.2.0. If I understand correctly, validator versions before 1.2.0 (Struts 1.2.8) don't actually make use of the bundle attribute in your validator xml files. So, what version of Struts are you using (1.1.4?) and/or what version of the Commons Validator are you using? Have you tried replacing the commons validator jar? I think I read that some people have tried that for older versions but I'm not positive. Another issue is that the FieldChecks class is a part of Struts (1.2.9) and not the commons validator. The line where I would assume it should grab it from the resources bundle doesn't contain any resource references: /** * Checks if the field's length is less than or equal to the maximum value. * A codeNull/code will be considered an error. * * @param bean The bean validation is being performed on. * @param va The codeValidatorAction/code that is currently being performed. * @param fieldThe codeField/code object associated with the current * field being validated. * @param errors The codeActionMessages/code object to add errors to if any * validation errors occur. * @param validator The codeValidator/code instance, used to access * other field values. * @param request Current request object. * @return True if stated conditions met. */ public static boolean validateMaxLength(Object bean, ValidatorAction va, Field field, ActionMessages errors, Validator validator, HttpServletRequest request) { String value = null; if (isString(bean)) { value = (String) bean; } else { value = ValidatorUtils.getValueAsString(bean, field.getProperty()); } if (value != null) { try { int max = Integer.parseInt(field.getVarValue(maxlength)); // RIGHT HERE if (!GenericValidator.maxLength(value, max)) { errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field)); return false; } } catch (Exception e) { errors.add(field.getKey(), Resources.getActionMessage(validator, request, va, field)); return false; } } return true; } So it's looking like I'm going to need to write my own validator. OH well - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I can't put 'maxlength' validator values in my .properties file?
David Friedman wrote: Right, but the invoked Resources.getActionMessage() has calls inside it for the bundle in the current trunk: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apa che/struts/validator/Resources.java?view=markup It looks like it hasn't changed from the 1.2.X branch and it is definitely different compared to the 1.1.X branch. If you correct the problem to the Resources class you might want to submit it to JIRA. Geesh that's weird... I'm glad you sent the link to the trunk. FieldChecks specifically is what is causing me problems. getVarValue is called indistriminately in my copy of struts (1.2.9 to the very, very best of my knowledge), but according to http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/FieldChecks.java?view=markup, the trunk's validateMaxLength is completely different... sigh... time to check some more JARs. Actually, I'm going to check the 1.2.x branch first to see whether or not I'm completely off my rocker. In between your posts I wrote my own validateMaxLength that does the same thing (only not as generically(sp) as the trunk's version). You should really type your posts faster (kidding! :) Thanks again! - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I can't put 'maxlength' validator values in my .properties file?
David Friedman wrote: Right, but the invoked Resources.getActionMessage() has calls inside it for the bundle in the current trunk: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apa che/struts/validator/Resources.java?view=markup It looks like it hasn't changed from the 1.2.X branch and it is definitely different compared to the 1.1.X branch. If you correct the problem to the Resources class you might want to submit it to JIRA. http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/FieldChecks.java?revision=289694view=markup This is the first revision with the resource support (2005 Sep 17). Struts 1.2.9 was released 2006 Mar 22, but doesn't include this! - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookupDispatchAction using wrong resource bundle!
LookupDispatchAction checks ALL the resource bundles (and doesn't even stop when it finds the key). Does anyone see any reason why it can't use the same mechanism as everything else, or has this been fixed in a later version? - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Auto render form bean as hidden fields
We have a requirement that the user be prompted if any changes have been made on a form, and they try to navigate away. I've divided this up into sub tasks: - Iterating through properties of a bean. - Render properties as hidden fields. - Render some JavaScript to check for modifications. The last one's going to be the tough one, but it's manageable. Before I start writing some custom tags, I was wondering if Struts or its dependent libs had any of this functionality already. I'd likely need some type of property class, and a way of discerning, in JSP tags (preferable), if a property is nested, a collection, a boolean or a string. I think those four types should cover it. I've no problem writing the facility myself but I'd hate to duplicate work that's already there. Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator Client-Side and Custom Classes
Mississippi John Hurt wrote: Hi, I want to do client-side validation using a custom class I can specify in the validator.xml validatorclassname//validatior section. But my question is if I use a custom class, then how the heck can Struts generate the custom javascript for it in the jsp if I'm using a custom java class I wrote that exists only on the server? Not possible right? So if that's the case, if you do leave some custom classname validator class in your validation.xml, then will that validation simply be ignored? Thanks for help with these 2 questions. If you look at the source for commons-validator, you'll see a package called 'org.apache.commons.validator.javascript'. It has a bunch of .js files as package resources, so you might look at the sources for those to get started. Beyond that I don't have any experience with it (I personally can't stand client-side validations, as validation has to be done in the database, and on the server side, and I feel inclined to draw the line somewhere given a choice :). The 'validateUtilities.js' seems to have a lot of functions that the other .js files make use of, so you should probably do so as well. It also looks like the .js file name, and function name inside the file match the method name of your validation routine (with a 'form' parameter passed, which is likely an array?). So if you do all this, I would imagine the validator will pick it up automatically (and fail silently and ignore it if you don't, as you mentioned above). Good luck, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Forwards between webapps
Saeed, Rada wrote: Forwards between webapps are not supported, cuz both have different contexts, this's what I got from running this : forward name=portal path=/portal/main.do redirect=true contextRelative=false / Is there any other way to achieve this forward between different web applications ? I think the class 'org.apache.struts.actions.SwitchAction' might do the trick (struts-config.xml): action path=/toModule type=org.apache.struts.actions.SwitchAction / And then in your JSP: html:link page=/toModule.do?prefix=portalpage=/main.doTo Portal/html:link - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's the difference between struts-base and struts-el?
Michael Cheung wrote: Hi, all; What's the difference between struts-base to struts-el. My general understanding is: - struts-el is so you can use EL expressions in your Struts tags without having to use servlet 2.4. The JSP compiler won't compile the EL, so it's up to Struts to do it. Use the regular Struts taglib if you know your JSP compiler supports EL. - Servlet 2.3 supports EL, but is disabled by default (you need isELIgnored=false or something like that at the top of every JSP). - Servlet 2.4 has it enabled by default. - You can disallow % (java) % stuff in your JSPs by specifying it in your web.xml in Servlet 2.4 - JSTL 1.0 is used when you don't have EL support--same reason why Struts provides struts-el. - JSTL 1.1 is used when you DO have EL support, so the JSTL doesn't need to handle EL itself. - Not sure about the c-rt.tld you refer to, I haven't encountered it. I suspect all these confusing differences are the result of an emerging technology. Java's resisted this whole dynamic programming thing (I hear Mustang's going to push the envelope, however), so the EL was a bit of a workaround that's now being adopted as people update their servlet containers. - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Map-based nested bean--No bean specified?
I posted on this before, so I thought I'd post a more concrete example this time. I'm using a map-based nested bean, and I'm getting the following error: java.lang.IllegalArgumentException: No bean specified org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751) org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937) org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) (add nausea) So I whipped up an example. I have a DoTestAction that populates the form and sticks it in a request. The form is called TestForm and looks like this: package test.form; import java.util.Map; import java.util.Set; import java.util.TreeMap; import org.apache.struts.action.ActionForm; public class TestForm extends ActionForm { public static final long serialVersionUID = 1; private String firstName; private String lastName; private MapString, ChildPerson children; public TestForm() { this.firstName = ; this.lastName = ; this.children = new TreeMapString, ChildPerson(); } public SetString getChildIds() { return this.children.keySet(); } public MapString, ChildPerson getChildren() { return this.children; } public void setChildren( MapString, ChildPerson children ) { this.children = children; } public String getFirstName() { return this.firstName; } public void setFirstName( String firstName ) { this.firstName = firstName; } public String getLastName() { return this.lastName; } public void setLastName( String lastName ) { this.lastName = lastName; } public void setChild( String id, ChildPerson child ) { this.children.put( id, child ); } public ChildPerson getChild( String id ) { return this.children.get( id ); } } The populate action looks like this: package test.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import test.form.ChildPerson; import test.form.TestForm; public class DoTestAction extends Action { @Override public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception { TestForm testForm = new TestForm(); ChildPerson child = new ChildPerson(); child.setFirstName( First 1 ); child.setLastName( Last 1 ); testForm.setChild( 1, child ); child = new ChildPerson(); child.setFirstName( First 2 ); child.setLastName( Last 2 ); testForm.setChild( 2, child ); request.setAttribute( testForm, testForm ); return mapping.findForward( default ); } } While the JSP itself looks like this: %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % %@ taglib uri=/tags/struts-html prefix=html % %@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8% !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleTest/title /head body html:form action=/test First Name: html:text property=firstName /br Last Name: html:text property=lastName /br c:forEach var=childId items=${testForm.childIds} Child #${childId} First Name: html:text property=child(${childId}).firstName /br Child #${childId} Last Name: html:text property=child(${childId}).lastName /br /c:forEach html:submit / /html:form /body /html My struts-config.xml (though I'm not sure this would help) has this for the forms and actions: form-bean name=doTestForm type=test.form.DoTestForm / form-bean name=testForm type=test.form.TestForm / ... action path=/doTest type=test.action.DoTestAction name=doTestForm scope=request validate=false forward name=default path=/test.jsp / /action action path=/test type=test.action.TestAction name=testForm scope=request validate=false forward name=default path=/test.jsp / /action I won't bother to post TestAction (/testAction) as it doesn't even get to that point. Am I doing this the right way? Is this sort of thing even possible? It seems such a natural way
[SOLVED?] Re: Map-based nested bean--No bean specified?
OK so I replaced the 'getChild( String id )' method with the following: public ChildPerson getChild( String id ) { ChildPerson child = this.children.get( id ); if ( child == null ) { child = new ChildPerson(); this.children.put( id, child ); } return child; } And my problems were all solved. I tried this solution before in my previous post, but made a typo, which caused it to fail with the same error, so I thought my previous solution simply didn't work. It wasn't until I tried this solution with my concrete example below that I noticed the typo (was creating a new child, putting it into the map, but then STILL returning null. Note that setChild( String id, ChildPerson child ) never gets called by the framework. So my final question: Is all this a good idea? :) - Scott Scott Van Wart wrote: I posted on this before, so I thought I'd post a more concrete example this time. I'm using a map-based nested bean, and I'm getting the following error: java.lang.IllegalArgumentException: No bean specified org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751) org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937) org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298) org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) (add nausea) So I whipped up an example. I have a DoTestAction that populates the form and sticks it in a request. The form is called TestForm and looks like this: package test.form; import java.util.Map; import java.util.Set; import java.util.TreeMap; import org.apache.struts.action.ActionForm; public class TestForm extends ActionForm { public static final long serialVersionUID = 1; private String firstName; private String lastName; private MapString, ChildPerson children; public TestForm() { this.firstName = ; this.lastName = ; this.children = new TreeMapString, ChildPerson(); } public SetString getChildIds() { return this.children.keySet(); } public MapString, ChildPerson getChildren() { return this.children; } public void setChildren( MapString, ChildPerson children ) { this.children = children; } public String getFirstName() { return this.firstName; } public void setFirstName( String firstName ) { this.firstName = firstName; } public String getLastName() { return this.lastName; } public void setLastName( String lastName ) { this.lastName = lastName; } public void setChild( String id, ChildPerson child ) { this.children.put( id, child ); } public ChildPerson getChild( String id ) { return this.children.get( id ); } } The populate action looks like this: package test.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import test.form.ChildPerson; import test.form.TestForm; public class DoTestAction extends Action { @Override public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception { TestForm testForm = new TestForm(); ChildPerson child = new ChildPerson(); child.setFirstName( First 1 ); child.setLastName( Last 1 ); testForm.setChild( 1, child ); child = new ChildPerson(); child.setFirstName( First 2 ); child.setLastName( Last 2 ); testForm.setChild( 2, child ); request.setAttribute( testForm, testForm ); return mapping.findForward( default ); } } While the JSP itself looks like this: %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % %@ taglib uri=/tags/struts-html prefix=html % %@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8% !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleTest/title /head body html:form action=/test First Name: html:text property=firstName /br Last Name: html:text property=lastName /br c:forEach var=childId items=${testForm.childIds} Child #${childId} First Name: html:text property=child(${childId}).firstName /br Child #${childId} Last Name: html:text property=child(${childId}).lastName /br /c:forEach html:submit
Map-based nested bean
(Struts 1.2.9, Tomcat 5.5.17) I have something similar to the following in my ActionForm: public class MyForm extends ActionForm { public static class NestedBean { private String name; private String value; // String getName(), String getValue(), void setName( String ), void setValue( String ) } private MapString, NestedBean children = new TreeMapString, NestedBean(); // Map getChildren(), void setChildren( Map ) public NestedBean getChild( String key ) { return this.children.get( key ); } public void setChild( String key, NestedBean child ) { this.children.put( key, child ); } } I use it like so in the JSP: html:form action=/myAction html:text property=myForm.child(whatever).name / html:text property=myForm.child(whatever).value / /html:form Everything works fine until form submission. Then I get errors like No bean specified in the populate methods of BeanUtils. Looking at the property descriptors I see that it's not picking up the getChild and setChild accessors. Is this the right way to implement this? Am I still missing something? Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accepting multiple date masks with the date validator
Adam Gordon wrote: IIOC, the only way you can do this with the stock validator is to use mask rather than date as the validator. Then, you can use a regex to dictate your mask. I'll warn you though, if you use a regular expression it's going to be VERY long because it will also need to validate that the date entered is valid. Additionally, the stock date validator accepts dates like 30 FEB and just rolls it to the appropriate March date. Here's the REGEX we use (note that the regex is all on one line with no spaces: var var-namemask/var-name var-value^(((0?[1-9]|1[012])/(0?[1-9]|1\d|2[0-8])|(0?[13456789]|1[012])/(2 9|30)|(0?[13578]|1[02])/31)/(20)((0[6-9])|(10))|0?2/29/((20)(0[48])))$/var- value /var Alternatively, you can override the validate method in your ValidatorForm and do it yourself - which given your requirements, sounds like the easier of the two options. Holy lipton that's nuts. I think I'll see what's behind door number 3: public void setDate( String date ) { this.date = translateDate( date ); // where translateDate inserts the slashes if necessary } So I can use the date validator with no problems, and when the client submits the form, they get back a slash-separated date in the input field. Thanks for the help :) - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Thread-safe MessageResources[Factory]
I'm implementing my own MessageResources and MessageResourcesFactory-derived classes. Do these need to be thread-safe, specifically, the 'String MessageResources.getMessage( Locale locale, String key )'? Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Accepting multiple date masks with the date validator
Adam Gordon wrote: Heh. Regular Expressions aren't for everyone - I happen to work w/ two engineers who live and die by them. In your bean setter for the date, I'd make sure no exceptions could be thrown, or handle them - the code I took over from an engineer we had that left had this issue and it took me almost a week to track down what was going on between the validator and his code. Yeah, essentially I'm covering all the bases (null pointers, index out of bounds, etc.) so no RuntimeExceptions can be thrown either. If anything doesn't look right to the translation method, it simply returns the original. I DO like regular expressions, but feel that a lot of people go overboard and use them for things they shouldn't be used for :). - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Determine whether or not a string is a Tiles definition
Is there a method anywhere I can use to quickly determine whether or not a given String is a tiles definition? - Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Accepting multiple date masks with the date validator
I have a requirement in my project that I be able to accept two different date masks. One with slashes (thus, 10 characters) and one without (8 digits). Is there any way to do this with the stock date validator, or do I need to roll my own wrapper? Thanks, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[FRIDAY][OT] Joke - Job descriptions
I wouldn't have thought to submit this but for the programmer reference :). --- 1. A banker is a fellow who lends you his umbrella when the sun is shining and wants it back the minute it begins to rain. 2. An economist is an expert who will know tomorrow why the things he predicted yesterday didn't happen today. 3. A statistician is someone who is good with numbers but lacks the personality to be an accountant. 4. An actuary is someone who brings a fake bomb on a plane, because that decreases the chances that there will be another bomb on the plane. 5. A programmer is someone who solves a problem you didn't know you had in a way you don't understand. 6. A mathematician is like a blind man in a dark room looking for a black cat that isn't there. 7. A topologist is a someone who doesn't know the difference between a coffee cup and doughnut. 8. A lawyer is a person who writes a 10,000 word document and calls it a brief. 9. A psychologist is someone who watches everyone else when a beautiful girl enters the room. 10. A professor is one who talks in someone else's sleep. 11. A consultant is someone who takes the watch off your wrist and tells you the time. 12. A committee is a body that keeps minutes and wastes hours. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]