Job postings
Greetings, I'm a Java team lead for a company in Atlanta Ga. My team has 2 positions open for senior level Java/Struts developers. I was wondering if its okay to post on this list regarding these open positions. /robert - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Job postings
Don't think I know Dale. /robert - Original Message - From: Martin Gainty mgai...@hotmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 7:51 AM Subject: RE: Job postings does'nt dale live down there? Martin __ Vote for me and get a 1000$ Tiffany's store credit...Newt Gingrich Date: Thu, 26 May 2011 17:14:48 +0530 Subject: Re: Job postings From: sharad23...@gmail.com To: user@struts.apache.org Hello Robert, What i have to do for this .I want to join. Regards Sharad On Thu, May 26, 2011 at 4:50 PM, Robert Taylor rtay...@dtgresults.comwrote: Greetings, I'm a Java team lead for a company in Atlanta Ga. My team has 2 positions open for senior level Java/Struts developers. I was wondering if its okay to post on this list regarding these open positions. /robert - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Sharad Singh 9450328117 http://202.141.40.215:8080/brihaspati/servlet/brihaspati - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: [OT] Re: Job postings
Hi Dale, We have a posting on the AJUG site. I've also been to the latest AJUG meetings. When I was there, 6 companies stood up and declared many openings for Java developers. Thanks for the advice. /robert - Original Message - From: Dale Newfield d...@newfield.org To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 9:06 AM Subject: [OT] Re: Job postings On 5/26/11 7:51 AM, Martin Gainty wrote: does'nt dale live down there? Thanks for thinking of me. The reason I've been scarce around these parts lately is that I finally had to get a real job at the end of last year, so I no longer have as much time to respond to questions here, and I'm no longer in the market for a job. I'm now working at Turner Entertainment, and we're also looking for senior level folks, but we've been having quite a difficult time finding well qualified candidates ourselves. In Atlanta my first suggestion would be to post to the Atlanta Java Users' Group job mailing list, but seeing as we're still looking I'm not sure how much that advice is worth. -Dale On Thu, May 26, 2011 at 4:50 PM, Robert Taylorrtay...@dtgresults.comwrote: Greetings, I'm a Java team lead for a company in Atlanta Ga. My team has 2 positions open for senior level Java/Struts developers. I was wondering if its okay to post on this list regarding these open positions. /robert - 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: [OT] Re: Job postings
Hello, Currently we are only considering candidates in the Atlanta, GA area. Telecommuting is an option; however, you will be required to be onsite at various times. Thanks, /robert - Original Message - From: Mohamed SIDI mhm.s...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 9:41 AM Subject: Re: [OT] Re: Job postings Hello there, This may be one of the most important opportunity what about one witch is located in France ? there are some conditions to candidate :) 2011/5/26 Robert Taylor rtay...@dtgresults.com Hi Dale, We have a posting on the AJUG site. I've also been to the latest AJUG meetings. When I was there, 6 companies stood up and declared many openings for Java developers. Thanks for the advice. /robert - Original Message - From: Dale Newfield d...@newfield.org To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, May 26, 2011 9:06 AM Subject: [OT] Re: Job postings On 5/26/11 7:51 AM, Martin Gainty wrote: does'nt dale live down there? Thanks for thinking of me. The reason I've been scarce around these parts lately is that I finally had to get a real job at the end of last year, so I no longer have as much time to respond to questions here, and I'm no longer in the market for a job. I'm now working at Turner Entertainment, and we're also looking for senior level folks, but we've been having quite a difficult time finding well qualified candidates ourselves. In Atlanta my first suggestion would be to post to the Atlanta Java Users' Group job mailing list, but seeing as we're still looking I'm not sure how much that advice is worth. -Dale On Thu, May 26, 2011 at 4:50 PM, Robert Taylorrtay...@dtgresults.com wrote: Greetings, I'm a Java team lead for a company in Atlanta Ga. My team has 2 positions open for senior level Java/Struts developers. I was wondering if its okay to post on this list regarding these open positions. /robert - 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 -- Cordialement Mohamed - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: referencing javascript files from (action) jsp file
Hi Li, JSTL and EL give you access to the implicit pageContext object. From there you can access attributes from request and session. For example: c:set var=contextPath value=${pageContext.request.contextPath}/ And then use contextPath variable however you wish. I'm not sure how this would translate into an OGNL expression. But I'm sure others on this list do :) /robert - Original Message - From: Li Ying liying.cn.2...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Friday, October 15, 2010 4:12 AM Subject: Re: referencing javascript files from (action) jsp file Hi Robert and Dave: I tried c:url in my application, and it works for almost all the case. But there is one exception: In my application, i customized the CSS files shiped with Struts JQuery plugin and put them under path [{contextPath}/res/struts/]. In JSP, i need add code likes: sj:head jquerytheme=redmond scriptPath=%{contextPath}/res/struts/ / to tell Struts JQuery plugin where to load js/css files. In this case, i think c:url can not help, because [contextPath] is a part of attribute value of another tag. I tried %{#request.getContextPath()}, but it don't work for some reason i don't know. So i decide to remain my old solution(adding a property in my Action), so i can reference [contextPath] in Struts tags. Of cause, in simlpe URL case, c:url is a better choice. - 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: referencing javascript files from (action) jsp file
Or you could simply use JSTL. The following works for me: script type=text/javascript src=c:url value=/javascript/jquery/jquery-1.4.2.min.js//script /robert - Original Message - From: Li Ying liying.cn.2...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, October 14, 2010 10:33 AM Subject: Re: referencing javascript files from (action) jsp file I suggest you to reference your resource file(js, image, css and so on) in this way: script type=text/javascript src=s:property value=contextPath //path/filename.js/script The [s:property value=contextPath /] part will render the contextPath where the web application is deployed. The [contextPath] is a property defined in Action: public String getContextPath() { return ServletActionContext.getServletContext().getContextPath(); } I put this property in the supper class of all of the Action classes so i can reference this property in all the pages - 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: additional onsubmit javascript validation
Hi Mead, Binding validation to the click event on the submit button is not what i want. This would fire my validation before the onsubmit validation occurs. I want to leverage the Struts2 javascript validation framework which already exists. Then, if that succeeds, I would like to fire additional javascript validation. The Struts2 validation framework dynamically generates the appropriate validation for the form if the form has validate=true. Otherwise it doesn't generate it. However, when validate=true, it appends return validateForm_MyAction(); as an onsubmit handler to any existing onsubmit attribute value. With regards to your second suggestion removing the onsubmit event. I cannot do this (without modifying code/template) because if validate=true in the form, it will automatically populate the form onsubmit attribute. If I set validate=false, then the Struts2 validation framework doesn't auto-generate the form javascript validation. /robert - Original Message - From: Mead Lai laiqi...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, September 22, 2010 9:50 PM Subject: Re: additional onsubmit javascript validation Hi Robert, Do you have another submit button? such as s:submit/, Try to bind a event listener to this button, that when you click this button, you do some validation(); Another way is using the js to remove the onsubmit event, then binding another method you write, and invoke the myValidation() in that method; bind AnoterMethod(){ if(!validateForm_MyAction()){return;} //Here do your validation return myValidation() } Regards, Mead - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: additional onsubmit javascript validation
Hi Dave, Based on my requirements (leverage the existing Struts2 client-side validation framework), I'm not sure modifying the templates will work here. It appears that when validate=true I need a way to tell Struts2 validation framework to not populate the onsubmit attribute. But I still want it to generate the appropriate javascript based on the field validations I have defined for the action. This way I could use my own onsubmit handler to call the auto-generated javascript method (validatForm_MyAction()) at the appropriate time. Reviewing the existing template files didn't reveal that this was possible by overriding a template. Maybe I missed something. /robert - Original Message - From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, September 22, 2010 9:44 PM Subject: Re: additional onsubmit javascript validation I modified the templates to allow pages to inject their own validation messages. Unfortunately I never checked this in. You could do it with a JavaScript framework, though, through binding. Dave On Wed, Sep 22, 2010 at 9:26 PM, Robert Taylor rtay...@dtgresults.comwrote: Greetings, I'm using Struts2.2.1 and have a form using the xhtml theme which performs some simple javascript validation (required, etc...). Works great. Now, after the simple javascript validation executes I would like to add some more validation to the onsubmit event. Apart from modifying a template, I couldn't see how this could be achieved easily. If you include the validation in the form onsubmit attribute, it is prepended to the dynamically generated javascript validation function name. For example: s:form action=MyAction namespace=/mynamespace theme=xhtml validate=true onsubmit=return myValidation() produces the following markup. form id=Myaction name=MyAction onsubmit=return myValidation(); return validateForm_MyAction(); action=/scname/mynamespace/MyAction.html method=post onreset=clearErrorMessages(this);clearErrorLabels(this); As is evident, this won't work for me. I want to leverage the dynamically generated Javascript validation when validate=true. If that validation succeeds, then I want to execute some proprietary validation. I also know the name of the dynamically generated javascript method so I could call it in myValidation(); Any suggestions would be appreciated. Thanks, /robert - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: additional onsubmit javascript validation
Hi Dale, I'm just using the xhtml theme, but I missed that chunk of code in xhtml/form-validate.ftl. That's what I needed. Thanks, /robert - Original Message - From: Dale Newfield d...@newfield.org To: Struts Users Mailing List user@struts.apache.org Cc: Robert Taylor rtay...@dtgresults.com Sent: Thursday, September 23, 2010 1:51 PM Subject: Re: additional onsubmit javascript validation On 9/23/10 7:48 AM, Robert Taylor wrote: I'm not sure modifying the templates will work here. css_xhtml/form-validate.ftl contains: #if parameters.onsubmit?? ${tag.addParameter('onsubmit', ${parameters.onsubmit}; return validateForm_${parameters.id}();)} #else ${tag.addParameter('onsubmit', return validateForm_${parameters.id}();)} /#if If you override that file and change one line like so: #if parameters.onsubmit?? ${tag.addParameter('onsubmit', return (validateForm_${parameters.id}() ${parameters.onsubmit});)} #else ${tag.addParameter('onsubmit', return validateForm_${parameters.id}();)} /#if and make your onsubmit attribute just be javascript that generates a true/false value (FOO) instead of return FOO, then I think you'll get what you want. -Dale - 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
additional onsubmit javascript validation
Greetings, I'm using Struts2.2.1 and have a form using the xhtml theme which performs some simple javascript validation (required, etc...). Works great. Now, after the simple javascript validation executes I would like to add some more validation to the onsubmit event. Apart from modifying a template, I couldn't see how this could be achieved easily. If you include the validation in the form onsubmit attribute, it is prepended to the dynamically generated javascript validation function name. For example: s:form action=MyAction namespace=/mynamespace theme=xhtml validate=true onsubmit=return myValidation() produces the following markup. form id=Myaction name=MyAction onsubmit=return myValidation(); return validateForm_MyAction(); action=/scname/mynamespace/MyAction.html method=post onreset=clearErrorMessages(this);clearErrorLabels(this); As is evident, this won't work for me. I want to leverage the dynamically generated Javascript validation when validate=true. If that validation succeeds, then I want to execute some proprietary validation. I also know the name of the dynamically generated javascript method so I could call it in myValidation(); Any suggestions would be appreciated. Thanks, /robert
Re: Struts2 Dynamic Merge of two webform objects / join two objects in database
Hi Nicolas, I'ld also be interested in hearing about an elegant solution to this problem as well. Ideally it would be nice if we all had nice simple models where we could reuse our hibernate objects for both persistence and web binding. However, if have found, this is often not the case. Although maybe not ideal, for the case you mentioned, i have always ended up creating/using a separate DTO (data transfer object) which contained a subset of the Hibernate entity object properties. If the properties are simple enough, I have been able to use BeanUtils.copyProperties() to transfer the appropriate values between the two objects. Probably not the answer you were looking for, but this has been my approach so far. /robert - Original Message - From: Nicolas Kopp nicolas.k...@empirica.com To: user@struts.apache.org Sent: Friday, September 03, 2010 5:23 AM Subject: Struts2 Dynamic Merge of two webform objects / join two objects in database Hi there, We (Team of two developers) use Hibernate integrated in a Struts2 web application. If we want to perform an update to our objects on the database we fetch the data and load the resulting object into a web form where the user can edit the data. In this web form not all the object's attributes are displayed and editable. Submitting the form data will create a new object with the values set in the web form, which is then saved to the database again using Hibernate. Since not all the attributes from this certain object were set in the web form, some values result as null, which leads us to the problem that these values (even though there are set in the DB) get overwritten with null values. Hibernate is set to dynamic-update=true in all involved mappings. There are (at least) three workarounds that we could think of: 1.Adding the missing attributes as hidden fields in the web form (not very flexible) 2.Adding the missing attributes in the Java code before saving the object to the DB (not very flexible either) 3.Writing a utility class which merges the data from the persistent object with the one created by the web form (flexible but cumbersome). What we do right now is to iterate through all methods of the specific object, find out the getterMethods and setterMethods of both the old database-object and the new Hibernate object, compare values and take the values which are not null. This is not a very satisfying resolution, because some objects contain Other objects with values and so on, sometimes three or more layers of depth. Also, using reflection in Java is not a very nice resolution. We are sure there must be other people out there facing similar problems but even after quite some research efforts we were not be able to find anything of help in the web. We are even not sure if this is more a Hibernate or a Struts2 problem. We'd be really grateful if someone could point us in the right direction. Thanks in advance! Nicolas Alex - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
struts/utils.js included twice
Greetings, I'm using Struts 2.1.8.1 and have noticed that the s:head / will output script ..src=/webapp/struts/utils.js/script even when s:form theme=xhtml/ is used which does the same thing. So i end up with 2 requests for struts/utils.js. Probably harmless, but also probably not a good idea. Does anyone else see the same behavior or care to elaborate? /robert
Re: redirect with parameter in struts
Another possible way is to leverage the ActionRedirect class. For example: ActionRedirect redirect = new ActionRedirect(mapping.findForward(someRedirectingForwardDef)); redirect.addParameter(cmp, companyName); redirect.addParameter(myOtherParameter, myOtherParameterValue); return redirect; The framework takes care of building the query string, encoding, etc... /robert - Original Message - From: Struts User smtesting...@gmail.com To: user@struts.apache.org Sent: Monday, August 23, 2010 6:01 PM Subject: redirect with parameter in struts Hi, Is it possible in struts1 to include a parameter in the action redirection. If I have a web application say, http://www..xyz.com/welcome.do and I want to redirect it to http://www.xyz.com/welcomeredirect.do?cmp=company1 while value of cmp will be assigned dynamically. how can I achieve this? Any help or suggestion is greatly appreciated. Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: struts2+hibernate+spring - lazyInitaializationException
Hi Greg, I believe Brian is correct. You need to wrap BookDao.find(...) within a transaction or use OpenSessionInView. Either one of these should keep the session open when you are navigating the object graph in your DAO. If you use OSIV (OpenSessionInView) filter, then you can navigate the object graph in your web tier as well. We are using both OpenSessionInView filter and a service layer which acts as a facade to the data layer (DAOs). The services are annotated with @Transactional (although for readOnly transactions this is really unnecessary within the OSIV scope; but they are there for consistency). /robert - Original Message - From: Brian Thompson elephant...@gmail.com To: Struts Users Mailing List user@struts.apache.org; lukasz.len...@gmail.com Sent: Monday, July 19, 2010 1:22 PM Subject: Re: struts2+hibernate+spring - lazyInitaializationException Looks to me like the session is being closed in the scope of hibernateTemplate.get(). I don't see a transactionManager mentioned in the XML ... you could try adding something like this in the XML configuration file: bean id=transactionManager class=org.springframework.orm.hibernate.HibernateTransactionManager property name=sessionFactory ref=sessionFactory / /bean tx:annotation-driven transaction-manager=transactionManager / n.b. I haven't tested the above config, so it probably won't work as-is. Hopefully it helps, though. -Brian - 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: Session error while loading an object
Greetings, I think that you might want to separate your functional concerns into different objects. One common pattern in multi-level architectures is to have a model object like Customer which would contain domain information for the Customer and a Service object like CustomerService which would be a singleton (many times injected using some IoC container). CustomerService would be used as a fascade to retrieve and persist Customer objects (or rather would delegate to a DAO layer to do the actual retrieval and persistence). The DataSource is usually injected into the DAO layer using your IoC container. Spring is a popular IoC container which is used to manage the middle tier (and web tier if you like). By separating the layers, you could persist Customer to the session and collaborate with the CustomService object and MessageResources when necessary in the web tier and avoid the NotSerializableExceptions you are running into with the DataSource and MessageSources. These are often interfaces whose implementations are provided by some framework, so it's unlikely you will be able to easily make them Serializable (they probably weren't meant to be anyways). Keep in mind, there are many ways to implement multilevel architecture. You may want to do some research on best practices. Spring and Rod Johnson are good resources. You could also reference Martin Fowler. Good luck. /robert - Original Message - From: abhishek jain abhishek.netj...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, July 14, 2010 5:15 AM Subject: Re: Session error while loading an object 2010/7/14 Paweł Wielgus poulw...@gmail.com Hi all, You get this error every time when tomcat tries to save someone's session and object of class com.cart.Customer is in it. Like Robert said, add Serializable to com.cart.Customer and the problem will go away. Best greetings, Paweł Wielgus. Hi, I have added the Serializable to com.cart.Customer, but now i am getting the following error, which i think is due to the reason that i am using reference of Datasource and Message Resource in the class which i believe is not serializable: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.commons.dbcp.BasicDataSourcejava.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.commons.dbcp.BasicDataSource at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) . Pl. advice thanks abhishek - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Session error while loading an object
Greetings, Does the Customer object implement Serializable interface? If not, try modifying Customer to implement Serializable and see if the error still persists. /robert - Original Message - From: abhishek jain abhishek.netj...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 13, 2010 4:33 AM Subject: Session error while loading an object Hi friends, I am using tomcat 5.5 , struts 1.x and i encounter the following error: I actually store the object in session and retrieve that(for a shopping cart application), pl. advice what i can do to remove this error: Exception loading sessions from persistent storagejava.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.cart.Customer at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1416) at org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:940) at org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394) at org.apache.catalina.session.StandardManager.load(StandardManager.java:321) at org.apache.catalina.session.StandardManager.start(StandardManager.java:637) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4202) at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3056) at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:432) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1278) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559) at java.lang.Thread.run(Thread.java:619) Caused by: java.io.NotSerializableException: com.cart.Customer at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326) at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1492) at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:957) at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:517) at org.apache.catalina.session.StandardManager.unload(StandardManager.java:463) at org.apache.catalina.session.StandardManager.stop(StandardManager.java:667) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4362) at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3050) ... 7 more -- Thanks and kind Regards, Abhishek jain - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2, Jquery and Spring Security 3.0
Your AJAX request to load the tab is getting redirected to the login content instead of the tab content due to the session time out and the spring security authentication. Therefore your tab is displaying the login screen. You could add a Javascript component to timeout and either notify or auto-redirect the user to the logout screen (or login screen). Various banking institutions use this solution. Another possible solution is to have your AJAX tab widget recognize the invalid content and force a redirect to the login/logout screen. /robert - Original Message - From: RogerV roger.var...@googlemail.com To: user@struts.apache.org Sent: Tuesday, May 25, 2010 6:06 AM Subject: Struts 2, Jquery and Spring Security 3.0 Has anyone come across this before? Scenario: After logging in, user runs Struts 2 action that displays a .jsp page that uses Struts2-Jquery tags to create a tabbed display that make Ajax calls to access their content from other struts actions. Walk away and let the session expire. Clicking on one of the tabs invokes the login page from Spring security as it should, except the login page appears as the content of the selected tab. How(Can) I configure Spring security so that the login page always appears as a display in it's own right. If the login program was a Struts Action I'd do this as a redirectAction, but I've no idea how to acheive this in Spring/Struts intergration. Regards -- View this message in context: http://old.nabble.com/Struts-2%2C-Jquery-and-Spring-Security-3.0-tp28666543p28666543.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: Struts 2 and Spring 3??
Currently I'm using the struts2-spring-plugin-2.1.8.1.jar spring-security-x-3.0.2.RELEASE.jars org.springframework.x-3.0.1.RELEASE-A.jars This seems to work for me for integrating Spring Security(3.x) with Struts2 using Spring 3.x core files. /robert - Original Message - From: Burton Rhodes burtonrho...@gmail.com To: Struts Users Mailing List user@struts.apache.org; Robert Taylor rtay...@dtgresults.com Sent: Monday, May 24, 2010 3:22 PM Subject: Re: Struts 2 and Spring 3?? Hantsy - It appears that AppFuse 2.1 uses Spring 2.5.6 and Spring Security 2.0.4 (as far as I can tell from the pom file). Not sure this is a fit. Robert - Are you using the Struts-Spring-Plugin as well? Currently I am using Struts 2.1.8 with Spring-Plug-in for injection (Spring 2.5.6). I want to add Spring Security instead of my home-grown methods, but would really like to use Spring Sec 3.0.4. In order to use Spring Sec 3, I need to use Spring 3.x (Core) as well. As far as I am aware, Spring 3.x will not work with the Struts-Spring-Plugin 2.1.8. Hence my delima. Anyone able to get full Spring 3 integration to work or do I just need to wait for a future Struts-Spring-Plugin to be written? On Fri, May 21, 2010 at 11:39 AM, Robert Taylor rtay...@dtgresults.com wrote: I'm using Struts2 and Spring Security 3 on a project. I used the following links to get me going: http://static.springsource.org/spring-security/site/docs/3.0.x/reference/springsecurity.html http://java.dzone.com/tips/pathway-acegi-spring-security- It's much simplier than the old ACEGI configurations. /robert - Original Message - From: Burton Rhodes burtonrho...@gmail.com To: Struts Mailing List user@struts.apache.org Sent: Friday, May 21, 2010 12:29 PM Subject: Struts 2 and Spring 3?? I think I saw a message a while back that commented about using Spring 3 (and Spring Security 3) with Struts 2.1.8 framework. Is this possible? If so, how? - 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 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 and Spring 3??
I'm using Struts2 and Spring Security 3 on a project. I used the following links to get me going: http://static.springsource.org/spring-security/site/docs/3.0.x/reference/springsecurity.html http://java.dzone.com/tips/pathway-acegi-spring-security- It's much simplier than the old ACEGI configurations. /robert - Original Message - From: Burton Rhodes burtonrho...@gmail.com To: Struts Mailing List user@struts.apache.org Sent: Friday, May 21, 2010 12:29 PM Subject: Struts 2 and Spring 3?? I think I saw a message a while back that commented about using Spring 3 (and Spring Security 3) with Struts 2.1.8 framework. Is this possible? If so, how? - 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: Struts2 annotations and superclass
Ok...i think I found the solution. The super class can provide annotations at the method level for multiple subclasses using the @Actions. If a subclass needs to add or diverge from common functionality provided by superclass method, they can override the method, however, the subclasses method will have to provide the annotation since annotations are not inherited. /robert - Original Message - From: Robert Taylor rtay...@dtgresults.com To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, April 21, 2010 8:44 AM Subject: Struts2 annotations and superclass Greetings, We are converting from using Struts1 and XDoclet to Struts2 and Struts2 annotations. We have a base action class which handles requests which displays grid style information. The super class is a template pattern which does a lot of the common heavy lifting and exposes a method display which is invoked by a name specified in the action configuration for the url. Subclasses simply implement a method to retrieve a collection of objects. What we have been doing is placing the XDoclet annotations in the subclasses which specified the url and the method to invoke. With Struts2, I don't see that this is possible using just the annotations. It appears subclasses will have to override the superclass method just to bind a url. I don't see that the @Action annotation supports a method parameter or it may be possible. The same problem will occur for our CRUD action super classes. The subclasses will have to override the super class methods just to bind the method name to the url. So, am I missing something? Is it possible to use Struts2 annotations such that subclasses don't have to override super class methods simply to bind the method name to the url? /robert - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 annotations and superclass
Greetings, We are converting from using Struts1 and XDoclet to Struts2 and Struts2 annotations. We have a base action class which handles requests which displays grid style information. The super class is a template pattern which does a lot of the common heavy lifting and exposes a method display which is invoked by a name specified in the action configuration for the url. Subclasses simply implement a method to retrieve a collection of objects. What we have been doing is placing the XDoclet annotations in the subclasses which specified the url and the method to invoke. With Struts2, I don't see that this is possible using just the annotations. It appears subclasses will have to override the superclass method just to bind a url. I don't see that the @Action annotation supports a method parameter or it may be possible. The same problem will occur for our CRUD action super classes. The subclasses will have to override the super class methods just to bind the method name to the url. So, am I missing something? Is it possible to use Struts2 annotations such that subclasses don't have to override super class methods simply to bind the method name to the url? /robert
Re: struts 2, how to trigger interceptor after action's execute() ?
To trigger code before an Action is executed place it before the invocation.invoke(). To trigger code after an Action is executed place it after the invocation.invoke(); For example: public String intercept(ActionInvocation invocation) throws Exception { MyAction action = (MyAction)invocation.getAction(); // doBeforeActionExecuted(); String result = invocation.invoke(); // doAfterActionExecuted(); return result; } hth,/robert- Original Message - From: john lee sh_thorn_b...@yahoo.com To: user@struts.apache.org Sent: Saturday, April 03, 2010 12:53 PM Subject: struts 2, how to trigger interceptor after action's execute() ? *** package name=me extends=struts-default interceptors interceptor name=mysimple class=mysimple param name=name try /param /interceptor /interceptors action name=try class=try result name=success=/success.jsp/result interceptor-ref name=mysimple param name=name try 2/param /interceptor /action the above code triggers interceptor before class try's execute(), and the purpose of interceptor, But, how to trigger interceptor again after class try's execute() ? i check the stuts 2 document, it just saying interceptor can trigger before and after execute, but never give the example for how to do it after execute(), anyone can help? tks in advance john - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts and WebServices with both FORM and BASIC authentication in same web app
Frank, thanks for the response. I was afraid that was going to be the answer. /robert Frank W. Zammetti wrote: Robert Taylor wrote: Greetings, can you have both FORM and BASIC authentication in the same web application? (I don't think so, but thought I would ask) No, you cannot. I recently asked this same question... just look at the web-app DTD... at least in 2.3, auth-method is marked as ? affinity. I have a system of Struts web applications where I have users authenticating using FORM based authentication. I also have a need for B-to-B communication between these applications and with external applications. I would like to use Axis2 for remoting and would like to secure these web services using BASIC authentication over HTTPS. I had an identical situation. I wound up using IBM's WS engine built into Websphere, since we are a Websphere shop... interestingly, this is just a version of Axis anyway! They deal with this issue though. Before I did that though, I had a proof-of-concept using a filter to the basic auth check, simulate basic auth in reality. The difference is that instead of request-challenge-validate as the cycle, the incoming WS request is required to container ID/PW with it, so I skip directly to the validate step. This has to be a common problem and was wondering if anyone had cracked this nut yet? I've found examples of doing one or the other, but NOT BOTH at the same time on the same web application. I too would like to know how others have solved this problem. It's nice when the app server has the capability built-in as Websphere does, but I'm interested in how it can be done in the absence of that. /robert Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts and WebServices with both FORM and BASIC authentication in same web app
Greetings, can you have both FORM and BASIC authentication in the same web application? (I don't think so, but thought I would ask) I have a system of Struts web applications where I have users authenticating using FORM based authentication. I also have a need for B-to-B communication between these applications and with external applications. I would like to use Axis2 for remoting and would like to secure these web services using BASIC authentication over HTTPS. This has to be a common problem and was wondering if anyone had cracked this nut yet? I've found examples of doing one or the other, but NOT BOTH at the same time on the same web application. /robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
org.apache.struts.mock classes
I've downloaded Struts 1.2.8 and am interested in using the classes in org.apache.struts.mock package to unit test my actions, forms, etc... I see the source files but cannot seem to find the binaries. Am I missing something? Do I have to build and integrate them into the struts.jar myself or create a separate strutmock.jar? Before I go and do this, is there an easier way? Has someone already done this? /robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validation and error messages in session
Greetings, I'm using Struts 1.2.7 and noticed that functionality has been added to the Action class to store error messages in the session and subsequently be removed after they have been rendered. This is quite helpful in some circumstances. I also know that error messages can be placed in the session or request scope when using the Exception handling framework. Again, this is quite helpful in some circumstances. Are there plans to add this to the Validation framework as well such that we can declaratively identify the scope in which to place the validation messages. I know that upon a validation error that the default RequestProcessor forwards to a configured url and that since the request is forwarded, then there is no need to store them in the session. I recently came upon a case where I have a page with conditionally imported page fragments. The page fragment contained an iframe with some dynamic text input fields. Upon a validation error in the iframe, it forwarded the request to its parent which subsequently rendered the page which subsequently and conditionally imported the page which was supposed to contain the validation error message. Since the import (c:import) was considered a separate request, the validation error messages was lost. I ended up subclassing the ActionMapping class, adding a validationMessageScope property. I also subclassed the RequestProcessor processValidate() and added logic to look for the subclassed ActionMapping class; if found to look up the scope into which to place the validation error messages. If the property had not been set, defaulted to the request scope. So when ever I need to propogate the validation error message across requests, I just add a set-property property=validationMessageScope value=session/ and the error messages is placed in the session. Struts takes care of removing the error messages from the session after they have been rendered. I know this is a special case. The only reason I ask is that Struts already supports the concept of storing the messages in the session and the current Exception Handling framework supports this concept. It didn't seem like too much of a stretch, to allow the Validation framework to support it. Just a thought. /robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:text not interpreted
It appears you didn't include the html taglib: %@ taglib uri=http://jakarta.apache.org/struts/tags-html; prefix=html % /robert bib_lucene bib wrote: Hi I am working on a sample struts tiles app . I got here http://www.roseindia.net/struts/struts_tiles.shtml This is a very basic tiles app. The app itself runs fine. But in the content.jsp if I put the line html:text property=txt1/ nothing shows up. I expected a text box to showup but nothing is shown. If i do a view source , html:text property=txt1/ is shown not the html input tag. Can someone please tell me where is the problem.. Thanks bib I am using struts1.2.7 I have put the taglibs on top of template.jsp %@ page language=java % %@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles % %@ taglib uri=http://jakarta.apache.org/struts/tags-bean; prefix=bean % %@ taglib uri=http://jakarta.apache.org/struts/tags-logic; prefix=logic % Thanks bib - Yahoo! Music Unlimited - Access over 1 million songs. Try it free. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.2 - Using Tile Definitions as ActionForwards
I'm using Struts 1.2.7 running in Tomcat5.x and it works for me. action path=/myAction forward=main.tile / /robert lchalupa wrote: I'm trying to use a feature of Tiles. I'm using struts 1.2. I'm using Tiles Definitions maintained in a configuration file. I want to use the definition names in the strutsconfig file instead of a jsp path. I'm able to get this feature to work if I use an action to specify an actionforward with a parameter containing the tile definition name. This works fine. I also want to specify tile definitions in Global Forwards. Is this suppose to work? Some of the Struts books lead me to believe it should. When I try it, I get an error saying it cannot find the page. My first step is to find out if this feature is available for use. Comments? Thanks lee Lee Chalupa [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.2 - Using Tile Definitions as ActionForwards
Ooops. Responded without comprehending the entire message. I haven't tried it with global forwards. Sorry. /robert Robert Taylor wrote: I'm using Struts 1.2.7 running in Tomcat5.x and it works for me. action path=/myAction forward=main.tile / /robert lchalupa wrote: I'm trying to use a feature of Tiles. I'm using struts 1.2. I'm using Tiles Definitions maintained in a configuration file. I want to use the definition names in the strutsconfig file instead of a jsp path. I'm able to get this feature to work if I use an action to specify an actionforward with a parameter containing the tile definition name. This works fine. I also want to specify tile definitions in Global Forwards. Is this suppose to work? Some of the Struts books lead me to believe it should. When I try it, I get an error saying it cannot find the page. My first step is to find out if this feature is available for use. Comments? Thanks lee Lee Chalupa [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using JSTL to access form bean properties
Your form bean should be in either request or session scope under the name used to define it in struts-config.xml file. What I usually do is something like the following: c:set var=form value=${myform}/ and then you can use it like any other object with c:if or c:choose. c:choose c:when test=${form.someBooleanProperty} /c:when c:otherwise /c:otherwise /c:choose Even though the form bean is already defined in some scope, I redefine it at the top of the page to avoid having to make multiple reference changes if my form name happens to change. If it does, I only change it in one place. /robert Néstor Boscán wrote: Hi Has anybody used JSTL to access form bean properties. I'm using JSTL and Struts Tags and I would like to do some conditioning using c:if and c:choose using the form bean properties. Regards, Néstor Boscán - 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 with authentication from database
If your using Tomcat 5.5.x, then this may help: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/realm-howto.html#JAASRealm /robert Laurie Harper wrote: I haven't used container managed security very much but I think the way you'd do that is to set up multiple security realms in Tomcat (one per application or one per database) and then configure your security constraints in the web.xml for each application. Your Tomcat books should have more details on how to do that than I can provide I'm afraid... L. C.F. Scheidecker Antunes wrote: Thanks Laurie! I have quite a few Struts and Tomcat books. What I wonder is exactly where to set up JAAS. That's because I might have more than one app in the same Tomcat5 server. So I wonder if for each database/application I could configure JAAS separately, that is can I do it only within one Struts apps use a separate database,tables for that specific struts apps? If so what is the XML config file that I should have that? My struts-config.xml? Laurie Harper wrote: C.F. Scheidecker Antunes wrote: I am learning my ways through Struts having done Servlets and JSPs before. In order to have authentication functionalities with my Servlets I used to have a user table and a roles table. Once the user logs in he/she would be authenticated with the user name, password through Tomcat as it was configured with the database information, table name, etc. I would like to do pretty much the same with Struts. I have checked the O'Reilly Struts Cookbook but, although it has great authentication tips, it does not include a recipe to have authentication with a database. Is there any article on how to perform it with Struts? Any books that you would suggest? So what I think is that I should have a model class to do this kind of authentication rather than using the XML config files. However how would I include all the roles in that class? Have a data structure like a list maybe? That way I could always check for a specific role for every JSP or action whether the user would be allowed or not. Any thoughts? You can set up container managed security in just the same was as you've done previously, you don't need to do anything new or different with Struts (provided container managed security gives you everything you need). Once you have it setup you can tell Struts to restrict access to actions based on roles through struts-config.xml. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] wrong list I know, but lazy, Tomcat 5.5 question
Rick, I'm sure you already have, but just in case you haven't... http://jakarta.apache.org/tomcat/tomcat-5.5-doc/logging.html It provides a pretty detailed explaination of how to configure cross-context logging using either log4j or java.util.logging package. BTW, Tomcat 5.5 uses Commons Logging which I think defaults to java.util.logging if its found and no other logging configs are specified. /robert Rick Reumann wrote: Woodchuck wrote the following on 8/3/2005 3:32 PM: hihi, the default logging in TC 5.5 uses JDK logging (ie. java.util.logging). you need to create and place a logging.properties file in your web app's classes folder. But this would be for specific application logging. I'm talking about just general level logging of tomcat that isn't specific to the application. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Subclassing ActionForward
Look into using Filters. They are great for this kind of stuff. /rober Lee Harrington wrote: I want to check to see if the user is logged in before performing any action, and redirect to the login page if they are not. For example...they have a page open and their session times outand then they click a button. Right now an error occurs because they are no longer logged in. I wrote a bit of code that if I put it in the beggining of an action class...does just that. But I don't want to have to put this in the front of each of my actions (particularly since I've already written a good portion of the app). Do I solve this by subclassing the action forward -- or in some other way? Lee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: test session expired HELP!
Lucas, this is such a basic question. Have you done any research on this at all? Google (Java session has expired returned 139,000 hits.) perhaps? Maybe search the archives? This isn't even a Struts question. Not even specified as OT or Newbie. In the future: http://www.catb.org/~esr/faqs/smart-questions.html Now, on to an answer: if (request.getSession(false) == null) { // session has expired } /robert Lucas Bern wrote: Hi guys! can anybody tellme how to know if a session is espired??? thanks! Lucas Brian McGovern [EMAIL PROTECTED] escribió: Thank you Mike. That was EXACTLY it. VERY appreciated. I was messing around all morning with this. -Original Message- From: Mike Millson [mailto:[EMAIL PROTECTED] Sent: Friday, May 13, 2005 2:15 PM To: Struts Users Mailing List Subject: RE: [OT] RSS w/ JSTL On Fri, 2005-05-13 at 12:28, Brian McGovern wrote: Following up. Ive gotten it rss reading to work using jstl/xml but If you are using 1.1 version tags, make sure your web.xml DTD is for J2EE 2.4. I have seen the case where 1.1 tags in combination with web.xml DTD 2.3 produces odd results. Some of the tag functions work and others do not. Apparently you need a web.xml 2.4 DTD to get full JSTL 1.1 functionality. Mike - 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] - A tu celular ¿no le falta algo? Usá Yahoo! Messenger y Correo Yahoo! en tu teléfono celular. Más información aquÃ. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
datePatternStrict for MM/dd/yyyy seems to allow 04/04/200w
Greetings, I'm using Struts 1.2.7 and trying to validate a date field using the datePatternStrict with a date format of MM/dd/. Everything seems to work as expected until I enter a date like 04/04/200w. It seems that the date validation routine thinks that this is a valid date...or atleast it allows validation of the date field to pass. The docs say that date validation leverages SimpleDateFormat so I looked at the javadocs, but found nothing to indicate that parsing 04/04/200w should pass (although I haven't tested it explicitely with just SimpleDateFormat). I'm using the following snippet in my validation.xml file: varvar-namedatePatternStrict/var-namevar-valueMM/dd//var-value/var BTW, the javascript for date validation seems to catch this, but the server side validation does not. I must be doing something wrong or this must be a known issue. Any ideas? /robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] JSTL + Collection size
Sorry, I left out a paren. Try this: c:out value=${fn:length(my_collection)}/ Yes, you have to import the following: %@ taglib uri=http://jakarta.apache.org/taglibs/fmt; prefix=fmt % BTW, functions are part of JSTL1.1. /robert -Original Message- From: draegoon Z [mailto:[EMAIL PROTECTED] Sent: Friday, April 29, 2005 2:22 PM To: user@struts.apache.org Subject: Re: [OT] JSTL + Collection size I tried it, said the syntax is wrong. I didn't see anything about fn in the JSTL spec. Where can I find documentation on this? Do I need to import a library? For now, I am just using a c:for loop to count the collection, but this can't be the cleanest way. From: Robert Taylor [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: [OT] JSTL + Collection size Date: Fri, 29 Apr 2005 07:30:49 -0400 Size: c:out value=${fn:length(my_collection}/ draegoon Z wrote: Just trying to find the ${my_collection.size} or ${my_collection.length}! Why is it not that simple? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
John, does the action to which the url /admin/customer/edit.do correspond have a form associated with it? You might also try removing the .do from the url as struts should automatically add this for you. For example: html:form action=/admin/customer/edit div id=editPage tiles:insert attribute=pageBody/ /div /html:form /robert John Moore wrote: I know this is one of those errors to which there is an apparent standard answer - namely, that I must be using one of the html input tags outside the context of an enclosing htm:form tag. The thing is, though, I'm not. What I have is basically this: html:form action=/admin/customer/edit.do div id=editPage tiles:insert attribute=pageBody/ /div /html:form This is used by a page like this: %@ taglib prefix=sn tagdir=/WEB-INF/tags/sn % %@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' % %@ taglib prefix=tiles uri=/WEB-INF/tld/struts-tiles.tld % %@ taglib prefix=bean uri=/WEB-INF/tld/struts-bean.tld % tiles:insert page=/WEB-INF/jsp/admin/editPage.jsp tiles:put name=pageBody type=string table width=100% border=0 cellpadding=4 cellspacing=0 sn:viewTextFieldRow property=id size=5/ sn:textFieldRow label=shop.fabric.name property=name size=40/ sn:textFieldRow label=shop.fabric.code property=code size=10/ sn:textAreaRow label=shop.fabric.description property=description rows=6/ sn:viewTextFieldRow property=createdDate size=10/ sn:viewTextFieldRow property=modifiedDate size=10/ /table sn:editButtonBar/ /tiles:put /tiles:insert The sn tags contain the html:text, etc., which is obviously where the error is being triggered. So, given that all the content is being evaluated within the body of the html:form tag, why would the html input tags not be able to find the bean? John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Obtaining size of java.util.Collection through Struts/JSTL
Make sure you include: %@ taglib uri=http://java.sun.com/jsp/jstl/functions; prefix=fn % c:out value=${fn:length(myVector)}/ /robert Greg Pelly wrote: What is the prefered way to obtain the size of elements that implement the Collection interface, such as a Vector? I would like something like: c:out value=${requestScope.myVector.size} default=/ elements exist in this Vector! But since the method is called size() and not getSize(), Struts can't handle it. Right now I am using scriptlets: % java.util.Vector v = request.getAttribute(myVector); % ...and later... P%= v.size() % elements exist in this Vector! Any advice? Greg - 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: Multibox
The multibox is bound to the selectedModule property of your form. Prior to displaying the page, populate selectedModule property of the form with its corresponding row.id values. When html:multibox .../ is invoked on the page, it will recongize the relationship and render the checkboxes as checked. /robert Ben Taylor wrote: Hi, Can anyone let me know how to automatically check checkboxes? Below is my current code: html:multibox property=selectedModules bean:write name=row property=id/ /html:multibox This is one of the many ways I've tried to get it to work: html:multibox property=selectedModules property=${row.id} {some Boolean equation} /html:multibox Cheers for you help! - 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]
[OT] ORM vs JDBC [WAS- BRANCH: Typical Struts development team and distribution of tasks?]
I've been lurking on this thread for a while and had some observations and questions. Observations: It seems like for most OLAP applications; those applications where the majority of the requirements are real-time read operations (reporting, searching, number crunching, etc... where data cannot necessarily be cached) may be best suited for a JDBC type solution as opposed to using an ORM solution. I think this is because an optimized query or stored procedure can retrieve data faster than drilling into an object graph and its respective relationships (n+1 problem). It seems like for most OLTP applications; those applications where the majority of the requirements are write operations (CRUD) are best suited for an ORM solution. This is because the SQL required for executing these operations is easily extrapolated from meta data and therefore eliminates the mundane task of having to write and maintain. Question: For those applications which are both OLAP and OLTP, then why not use both types of solutions? For example, let's say I have a master-detail type report which does a lot of number crunching and is very complex which returns rows where each row represents a record detail. Clicking on a row is a simple query returning the contents of that row to a detail page. For the report query, I may use a stored procedure or an optimized query. When I click on a row, I leverage my ORM solution retrieving the details with a primary key. It seems like this would solve both problems: 1. Use ORM to handle the simple CRUD operations. Reduce the amount of SQL which has to be hand written and maintained. 2. Use straight JDBC to handle complex/optimized data retrievals. Is this not a reasonable solution? Am I missing something? /robert Larry Meadors wrote: We eliminated lazy loading (it was creating literally thousands of queries), and replaced it with a single stored procedure that we mapped to objects with a RowHandler. No outer joins + highly optimized data access = happy users. Larry On Sun, 13 Mar 2005 08:32:58 -0500, N G [EMAIL PROTECTED] wrote: On Sun, 13 Mar 2005 06:18:36 -0700, Larry Meadors [EMAIL PROTECTED] wrote: For example, on the application I am working on, we changed a screen that accessed a large amount of data. The time to draw that screen changed from over 10 minutes (we killed it after that, and are not sure how long it would have run unchecked) to under one. In the case of smaller sets of data, we went from several minutes to sub-second responses. You mean changing the app from using Hibernate to iBatis changed the performance from 10 min to under 1 and so on? Is that correct? Why do you think there was SUCH a drastic change??? NG. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] ORM vs JDBC vs OODBMS (was [OT] ORM vs JDBC)
Leon, I have zero experience with OODBMS, so I can't comment on that. I guess my question was geared more towards RDBMS. /robert Leon Rosenberg wrote: Question: For those applications which are both OLAP and OLTP, then why not use both types of solutions? For example, let's say I have a master-detail type report which does a lot of number crunching and is very complex which returns rows where each row represents a record detail. Clicking on a row is a simple query returning the contents of that row to a detail page. For the report query, I may use a stored procedure or an optimized query. When I click on a row, I leverage my ORM solution retrieving the details with a primary key. It seems like this would solve both problems: 1. Use ORM to handle the simple CRUD operations. Reduce the amount of SQL which has to be hand written and maintained. 2. Use straight JDBC to handle complex/optimized data retrievals. Why not use OODBMS for those cases? You have JDO for simple CRUD operations, which is better, easier and faster than any ORM, and have OQL to handle compex data retrievals. Regards Leon - 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: AW: [OT] ORM vs JDBC vs OODBMS (was [OT] ORM vs JDBC)
An existing production RDBMS implementation :) /robert Leon Rosenberg wrote: Leon, I have zero experience with OODBMS, so I can't comment on that. I guess my question was geared more towards RDBMS. It was an answer :-) Do you have any real requirements which forces you to use rdbms? leon - 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: AW: AW: [OT] ORM vs JDBC vs OODBMS (was [OT] ORM vs JDBC)
Moving the implementation is out of my hands. JDO for RDBMS is an ORM solution which doesn't necessarily answer the question, why not use both (JDBC and ORM)? I think both solutions have merit and I think that many try to make one solution work for both OLAP and OLTP. /robert Leon Rosenberg wrote: And you can't move it to oodbms? Btw, there are JDO implementation for RDBMS (for example KODO JDO by Versant). Makes moving easier... leon -Ursprüngliche Nachricht- Von: Robert Taylor [mailto:[EMAIL PROTECTED] Gesendet: Sonntag, 13. März 2005 16:19 An: Struts Users Mailing List Betreff: Re: AW: [OT] ORM vs JDBC vs OODBMS (was [OT] ORM vs JDBC) An existing production RDBMS implementation :) /robert Leon Rosenberg wrote: Leon, I have zero experience with OODBMS, so I can't comment on that. I guess my question was geared more towards RDBMS. It was an answer :-) Do you have any real requirements which forces you to use rdbms? leon - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] ORM vs JDBC vs OODBMS (was [OT] ORM vs JDBC)
This solution has been discussed, but for now the expectation is real-time data. BTW, thanks for your input on this, but I don't want to hijack this thread for my own particular production issues. I wanted to propose that both ORM (Hibernate, JDO, iBatis) and straight JDBC can/should be used together when one may be better than the other, instead of trying to fit a square peg into a round hole. Don't get me wrong, I would love to use ORM all the time, but sometimes I don't think its appropriate. /robert Leon Rosenberg wrote: Moving the implementation is out of my hands. JDO for RDBMS is an ORM solution which doesn't necessarily answer the question, why not use both (JDBC and ORM)? I think both solutions have merit and I think that many try to make one solution work for both OLAP and OLTP. Ok, in this case, how about splitting the databases? Keeping OLTP part as is, and creating the OLAP part on daily (hourly or whatever) import basis as a separate DB, where you can create fast indexes, which you can't afford in the OLTP part. Or do you always need to analyse the data instantly? We once made it for a project, where the customer wanted to create new queries for statistical purposes from scratch. Like, today i'd like to know, whether the 50.000 users registered in last month were more female of male, and how many of male users came from north dakota... We created a table, which was imported every night, and contained all the information about a user, which was available in different parts of the system. So the customer was able to analyse everything, without running queries against the live-system. Regards Leon - 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: MVC Frameworks
Nicolas, Can you provide any metrics for the benchmarks when comparing Spring to AspectWorks? What exactly does not good for Spring mean? /robert Nicolas De Loof wrote: I get such a case recently : we are using Spring as IoC container. On some situation we use a simple AOP interceptor. Our customer have found on the net a benchmark comparing Spring vs AspectJ vs AspectWerkz. The bench result was not good for Spring (compared to AspectWerkz). The technical reason has no interest here, but my customer has warned us on this and expected us to make load test to confirm good application response-time (such load-tests had to be done in any case...). Here is an example why we may not use some framework or function, not because it isn't the best, but just because customer doesn't agree (for some reason that may not be technical). For info, load-tests have demonstrated Spring was good enough for us... Nico. Fogleson, Allen a écrit : I think the biggest argument was stated by Nicolas. I use struts because I like it sure, but I really use it because it is the framework that the client will accept and pay for and my developers know best. We recently used (portions) of Spring on a project and had a heck of a time getting the client to accept the app during user testing. Granted there were a bunch of other issues with this particular client that went against best practices but the major sticking point was Spring. (note we didn't even use the MVC part of spring even, just the beanfactory stuff) Struts has of course gained popular acceptance so clients really don't think much about it when you say you are using it, vs something else. Al -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 08, 2005 10:17 AM To: Justin Morgan Cc: Struts Users Mailing List Subject: Re: MVC Frameworks For my part, I still prefer Struts because I think it has a great potential if it endorses some move to IoC and does not fall off the strict web MVC pattern. I have no time for the event-based frameworks like Echo, Tapestry, JSF, Shale, etc. Others need that sort of thing. What framework you choose depends a lot on what you want to do, the sophistication of your developers, etc. Jack On Tue, 8 Mar 2005 08:44:26 -0600, Justin Morgan [EMAIL PROTECTED] wrote: Thanks... I recently picked up Rod Johnson's J2EE Design and Development (ISBN: 0-7645-4385-7), and Chapter 12 is titled Web-Tier MVC Design... I'm going to assume this chapter is pretty similar to the one you mention. I agree with you that this author is incredibly clear-minded, and I'm soaking it all in. Most of the book is model-neutral, and focuses more on good practices and patterns, which is great because we have not decided on a model yet. But in chapter 12 he only really discusses Struts, Maverick, and WebWork. I was hoping for some commentary on JSF and Tapestry as well, especially regarding why one might choose one over the other. It all boils down to two questions: 1. Why do you prefer Struts over any other web application framework? (Tapestry, JSF, Maverick, WebWork, etc) 2. Why should _I_ prefer insert framework here? The second question is not meant to make anyone defensive; I'm just trying to get past Thanks, -Justin -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 3:30 PM To: Struts Users Mailing List Subject: Re: MVC Frameworks Rod Johnson (author of Spring and one of the clearest thinkers I have ever read IMHO) has a good discussion of the options in J2EE Development without EJB in Chapter 13: Web Tier Design. Jack On Mon, 7 Mar 2005 14:19:47 -0600, Justin Morgan [EMAIL PROTECTED] wrote: Hi there, I am currently researching different web application frameworks... JSF, Struts, and Tapestry specifically. We are planning to migrate a large existing web application to a rigorous model 2 standard using one or more of these frameworks, and I am looking for more information on the differences between them. My research thus far has turned up only a few sources, and many of them seem religiously biased toward one of them. If any of you have opinions, or better yet, articles contrasting these technologies, please let me know. Thanks, -Justin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- You can lead a horse to water but you cannot make it float on its back. ~Dakota Jack~ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are
Re: Struts Approach
Tim, I think things look pretty good so far. Right now Customer is a domain object representing a customer. CustomerDAO is a DAO respsonible for mapping the Customer to its relational counterpart(s). CustomerService collaborates with CustomerDAO to manage the persistence and data access of a Customer. Together these 3 classes make up what I would refer to as a CustomerComponent. This simple component can be used in any of your applications that interact with a customer and need simple Customer CRUD (create, retrieve, update, and delete) services. I would caution you against adding any application specific logic to this component as it would reduce the reusability of it in other applications which you may develop which may need to use the same component. I'm assuming right now your application logic mirrors the services provided by the CustomerService; simple CRUD operations. Now let's say you have some additional requirements such as: - When a customer is created, notify operations. - When a customer is deleted, notify operations. - Find all the customer's who have placed orders within a specified date range. You might be tempted to add this functionality to CustomerService and add the supporting functionality to CustomerDAO and Customer. Now let's say you need to develop another application which needs simple CRUD functionality for a Customer. Ooops. You can't use CustomerService. I have found that an additional application service layer provides the flexibility to add application specific logic leveraging a library of components instead of modifying them. For example, you might want to add a CustomerApplicationService which leverages the services provided by CustomerService. So for the example provided above, the CustomerApplicationService may collaborate with event listeners which respond appropriately to creating and deleting a customer. It may also collaborate with specialized DAO for retrieveing customer's using application logic criteria. It may also collaborate with value object assemblers to build value objects which cannot simply be represented by a single Customer. My point is that the additional layer provides a layer of abstraction which decouples the domain components from application specific logic which allows you to leverage your investments in these domain components, instead of modifying them to support additional application requirements. Don't forget that CustomerApplicationService should be an interface such that it can be implemented as a POJO (plain old java object) or maybe a delegate which hides a remote implementation. /robert Tim Christopher wrote: Hi, I'm currently designing a web application and as time progresses I keep on less convinced that my approach is correct. Applying what I have to a shop example the classes I have are: -- * Note: I use the iBATIS framework. -- Customer.java # Contains get + set methods using correct types, ie. name (String), age (int), etc. CustomerDAO.java # An interface for database operations for the Customer, i.e. insertCustomer, updateCustomer, etc. CustomerSqlMapDAO.java # Implements the CustomerDAO interface and effectively calls the db. CustomerService.java # Used to gain access to CustomerDAO and CustomerSqlMapDAO. CustomerDispatchAction.java (ex insert method - but will contain CRUD) # Gets instance of CustomerService; copies jsp form details into a DynaActionForm; copy form DynaActionForm to Customer.java object; calls insert method in CustomerService with Customer object as the parameter; return ActionForward. Struts-Config.xml # Contains DynaValidatorForm for storing customer details. -- -- I've tried looking through a few books and using Google for information that would explain if this is the correct approach, but all the tutorials I can find only show examples of projects that are very small. I'm now at the stage in my project where I think I still have time to change the design if I do it in the next couple of days - otherwise I'm stuck with the approach I'm using above. I think the closest I've come to finding anything is here: http://java.sun.com/blueprints/corej2eepatterns/Patterns/ ... Though to be honest I don't really understand it. Can someone take a look at my previous example and suggest any extra classes I should be using. Also it would be useful if you could let me know how the existing files link up to being: DAOs, DTOs, Value Objects (same of DTO?!), and business classes. I think I'm a little confused! :os Any help would be appreciated. Tim Christopher - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Approach
So, this additional layer, in a Struts application, resides between the Struts classes (Actions) and your managerial facade? The Action instantiates/looks up a CustomerApplicationServiceImpl, which does CRUD via the CustomerService component but also manages (possibly by itself, possibly by delegation) app-specific notification logic, high-level view helper logic, etc. Is this correct? Yes. The application service becomes the core of the application specific logic. As such, it is the most volatile. Once the domain components (domain object, dao, and manager) are created to perform operations which are relative to their respective domain, then they shouldn't change much and essentially become a library of reusable components. Contrary to an application service which are subject to the whim of the business contraints. Effectively then, this layer decouples the managerial layer from, not Struts per se (though it does indirectly), but, from your implementation strategy (whether you use passive/active notification, how you filter read results, etc.) with respect to the business rules. Right? Yes. As mentioned above. Just to clarify, I consider the managerial layer to manage the domain component (domain object and its respective dao). If the implementation strategy refers to the implementation of the application specific logic, then yes. This strategy mainly falls out of my own experience with doing just what I cautioned against. I started developing domain objects using an ActiveRecord (see Martin Fowler) design pattern and then each time a new application requirement was added, I ended up adding a static method to my domain object. After a while my domain object was doing things wa out of its domain and consequentially not as reusable. I have found this to be a common pitfall in application development; especially as the application goes from simple to complex and critical. After some research (reading Core J2EE Patterns, Rod Johnson, etc...) and lots of refactoring, I started using the strategy I just described and have found the applications have been more scalable and most of the changes tend to be isolated in the application service layer. /robert Erik Weber wrote: Robert Taylor wrote: Tim, I think things look pretty good so far. Right now Customer is a domain object representing a customer. CustomerDAO is a DAO respsonible for mapping the Customer to its relational counterpart(s). CustomerService collaborates with CustomerDAO to manage the persistence and data access of a Customer. Together these 3 classes make up what I would refer to as a CustomerComponent. This simple component can be used in any of your applications that interact with a customer and need simple Customer CRUD (create, retrieve, update, and delete) services. I would caution you against adding any application specific logic to this component as it would reduce the reusability of it in other applications which you may develop which may need to use the same component. I'm assuming right now your application logic mirrors the services provided by the CustomerService; simple CRUD operations. Now let's say you have some additional requirements such as: - When a customer is created, notify operations. - When a customer is deleted, notify operations. - Find all the customer's who have placed orders within a specified date range. You might be tempted to add this functionality to CustomerService and add the supporting functionality to CustomerDAO and Customer. Now let's say you need to develop another application which needs simple CRUD functionality for a Customer. Ooops. You can't use CustomerService. I have found that an additional application service layer provides the flexibility to add application specific logic leveraging a library of components instead of modifying them. For example, you might want to add a CustomerApplicationService which leverages the services provided by CustomerService. So for the example provided above, the CustomerApplicationService may collaborate with event listeners which respond appropriately to creating and deleting a customer. It may also collaborate with specialized DAO for retrieveing customer's using application logic criteria. It may also collaborate with value object assemblers to build value objects which cannot simply be represented by a single Customer. My point is that the additional layer provides a layer of abstraction which decouples the domain components from application specific logic which allows you to leverage your investments in these domain components, instead of modifying them to support additional application requirements. So, this additional layer, in a Struts application, resides between the Struts classes (Actions) and your managerial facade? The Action instantiates/looks up a CustomerApplicationServiceImpl, which does CRUD via the CustomerService component but also manages (possibly by itself, possibly
Re: Struts or SpringFramework
Kris, as others have already mentioned, you can use Struts and Spring together. Since you have four years of Struts you can leverage that knowlege in the presentation layer and use Spring for a light-weight container in the business/integration tier allowing it to provide services such as declarative transaction and dependency injection. Spring comes with built in support for Hibernate and JDBC. It has a terrific built in API for working with various persistence solutions. Spring allows you to wire up dependencies between those objects which collaborate with one another within a configuration file. These dependencies are established at application start up time so that your objects are all ready to go when they are invoked. Spring also provides the ability to declaratively define objects as singletons or as prototypes (non-singletons). The thing that impressed me the most was that it is non-intrusive. Your objects don't have to extend or implement any special interfaces to work with Spring (although they can implement certain Spring life cycle interfaces if they want to). To learn more about how to use Spring, you might want to download the Spring reference manual. Its easy to read and understand and will give you some great insight into those features it provides. http://www.springframework.org/docs/reference/index.html Good luck. /robert Eric Chow wrote: Hello, I have used Struts for four years. And I am evaluating SpinrgFramework. Anybody can give me some suggestions on them ?? Eric - 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: Interating through a Map [ which has DTO in the values ] using l ogic:iterate
It may be better to create a value object containing the Dept DTO and its respective collection of EmpDetails DTO. Then you don't have to jump through hoops when using Maps. logic:iterate id=element name=formName property=depts br / bean:write name=element property=dept.deptNo/ bean:write name=element property=dept.deptName/ logic:iterate id=empElement name=element property=employees br /nbsp;nbsp;nbsp;nbsp; bean:write name=empElement property=name/ bean:write name=empElement property=email/ /logic:iterate /logic:iterate /robert Sachin Bhutada wrote: hi, I have a HashMap which has Key and Value both as DTOs Key contains Dept DTO (Dept has Dept No, Dept Name) Value contains Collection of EmpDetails DTO (It has Name, Email-Id, etc information) In the jsp page I want to iterate through this Map using logic iterate tag so that outpage html page should look like this.. Dept No : Dept Name Emp One [EMAIL PROTECTED] . Emp Two [EMAIL PROTECTED] . and so on Dept No 3 : Dept Name 3 Emp One [EMAIL PROTECTED] . Emp Two [EMAIL PROTECTED] . and so on ... To achieve this, I have written following code. For the time being I am just concetrating on displaying the Department Details.. logic:iterate id=element name=formName property=deptHashMap br/ bean:write name=element property=key/ -- IT displayes the Dept object name When I try to use following code it shows error message javax.servlet.jsp.JspException: No getter method for property key.deptNo of bean element bean:write name=element property=key.deptNo/ /logic:iterate In my actionform class I have haspmap and getter and setter methods. How should I display deptNo and deptName in the Dept DTO ? Thanks in Advance Sachin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: showing data
Have a look at DisplayTag http://sourceforge.net/projects/displaytag/ /robert Rafael Taboada wrote: Hi guys. I'm developing a web site using struts. I want to know if there is a tool that help me showing data, i mean, i have a database where there is a table user. I have a query with a set of records about this table and i want to show in a table. But I want to know if there is a tool like STRUTS-MENU. This tool help me in menu but what about showing a set of records?. Is there a tool like that?. I want to solve my pagination problem, because i'd like to show my data 10 by 10, like google results. thanks for ur help - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[testing] Please ignore
Testing. Please ignore. I'm having some problems posting messages from work. /robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaActionForm problem (newbie probably :)
If the Converters are valid across the entire application, you can register them using a ServletContextListener or a Struts Plugin. ServletContextListeners are only available for containers supporting the Servlet 2.3 spec or higher. /robert Robin Ericsson wrote: Robert Taylor wrote: The reason for the error is that the beanutils package cannot convert the date string into a Date object. You can either populate the form with the formatted date or register a Converter to handle the conversion appropriately. I haven't yet used Converter but this problem has been answer many times over on the list. This link may help: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg45982.html Thanks, that fixed my problem. A counter question to the link though, is there a good way to register Converters at startup? Now I just took an Action that I know gets displayed before so they truly are register but is there a Struts way of doing or maybe a Java way? regards, Robin - 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: DynaActionForm problem (newbie probably :)
The reason for the error is that the beanutils package cannot convert the date string into a Date object. You can either populate the form with the formatted date or register a Converter to handle the conversion appropriately. I haven't yet used Converter but this problem has been answer many times over on the list. This link may help: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg45982.html /robert Robin Ericsson wrote: Hi, This is my form: form-bean name=daysForm type=org.apache.struts.action.DynaActionForm form-property name=days type=mypackage.MyClass[]/ /form-bean This is how I populate it: List days = new ArrayList(); --fill list-- form.set(days, (MyClass[]) days.toArray(new MyClass[days.size()])); This is my jsp-code: html:form action=/days-submit logic:iterate id=days name=daysForm property=days bean:write format=dd/M name=days property=day / html:text name=days property=entered indexed=true / br / /logic:iterate html:submit accesskey=s value=Save... (Alt+s) / /html:form The generated html seems correct as it finds the actual data in the MyClass property. input type=text name=days[0].startTime value=08:00:00 / However, when I post the form, I get an IllegalArgumentException: java.lang.IllegalArgumentException: argument type mismatch sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789) org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684) org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713) org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019) org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493) org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:796) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:430) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75) startTime is of type java.util.Date with respective getter and setter. Any ideas what I've done wrong? regards, Robin - 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: ActionForm with ArrayList - Validation Problem
This is a common and well documented idiom, but can be hard to find in the archives ;) The problem is that to display the form with the select list, you have to prepare the select list before displaying the page. When the user submits the form and validation fails, Struts will forward to the input attribute value in the action mapping. If this value is the .jsp instead of the action url which prepares the .jsp, you get the behavior you describe below. One solution, is to assign the input attribute value to be the preparation action for the page. Another solutions is to place your form in the session and override the form reset() so that your customer list isn't wiped out when you submit the request. Another solution is if your customer list is unique to the user and doesn't change, populate the list and place it in the session when the user logs in and don't put it in the action form at all. Another solution is if your customer list is static and global to all users, populate the customer list on application start up (ServletContextListener or Struts plugin) and place it in the ServletContext as an attribute. hth, /robert Bernard Willemot wrote: Hi, Not sure it is the best practice... I have a for to edit a user called UserForm. This form contains a popup (select) with Customers. I didn¹t find an easier way to include the data of the popup in the UserForm: Public class UserForm extends ActionForm { protected ArrayList customer_popup; public ArrayList getCustomerPopup() { return this.customer_popup; } public void setCustomerPopup(ArrayList customer_popup) { this.customer_popup = customer_popup; } } So before editing the user and while building the form, I build the form and fill the ArrayList with the customers as well. So far so good that works, but if I use validation, and the page with the form needs be reloading to tell me what went wrong, I have the problem that struts doesn¹t find the arraylist in the form anymore: javax.servlet.ServletException: ServletException in '/setup/users/edit_user_data.jsp': Failed to obtain specified collection In the jsp, I use: html:select property='customerId' html:optionsCollection property='customerPopup' label='name' value='id' / /html:select If I remove it, it works fine. Using struts 1.2.4 with TC 5.5. Any idea? Thank you, BW. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[Fwd: Re: ActionForm with ArrayList - Validation Problem]
This was a reply directly to me which I'm forwarding to the list so future users can leverage the solutions provided in this message. original message --- Robert, It is hard to find in the archives, but while I was reading the other messages posted lately I found someone having the same problem and he was redirected to http://www.reumann.net/struts/articles/request_lists.jsp which is exactly what you are explaining me... I guess I'll change the scope to session - which is probably the easiest way to go for me for now. Hopefully that's not creating other problems... Struts is a very nice technology, but there is so much to know and to search... Great list! And nice people always willing to help. Thanks, BW. On 1/20/05 2:23 AM, Robert Taylor [EMAIL PROTECTED] wrote: This is a common and well documented idiom, but can be hard to find in the archives ;) The problem is that to display the form with the select list, you have to prepare the select list before displaying the page. When the user submits the form and validation fails, Struts will forward to the input attribute value in the action mapping. If this value is the .jsp instead of the action url which prepares the .jsp, you get the behavior you describe below. One solution, is to assign the input attribute value to be the preparation action for the page. Another solutions is to place your form in the session and override the form reset() so that your customer list isn't wiped out when you submit the request. Another solution is if your customer list is unique to the user and doesn't change, populate the list and place it in the session when the user logs in and don't put it in the action form at all. Another solution is if your customer list is static and global to all users, populate the customer list on application start up (ServletContextListener or Struts plugin) and place it in the ServletContext as an attribute. hth, /robert Bernard Willemot wrote: Hi, Not sure it is the best practice... I have a for to edit a user called UserForm. This form contains a popup (select) with Customers. I didn¹t find an easier way to include the data of the popup in the UserForm: Public class UserForm extends ActionForm { protected ArrayList customer_popup; public ArrayList getCustomerPopup() { return this.customer_popup; } public void setCustomerPopup(ArrayList customer_popup) { this.customer_popup = customer_popup; } } So before editing the user and while building the form, I build the form and fill the ArrayList with the customers as well. So far so good that works, but if I use validation, and the page with the form needs be reloading to tell me what went wrong, I have the problem that struts doesn¹t find the arraylist in the form anymore: javax.servlet.ServletException: ServletException in '/setup/users/edit_user_data.jsp': Failed to obtain specified collection In the jsp, I use: html:select property='customerId' html:optionsCollection property='customerPopup' label='name' value='id' / /html:select If I remove it, it works fine. Using struts 1.2.4 with TC 5.5. Any idea? Thank you, BW. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to use logic:iterate with DynaValidatorForm
Struts has built in support for DynaBeans. logic:iterate id=account name=editBUForm property=account ... /logic:iterate /robert --- [EMAIL PROTECTED] wrote: - struts-config.xml form-beans form-bean name=editBUForm type=org.apache.struts.validator.DynaValidatorForm form-property name=account type=com.psca.M28000.bo.Account[]/ /form-bean /form-beans action-mappings action name=editBUForm path=/EditBUOnLoadAction scope=session type=com.psca.M28000.action.EditBUOnLoadAction validate=false forward name=ok path=/frmEditBU.jsp/ /action action name=editBUForm path=/EditBUOnSubmitAction input=/frmEditBU.jsp scope=session type=com.psca.M28000.action.EditBUOnSubmitAction validate=true/ /action-mappings - EditBUOnLoadAction.java DynaValidatorForm df = (DynaValidatorForm) form; Set acc = bu.getAccounts(); Account[] account = new Account[acc.size()]; int i = 0; for(Iterator ite = acc.iterator(); ite.hasNext(); i++) { account[i] = (Account)ite.next(); } df.set(account, account); - jsp page logic:iterate id=account name=editBUForm.map.Account tr td align=center style=border-left:1px #8FA8CC solid bean:write name=account property=accCode scope=page/ /td td style=border-left:1px #8FA8CC solid; padding-left:2px bean:write name=account property=createdDt scope=page/ /td /tr /logic:iterate When I run the jsp page, I receive error Cannot find bean editBUForm.map.Account in any scope Could you show me how to use logic:iterate to loop through Account[] of form. I saw an example using standard taglib to do that html:form action=/processActorComments table border=1 width=80% trthLast Name/ththFirst Name/ththDate of Birth/ththComment/th/tr c:forEach var=people items=${dynamicArrayForm.map.people} trtdc:out value=${people.lastName}//td tdc:out value=${people.firstName}//td tdc:out value=${people.dateOfBirth}//td tdhtml:text name=people indexed=true property=comment//td /tr /c:forEach /table P/ html:submit value=Update Comments/ /html:form But I am using servlet 2.2, so that I cannot use standard taglib. Any help is much appreciated. Regards, Dang Minh Phuong - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Dress up your holiday email, Hollywood style. Learn more. http://celebrity.mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Nightly builds after 12/20 are empty
Apologies if this has already been discussed, but I just attempted getting the most current nightly build from here: http://svn.apache.org/builds/struts/nightly/struts-20041222.zip And its an empty file. Also I get an Internal Server Error when trying to get the current GA release from here: http://struts.apache.org/download.cgi /robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts tags / JSTL question
Vinicius Caldeira Carvalho wrote: Hi there! I have a collection of beans, and this collection is set to the request. I'd like to retreive only the first object of the collection (later on I'll iterate over it completely) How can I do this? My Collection is a List. I tried c:set var=bean value=${collection.get(0)} and also c:set var=bean value={$collection.iterator.next} none of 'em seems to work. Any ideas? Thanks all - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] You can try the following although it may not work: c:forEach var=bean items=collection begin=0 end=0 ... /c:forEach /robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cross web app communication
You cannot forward to another web application. You can, however, redirect. You set the redirect attribute of the forward tag to true. robert -Original Message- From: avinash_shirol [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 4:17 AM To: [EMAIL PROTECTED] Subject: Cross web app communication Hi, I have following questions 1. I have two web applications deployed on different m/c. When I login to one web application, I would like to view a page provided by the other application. Basically, redirecting a user to a different web application. Is this possible? If so, how? 2. I tried to provide a http url(google url) with absolute path in the forward tag of struts-config.xml. I kept getting error message Request Dispatcher not found for http://www.google.com; in spite of mentioning relativeLocation=false. Can't we give absolute pathnames in the path field in struts config? -Avinash - 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: Cross web app communication
Not really an observation, but more of how the Servlet specification constrains the use of forwarding to another resource. Forwarding is accomplished by using the RequestDispatcher.forward(). You can access a RequestDispatcher by calling Request.getRequestDispatcher() passing it the path name of a resource which is relative to the current servlet context. A redirect sends a status code back to the browser along with the url to which you wish to be redirected. The url may be relative to the same web app or a fully qualified url to a different resource. When you set the redirect attribute of the forward tag to true, then Struts will use Response.sendRedirect() to redirect the request to the specified resource which could be the same web app or a different web app. /robert -Original Message- From: Dakota Jack [mailto:[EMAIL PROTECTED] Sent: Sunday, December 12, 2004 2:02 PM To: Struts Users Mailing List Subject: Re: Cross web app communication Out of interest, Robert, would you mind expanding on this if you have more detailed observations that you could offer? Thanks. Jack On Sun, 12 Dec 2004 09:45:13 -0500, Robert Taylor [EMAIL PROTECTED] wrote: You cannot forward to another web application. You can, however, redirect. You set the redirect attribute of the forward tag to true. robert -Original Message- From: avinash_shirol [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 07, 2004 4:17 AM To: [EMAIL PROTECTED] Subject: Cross web app communication Hi, I have following questions 1. I have two web applications deployed on different m/c. When I login to one web application, I would like to view a page provided by the other application. Basically, redirecting a user to a different web application. Is this possible? If so, how? 2. I tried to provide a http url(google url) with absolute path in the forward tag of struts-config.xml. I kept getting error message Request Dispatcher not found for http://www.google.com; in spite of mentioning relativeLocation=false. Can't we give absolute pathnames in the path field in struts config? -Avinash - 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] -- You can't wake a person who is pretending to be asleep. ~Native Proverb~ Each man is good in His sight. It is not necessary for eagles to be crows. ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ - 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: org.apache.commons.digester.Digester (ERROR) - Parse Error
Looks like your tiles configuration file may be hosed or your DTD and configuration file are out of sync. robert -Original Message- From: David McReynolds [mailto:[EMAIL PROTECTED] Sent: Friday, December 10, 2004 9:50 AM To: Struts User List Subject: org.apache.commons.digester.Digester (ERROR) - Parse Error I am having a hard time figuring out which files struts is talking about in these errors that happen during startup. Everything runs fine. Here are a few stack trace snippets. I get multiples of these three. [App=LS][Dec-10 09:41:16:648] org.apache.commons.digester.Digester (ERROR) - Parse Error at line 47 column 63: Line 47, Column 63: XML-0138: (Error) REQUIRED attribute 'link' is not specified. org.xml.sax.SAXParseException: Line 47, Column 63: XML-0138: (Error) REQUIRED attribute 'link' is not specified. at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:226) at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:162) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:276) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149) [App=LS][Dec-10 09:41:16:945] org.apache.commons.digester.Digester (ERROR) - Parse Error at line 149 column 19: Line 149, Column 19: XML-0148: (Error) Invalid element 'tiles:put' in content of 'definition', expected elements '[icon, display-name, descri ption, put, putList]'. org.xml.sax.SAXParseException: Line 149, Column 19: XML-0148: (Error) Invalid element 'tiles:put' in content of 'definition', expected elements '[icon, display-name, description, put, putList]'. at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:226) at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:162) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:276) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149) at org.apache.commons.digester.Digester.parse(Digester.java:1567) [App=LS][Dec-10 09:41:16:992] org.apache.commons.digester.Digester (ERROR) - Parse Error at line 149 column 24: Line 149, Column 24: XML-0137: (Error) Attribute 'name' used but not declared. org.xml.sax.SAXParseException: Line 149, Column 24: XML-0137: (Error) Attribute 'name' used but not declared. at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:226) at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:162) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:276) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149) at org.apache.commons.digester.Digester.parse(Digester.java:1567) - 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: Multibox DynaActionForm
You will need to set the selectedCompanies in the ActionForm so that the html:multibox .../ can determine which companies have been selected by comparing the company id against the selected company id. If allCompanies does not change per user, you may want to place that in the ServletContext on application startup to avoid the database hit everytime that action is executed. robert -Original Message- From: Jaakko Rytinki [mailto:[EMAIL PROTECTED] Sent: Thursday, December 09, 2004 9:14 AM To: Struts Users Mailing List Subject: Multibox DynaActionForm How I can prepopulate a form containing a multibox when using DynaActionForms? The following code doesn't seem to work - it wont check any checkboxes (why?) --- Action which prepopulates the form: --- String[] companies = MyDBTools.getUser(userId).getCompanies(); ArrayList allCompanies = MyDBTools.getAllCompanies(); _request.setAttribute(selectedCompanies, companies); _request.setAttribute(allCompanies, allCompanies ); --- Form --- logic:iterate id=company name=allCompanies html:multibox property=selectedCompanies bean:write name=company property=id/ /html:multibox bean:write name=company property=name/ br /logic:iterate --- Form-bean --- form-bean name=forms.myForm type=org.apache.struts.validator.DynaValidatorForm form-property name=selectedCompanies type=java.lang.String[] / /form-bean - 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: ActionForm validate and redirect
I did this by subclassing the RequestProcessor and modifying processValidate(). I place a value in the request which indicates the current url and don't define an input attribute for the action mappings that need this dynamic input functionality. In processValidate() if mapping.getInput() == null, then I look for my current url parameter and use that if it exists. robert -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Ilja Smoli Sent: Friday, December 03, 2004 9:33 AM To: [EMAIL PROTECTED] Subject: ActionForm validate and redirect Hi I use validate method in one of my ActionForms, after validation is fail, method redirects browser to wahatever is set in struts-config.xml under input attribut... I faced problem that i need this value to be dynamic. (I want to redirect a user to same page from where form has been submitted but with error messages. And this page has query paramters :( ) Trying to call actionMapping.setInput() gives exception...(Frozen config) So seems to be ActionForm validating is not so flexible and cool :-)? Or maybe application must use static pages where forms are located? Of course I can do validation in action and achieve needed result Opinion of experts? Ilja. - 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: MVC initialization
A standardized approach would be to implement a ServletContextListener and define it in your web.xml for the web app. It will be invoked before the web app accepts any requests and when the web app is shutdown. A more Struts approach would be to use a PlugIn and define it in your struts-config.xml file. Both of these methods provide you with bootstrapping your web app. robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 5:43 PM To: Struts Users Mailing List Subject: MVC initialization I know this is a bit off topic, but I figured I could get a better answer here. I am using Tomcat 4.1 and the latest production build for Struts in an MVC setup and have a large application already in production on the web. I need to enhance the model, but this enhancement will require me to have individual products/services register their interfaces with a common model hashmap. I would like this initialization to be done once at startup, but I am not sure where would be appropriate or where to do this. I don't need to include any properties files or anything, just need to do some initial setup and thought that static blocks for each service might be a bad route? What might be a good approach for this that people who do MVC use? I know it is a bit off topic, but though you might have ideas. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to retrieve parameters passed via GET method?
The accountId value is in the query string of the request and therefore must be retrieved like: String accountIdValue = request.getParameter(accountId); robert -Original Message- From: Shih-gian Lee [mailto:[EMAIL PROTECTED] Sent: Sunday, November 28, 2004 7:24 PM To: Struts Users Mailing List Subject: Re: How to retrieve parameters passed via GET method? In my Struts configuration file, an action element is defined as the following: actionpath=/closeAccount type=org.apache.struts.actions.ForwardAction parameter=/closeAccount.jsp / When customer clicks on the hyperlink, ActionServlet receives the HTTP request, pre-processes it and forwards it to ForwardAction, who will simply forward the request to closeAccount.jsp. That page then asks customer to confirm the operation (are you sure that you want to close account No. 100?). The problem is, ActionServlet seems to have modified the request, so in my closeAccount.jsp, i cannot retrieve the accountId parameter: request.getAttribute(accountId) returns null. I dumped the contents in the HTTP request that closeAccount.jsp receives. They look like this: javax.servlet.forward.request_uri = /badba/closeAccount.do javax.servlet.forward.context_path = /badba javax.servlet.forward.servlet_path = /closeAccount.do javax.servlet.forward.query_string = accountId=100 org.apache.struts.action.mapping.instance = ActionConfig[path=/closeAccount,parameter=/closeAccount.jsp,scope=session,type=org.apache.struts.actions.ForwardAction org.apache.struts.action.MODULE = [EMAIL PROTECTED] Is it possible that the accountId is saved in session scope instead of request scope? You need to specify the scope if you want to save it in request scope: action path=/closeAccount type=org.apache.struts.actions.ForwardAction parameter=/closeAccount.jsp scope=request/ HTH. Lee - 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: dynabean and jstl
JSTL is not DynaBean-aware but can work with Maps. However, you can use DynaForms because they implement a getMap() which you can then use with JSTL as such: c:out value=${myDynaForm.map.property}/ robert -Original Message- From: Mario Nee [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 23, 2004 9:20 AM To: [EMAIL PROTECTED] Subject: dynabean and jstl Hello, can i use dynabean inside a jsp using jstl ? i'm using struts 1.2.4 - 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: action to action with form
You shouldn't be calling an Action from an Action. Action chaining is not recommended and is considered poor practice. Action classes are an implementation of Command pattern and as such should delegate to reusable business components. I would refactor your business logic embedded in Action classes into business components or application services. You can then call these from any Action class and they will be easier to unit test. If you want Struts to provide the ActionForm for each action then you must bind the ActionForm to the Action class in the action mapping. So if Actions, A, B, and C all need ActionFormC then you will have to define this in the struts-config.xml file. One way of maintaining state across actions is to place the ActionForm in session scope. robert -Original Message- From: Raffe Paffe [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 7:18 AM To: [EMAIL PROTECTED] Subject: action to action with form Hi I have a system with some action classes that i need to call from my action class. I do not have the source code of the action classes that needs to be called and I can not change them but I know how the actionform is suppose to look and I want to this serverside. So, I have actioclass A and I want to call action class B witch needs actionform C. I will use the mappings to chain the response from B to my first action class A. Can I do this and if yes, how? Can I create actionform C and chain it somehow? Code examples woulde be great. Thanks Ralf Good judgement comes from experience, and experience comes from bad judgement. _ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ - 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: no web application configured
Need a little more information here... Is this a Struts question? Is this a general web application question? Is this a Tomcat question? Is this an application server question? robert -Original Message- From: Nishant [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 7:33 AM To: 'Struts Users Mailing List' Subject: no web application configured hi to all, i am getting an errors as There is no web application configured to service your request while acessing my index page... with this error index page is also coming... thus i am confused from where this error is coming .. Regards Nishant Patil Software Engineer Cybage Softwares Pvt. Ltd. (A CMM Level 3 Company) West Avenue, Kalyaninagar Pune - 411006 Ph. +91-20-4044700/4041700 Extn 355 [EMAIL PROTECTED] www.cybage.com There is difference between knowing the Path and walking on the Path - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Prepopulate a DynaForm
You need to use the form which is passed in from the execute() method signature. DynaForm dForm = (DynaForm) form; dForm.set(author, test); return mapping.findForward(success); This assumes you are using the same form for your setup and processing action and you are forwarding to the page which renders the form. robert -Original Message- From: Alexander Czernay [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 17, 2004 6:22 AM To: Struts Users Mailing List Subject: Prepopulate a DynaForm I'm trying to prepopulate a DynaForm with some values - right now just hard-coded, later should be taken from a DB. For that I'm using a SetupAction, that is called to prepopulate the form, insert it into the request and after that forward to the actual action for presenting the form to the user. Looks like this: public class MediaArchiveSetupAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){ ActionServlet servlet = this.getServlet(); MediaArchiveForm mediaArchiveForm = new MediaArchiveForm(); mediaArchiveForm.setServlet(this.getServlet()); MessageResources messageResources = servlet.getInternal(); mediaArchiveForm.set(author, test); // TODO: check why this doesn't work request.setAttribute(mediaArchiveForm, mediaArchiveForm); // this does actually work request.setAttribute(test, dummy); return (mapping.findForward(success)); } } Using this approach I always get a null pointer exception, leading me to the presumption that the actual form-object isn't built. Any ideas why? Thanks for any help, Alexander - 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: talking about paradigms
+1. I have to agree with Daniel. JSTL has allowed me to move a lot of view formatting code outside of my page prep tasks. In J2EE, .jsp pages are ViewComponents and custom tags are ViewHelpers. I think that JSTL gives you enought rope to hang yourself with as well, especially with the sql: ../. But I understand the business/marketing motivation behind them...CFML competition. I mean, look at CFML applications, the use of the database access ViewHelper is pervasive. But their business model is to enable page authors to easily create business applications using a tag based model. I'm sure many of you already are aware that there are large numbers of enterprise applications written entirely in CFML. Personally, I would never want to develop nor maintain such applications. Anyhow, I digress... I think the point is that the ViewHelpers used with regard for best practices help move view logic into the ViewComponents and out of the controller and that disciplined use of such technologies can provide better architectural separation. robert -Original Message- From: Daniel Perry [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 9:14 AM To: Struts Users Mailing List Subject: RE: talking about paradigms I think the idea that MVC architecture should have a 'dumb view' is totally wrong. The view should be as smart as possible. MVC should separate the M, V and C. With a really smart view you dont have to do any preparation for the view in the controller. If you have a dumb view then you have to prepare the data in the model/controller so that the view can cope with it. Surely this is wrong as you are doing view processing outside of the view. Personally i think ALL view processing should be done in the view: the view code (be it jsps, java, xml/xsl, etc) should take model data, and produce a view of that data - and it should be flexible. The problem with a smarter (or better worded: more capable) view is that people start doing things in the view which shouldnt be done there, such as database access. I dont think this is down to a problem with the view technology, just a lack of education on the users part. Arguing that the view should dumbed down to stop this problem arising is like saying that cars should only be able to do 70mph because that's all they can legally do. For example, a poject i am responsible has a lot of code in the model beans that was put there pre jstl for formatting things like dates, or text. So you have getStartDate() which returns a date, and getFormattedStartDate() which returns a formatted string. This code should be in the view as it is purely for view purposes, but i made the decision to bodge it into the model as it was nicer than using java code in the jsps. There are various other methods - such as retrieving chunks of text with \n into br, which can now mostly be handled with jstl. Daniel. -Original Message- From: Rosenberg, Leon [mailto:[EMAIL PROTECTED] Sent: 15 November 2004 13:44 To: Struts Users Mailing List Subject: AW: talking about paradigms No, but what about c:out value=${library.books[25].page[5].title} / ? (not sure about the syntax). whats the problem? MVC usually allows 'read-only access to model' for the view Also the question is, what you expose to the view. If you are afraid that somebody will misuse the library entries - don't expose them. I suppose MVC was the reason for JSP EL not to allow arbitrary method invocations. But I'd love to have such anyway ;) ... And what about database access tags? You mean the jstl tags? They are there for quick and dirty. If you don't change anything in the database though, it still okay to MVC. If you don't want it, don't expose your database in the first place ;) The problem is, that if you give a user the possibility to misuse your framework - he will. And EL gives jsps more power than a dumb view should have. And if your view isn't just layouting out the data, but performing nearly complex operations, it's not dumb anymore, and a smart view doesn't fit into the MVC. If the user is allowed to break the paradigm he will. If you have an architecture, which is built on a paradigm (and any good architecture is) you can't allow the developers to break the paradigm, or the architecture will stop working one day, without obvious reasons. It's probably why there are no pointers in java, even pointers adds cool features to the language. Regards Leon - 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: Use JSTL with html:multibox tag
Andy, try this: c:forEach var=service items=${services} varStatus=status TR TDc:out value=${service.name}//TD TDhtml:multibox property=selectedServices[${status.index}]c:out value=${service.status}//html:multibox/TD /TR /c:forEach If the selectedServices is an array of Strings in your form, and service.status == selectedServices[n], then the the checkbox should be checked or atleast the tag should render the appropriate HTML such that the checkbox should be checked. I believe the problem is that the selectedServices is an indexed property. If your container support JSP2.0 spec, then the above should work. If not, then you will have to use the equivalent Struts-EL tag. I think you see most examples using logic:iterate .../ because it supports and indexed hook into indexed tags by setting its indexed attribute to true. But the whole indexed property thing is hard to get your head around. This link may give you some more insight. http://struts.apache.org/faqs/indexedprops.html hth robert BTW, the above code has not been tested. If your selectedServices array is not the same length as your services ArrayList, then things are going to get ugly. -Original Message- From: andy wix [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 9:34 AM To: [EMAIL PROTECTED] Subject: Use JSTL with html:multibox tag Hi, All the examples I've seen of using the above tag use the logic:iterate tag to output to the page. Does anyone have an example of how to this with JSTL? My attempt is: c:forEach var=service items=${services} varStatus=status TR TDc:out value=${service.name}//TD TDhtml:multibox value=${service.status}property=selectedServices/html:multibox/TD /TR /c:forEach where services is an ArrayList in session with all available services and selectedServices is the array of Strings in my form class. The above displays all the values in services correctly but doesn't exhibit any interaction between the checkboxes on the page and the selectedServices array. Thanks, Andy _ Get ready for school! Find articles, homework help and more in the Back to School Guide! http://special.msn.com/network/04backtoschool.armx - 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: Use JSTL with html:multibox tag
Yep. Scratch the indexed properties comment. On each iteration, Struts will iterate over the selectedServices comparing the selectedServices value to the service.status value. If it finds a match, then it will render the checkbox as checked. So, the fact that the data structures are not the same size isn't a factor. In Rick's example, he compares String to String. You may be able to compare int to String or boolean to String because I think BeanUtils performs simple conversions for you, but byte to String... I don't know. robert -Original Message- From: andy wix [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 12:59 PM To: [EMAIL PROTECTED] Subject: RE: Use JSTL with html:multibox tag Hi, Thanks for the input Robert, but the array will be shorter than the arraylist whenever a checkbox is not selected. I've had a look at Rick Reumann's Struttin with Struts lesson 3 which does something similar and now have: c:forEach var=service items=${services} varStatus=status TR TDc:out value=${service.name}//TD TD html:multibox name=serviceForm property=selectedServicesc:out value=${service.status}/ /TD /TR /c:forEach This is a step in the right direction but still doesn't work (the checkboxes aren't checked when viewing the page even though they should be set). The service.status field in the service class is a byte - does this have to be a String? Cheers Andy _ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger - 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: Can't find property -- but it's there
Just a guess Tim, but is it possible that the ClassLoader used on the development server and the ClassLoader used locally are loading different versions of SeasAdjData? Was the getSeasAdjs() added to SeasAdjData recently? robert -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 1:46 PM To: Struts User List ([EMAIL PROTECTED]) Subject: Can't find property -- but it's there We develop our Struts apps running them on a BEA Weblogic server installed on our individual machines. When they run right, we deploy them to the development server, a Unix box that everybody can access. Generally, this works beautifully. I'm now working with a Struts JSP page that works fine on my desktop, but dies on the server. The immediate problem is a c:forEach ... tag, viz: c:forEach items=${SeasAdjData.seasAdjs} var=seasAdjs varStatus=stat SeasAdjData is the form bean for this page. Two html-el:hidden... tags precede the forEach tag, and there's no problem with them. As I said before, there's no problem at all when I run this on the Weblogic server on my desktop machine. But when I move it to the Unix box, I get: javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute items with value ${SeasAdjData.seasAdjs}: Unable to find a value for seasAdjs in object of class gov.bls.idcf.ppi.struts.SeasAdjData using operator . (null) This seems to be saying that there is no getSeasAdjs() method on the SeasAdjData object. But it is definitely there, and it's found when I run the app locally. The Unix version of Weblogic is in fact running on a cluster of two Unix machines. I've used c:forEach *many, many* times before, without incident. What might be going on here? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can't find property -- but it's there
Yes, but it may be possible that the ClassLoader (for whatever reason) has a cached version of the older class and it is not loading the new class when the web app reloads. Have you tried rebooting the application server on the development machine? If the problem still occurs on the dev. box after the application server reboots then you could rule out the ClassLoader issue. It may be a pain in the ***, but it would eliminate a path. One other thing to check, is to make sure you don't have any older versions of that class in the system classpath. I believe ClassLoaders are hierarchical and classes in the parent classpaths will be loaded instead of those in the child classpaths. From java.lang.ClassLoader: The ClassLoader class uses a delegation model to search for classes and resources. Each instance of ClassLoader has an associated parent class loader. When requested to find a class or resource, a ClassLoader instance will delegate the search for the class or resource to its parent class loader before attempting to find the class or resource itself. The virtual machine's built-in class loader, called the bootstrap class loader, does not itself have a parent but may serve as the parent of a ClassLoader instance. Ofcourse different application servers may have different implementations of ClassLoader employing different search algorithms. robert -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 2:20 PM To: 'Struts Users Mailing List' Subject: RE: Can't find property -- but it's there On 2004-11-10 at 14:04:38 -0500, Slattery, Tim - BLS wrote: Just a guess Tim, but is it possible that the ClassLoader used on the development server and the ClassLoader used locally are loading different versions of SeasAdjData? Was the getSeasAdjs() added to SeasAdjData recently? I have no clue about ClassLoader. I don't know how I'd find out. Hmm. Also not so good at ClassLoaders. What robert meant is that maybe the server is stuck with another version of your class, where this get method didn't exist. I can't see how that could be possible. I deploy the app by bundling the entire directory structure (including WEB-INF, and lib and classes structures under that) into a WAR file, sending that to the Unix box, and running redeploy from the Weblog console. Everything - all the jsps, all the *.class files, all the struts and JSTL libraries - is in that WAR. -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSTL and collections
I'm not sure if this will work, but you can try. c:forEach var=wrap items=${Contacts} c:forEach var=person items=${wrap.id} scope=session c:out value=${person.name}/ /c:forEach /c:forEach Not sure about this one: c:forEach var=wrap items=${Contacts} c:forEach var=person items=${sessionScope.wrap.id} scope=session c:out value=${person.name}/ /c:forEach /c:forEach robert -Original Message- From: andy wix [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 09, 2004 7:38 AM To: [EMAIL PROTECTED] Subject: JSTL and collections Hi, If I have a class Person which has id and name instance vars and have a collection of these in a page how can I access the name if I have the id available? So I have: c:forEach var=wrap items=${Contacts} varStatus=status where each wrap object has the id for a collection in the session scope called Persons from which I wish to grab the name. Thanks, Andy _ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger - 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: VO usage
Patrick, you could use DynaActionForms and just have your VO as a property. You could unit test your VO's and the ActionForm is just a wrapper. DynaActionForms can be defined in your struts-config.xml file thus reducing the number of physical objects you have to maintain. For updates, you will need some type of ActionForm to enable Struts to bind user input to your VO and to leverage the validation framework. For reads, you can simply place the VO in the appropriate scope and use JSTL or other tags to render its content. robert -Original Message- From: Patrick Beagan [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 09, 2004 11:49 AM To: [EMAIL PROTECTED] Subject: VO usage I have an application that uses struts - ejbs - hibernate. My value objects used for hibernate have the exact members as my html forms. Does anyone have Any suggestions to re-use these value objects? IE: It seems that I must define an ActionForm for my struts layer, and have a plain value object in my app server layer. I'd rather not duplicate. Thanks. Patrick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: VO usage
Yes. Wendy is absolutely correct. Although the I described will work technically, you will run into issues as Wendy already mentioned. Sorry, I will think more indepth before responding next time. robert -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 09, 2004 12:09 PM To: Struts Users Mailing List Subject: RE: VO usage Patrick, you could use DynaActionForms and just have your VO as a property. You could unit test your VO's and the ActionForm is just a wrapper. DynaActionForms can be defined in your struts-config.xml file thus reducing the number of physical objects you have to maintain. For updates, you will need some type of ActionForm to enable Struts to bind user input to your VO and to leverage the validation framework. For reads, you can simply place the VO in the appropriate scope and use JSTL or other tags to render its content. robert -Original Message- From: Patrick Beagan [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 09, 2004 11:49 AM To: [EMAIL PROTECTED] Subject: VO usage I have an application that uses struts - ejbs - hibernate. My value objects used for hibernate have the exact members as my html forms. Does anyone have Any suggestions to re-use these value objects? IE: It seems that I must define an ActionForm for my struts layer, and have a plain value object in my app server layer. I'd rather not duplicate. Thanks. Patrick - 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: What is a good Struts application?
I would take some time and do a little research on the MVC architecture and web applications. You want to avoid business logic in your view (.jsp) and leverage other J2EE components for authentication and authorization. So, for the example below, you may want to investigate the the use of container managed authorization/authentication or the use of a Filter (SecurityFilter). The general idea is to protect resources using either technique and redirect to the appropriate resource if the user passes the login. Else, redirect to the approprate page. For the example below, you would want to protect all pages in the banking application unless the user has been authenticated and is authorized to view the page. You could use one of the above approaches to do that. Next, once the user has been authenticated and is authorized to view the page, you could define a Struts action which would be invoked prior to viewing the page; ShowUserAccountList. This action would delegate to the appropriate business logic which would retrieve the necessary user information and place it in a JavaBean which you could place in request scope. ShowUserAccountList would then look up a forward mapping which would allow the controller to forward to the appropriate .jsp page, where you could use either JSTL or Struts custom tags to iterate over the user account list and render the appropriate information. There are plenty of examples and advice for this type of architecture. You can start here: http://struts.apache.org/userGuide/index.html robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sunday, November 07, 2004 1:00 PM To: [EMAIL PROTECTED] Subject: What is a good Struts application? hi, I am a newbie to Apache Struts. I'd like to know what a good Struts application looks like. In our JSP pages, should we try to avoid embedded java code but use tags? For example, i have an index.jsp page for my banking application. When a user comes to this page, it displays the login form. When a user has already logged in, it displays the user's account list. The user information is saved in the session as an instance of my User class. I wrote my index.jsp as the following: % User user = (User)session.getAttribute(USER); if (user==null) { % html:form action=Login Login Name: html:text property=loginName size=16/br/ Password : html:password property=password size=16/br/ /html:form % } else { Iterator iter = Account.getAccountList(user); int count = 0; while (iter.hasNext()) { count ++; Account account = (Account)iter.next(); % %= account.getName() % (created on %= account.getCreatedDate() %)br/ % } % Total %= count % accounts found.br/ % } % Here are my questions: 1. My business object is the Account class. It provides a static method getAccountList(User user) to get an iterator of all the accounts of the given user. I am calling this method directly in my index.jsp file, but it does not seem to be a good struts programming style. So what is the preferred way for doing this? 2. I used embedded java code for checking whether a user has logged in. Should i use tags in the bean taglib or logic taglib to get an object from the session and check it? Thanks for any reply. heavy ZHENG ZHENG Zhong - Do You Yahoo!? 150MP3 1G1000 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts html:checkbox
Set the corresponding form property to true prior to loading the page. If the actual form property value equals the ${boolValue}, then the checkbox should render as checked. That is, it should produce the appropriate HTML which should render the checkbox as checked. robert -Original Message- From: Jean-Philippe Couture [mailto:[EMAIL PROTECTED] Sent: Friday, November 05, 2004 11:56 AM To: [EMAIL PROTECTED] Subject: Struts html:checkbox Hi, Sorry if this problem has already been solved, I cannot seem to find anything in the Struts List Archive... I have an Action class that sets, in the ActionForward method of the said Action class, an attribute of an object in the request scope to push it to the presentation layer (JSP). In the JSP form, I use exclusively Custom Struts Tag to display data from the object in the request scope. Everything works greatly except for that html:checkbox property=propName value=${boolValue}/html:checkbox which doesn't seem to render the checked=checked attribute. The value of the value attribute is set to true... but for some reason, I can't seem to get it render checked on load. Is there a way to get a html:checkbox render as checked upon JSP load? Best regards, - 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: Struts and Displaying data from a database
Have the business logic (where ever it may reside) return a collection of JavaBean. You can simply place the collection in some scope (request, session, etc..) and render it on the JSP page using JSTL (for-each) or Struts iterate tag. You basically define an action mapping which will be invoked before displaying the .jsp page. The action delegates to the business logic (which does the work of retrieving the data) and then places the returned collection in some scope. The action then forwards to the appropriate .jsp page. Does this help? robert -Original Message- From: dbm_mailinglist [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 2:25 PM To: Struts Users Mailing List Subject: RE: Struts and Displaying data from a database I guess that's where I get lost. What does the bean return so that it can display multiple rows in the JSTL/JSP? I guess the type of the 'getter' would be some type that allowed you to loop through the dataan array maybe? Do you know if there are any examples on the web? I'm trying to stick to just JSP/JSTL/Servlets/Java and trying to steer away from additional tools like Hibernate. Thank you much! -Original Message- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 2:02 PM To: 'Struts Users Mailing List' Subject: RE: Struts and Displaying data from a database I'm a complete newbie to Struts. I know how to use Struts to build forms and submit them, but how do I just display data from a database? I want a screen that just displays data from a sql command to a database and displays the results in a html table. Do I use ActionForm even though I don't have a form? I haven't been able to find any good examples on the web. You don't necessarily need an ActionForm for this, but you do need a JavaBean to hold the data you want to display. To display it on the page, use JSTL c:out ... tags. -- Tim Slattery [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JSF or Struts w/ JSF (again)
Howard, take a look at McClannahan's blog entry here: http://blogs.sun.com/roller/comments/craigmcc/Weblog/struts_or_jsf_struts_and You also might be interested in this article: http://svn.apache.org/viewcvs.cgi/*checkout*/struts/trunk/contrib/struts-shale/README.html He hints at the future of web application development and architecture using JSF, Struts and Spring. I haven't used JSF yet, but am currently looking at it for future projects. Hope this helps you some. robert -Original Message- From: Abrams, Howard A [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 6:23 PM To: Struts Users Mailing List Subject: RE: JSF or Struts w/ JSF (again) Thanks again Kevin, but the bullet points from the article don't state why I would want to use Struts w/ JSF. With the exception of the quote about the controller being 'powerful', they just list why JSF is good. I know why JSF is good, why is Struts plus JSF better? -Original Message- From: Kevin Bridges [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 11:13 AM To: Struts Users Mailing List Subject: Re: JSF or Struts w/ JSF (again) From the article: Why integrate the trinity? As the JSP and the related specifications mature, new standards like JSF and the JSP Standard Tag Library (or JSTL, which uses simple tags to encapsulate the core functionality common to many JSP applications) are emerging. Following are some of the advantages to using the new technologies as an integrated whole: * Cleaner separation of behaviors and presentation. With the separation of tag, renderer, and component, the roles of page authors and application developers in the development cycle become better defined. * Changing the presentation for a component does not have an avalanche effect. Now you can easily just change the renderer. In the traditional MVC model, since this separation did not exist, any change in tags needed changes to the business logic as well. Not any more. * Renderer independence. Or restated, protocol independence by reusing component logic for multiple presentation devices with multiple renderers. The ability to use different renderers eliminates the need to code the entire presentation tier for specific devices. * A standard for assembling and reusing custom components. JSF thinks beyond forms and fields and provides a rich component model for rendering custom GUI components. Using JSF you can customize the way each component looks and behaves in a page. Developers also gain the ability to create their own GUI components (like menus and trees), which can easily be included in any JSP page with simple custom tags. Just like the Java front-end GUI components provided by AWT and Swing, we can have custom components for our Web pages that use their own event handlers and have customizable appearances. This is GUI nirvana for the Web tier! Struts is a framework that already possesses a large customer base. Many IT departments have recognized the value of this MVC framework and have been using it for quite a while. JSF doesn't possess the equivalent of Struts's powerful controller architecture, as well as its standardized ActionForm and Actions (with their declarative capabilities). When you integrate Tiles into the mix, you give yourself the ability to reuse and change corporate layouts in a seamless manner. The challenges of migrating JSF-enabled Struts applications are two-fold. First, Struts tags are not JSF-compliant. In other words, they do not extend the UIComponentTag as mandated by the JSF specification, therefore, JSF cannot interpret and associate UIComponent and Renderers with them. Second, there is no link between the FacesServlet and Struts RequestProcessor. In a Struts application, the RequestProcessor manages the show with the callback methods into ActionForm and Actions classes. Getters and setters for ActionForm properties and validate() are the callback methods in the ActionForm. For Action, execute() is the callback method. Unless the RequestProcessor gets invoked, the callback methods in Struts ActionForm and Actions classes do not get a chance to invoke the business logic. On Tue, 2 Nov 2004 13:57:56 -0500, Abrams, Howard A [EMAIL PROTECTED] wrote: -Original Message- From: Kevin Bridges [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 02, 2004 10:40 AM To: Struts Users Mailing List Subject: Re: JSF or Struts w/ JSF (again) I found this article to be useful in addressing some of your questions: http://www-106.ibm.com/developerworks/java/library/j-integrate/ Thanks for the pointer Kevin. The article does a good job explaining _HOW_ to integrate the two, but (and perhaps it's because I don't know enough about Struts), it didn't seem explain _WHY_ I would want to
RE: [OT] SQL in XML file
Look at iBatis. robert -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 27, 2004 1:02 PM To: [EMAIL PROTECTED] Subject: [OT] SQL in XML file Hi Is there any code out there or any one worked on a framework, where we can define SQL statements in XML file and at runtime java program will read this XML file, build the SQL if prepared statement and execute it and return a ResultSet What may be the points to be taken into consideration if i have to write a new one Ashish __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail - 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: Blank Line Filter
I think your looking for a data compression filter. http://www.onjava.com/pub/a/onjava/2003/11/19/filters.html?page=1 robert -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 12:26 PM To: '[EMAIL PROTECTED]' Subject: Blank Line Filter How would I go about implementing a wrapper around my JSP servlet engine that would strip blank lines from the JSP stream when it sends the content to the browser? We're using struts and some the el tags with heavy iteration and loops on large data sets and what we're seeing is that the output can be drastically reduced by removing blank lines that are emitted by the struts/JSTL tags. Any suggestions or recommendations are greatly appreciated. ___ Chris Cranford Programmer/Developer SETECH Inc. Companies 6302 Fairview Rd, Suite 201 Charlotte, NC 28210 Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042 Email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Blank Line Filter
Chris, unfortunately I have not yet implemented a compression filter in my web apps. I had just read the article mentioned below and thought it was applicable to your question. Sorry I'm not much help with your implementation questions. It sounds like your hunch may be correct as the browser apparently doesn't know how to handle the content once its passed through the filter. robert -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 2:17 PM To: 'Struts Users Mailing List' Subject: RE: Blank Line Filter I just plugged in the Gzip compression shown below and for some strange reason it prompts me to download the file for my filter of *.do. Probably content-type isn't set right or something I suspect. Chris -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:19 PM To: Struts Users Mailing List Subject: RE: Blank Line Filter I think your looking for a data compression filter. http://www.onjava.com/pub/a/onjava/2003/11/19/filters.html?page=1 robert -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 12:26 PM To: '[EMAIL PROTECTED]' Subject: Blank Line Filter How would I go about implementing a wrapper around my JSP servlet engine that would strip blank lines from the JSP stream when it sends the content to the browser? We're using struts and some the el tags with heavy iteration and loops on large data sets and what we're seeing is that the output can be drastically reduced by removing blank lines that are emitted by the struts/JSTL tags. Any suggestions or recommendations are greatly appreciated. ___ Chris Cranford Programmer/Developer SETECH Inc. Companies 6302 Fairview Rd, Suite 201 Charlotte, NC 28210 Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042 Email: [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Shale
+1. Excellent read. It certainly gives one insight into the future web application development. robert -Original Message- From: Michael McGrady [mailto:[EMAIL PROTECTED] Sent: Monday, October 25, 2004 1:09 AM To: Struts Users Mailing List Subject: [OT] Shale For those of you who do not get the wiki changes, I would recommend that you look at the following addition by Craig. http://wiki.apache.org/struts/StrutsShale Very exciting stuff. Michael McGrady - 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: Scheduling Actions
Factor the business logic out of your Actions into some generic business classes and run a separate process to handle this type of automation. There is no need to have it coupled to your web application. Look into Quarts, Timer/TimerTask, etc... robert -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 8:49 AM To: Struts User Mailing List Subject: OT: Scheduling Actions Hi, I have several actions in my struts webapp that require a user to manually click a form button to carry out the action, e.g. update database. I want to be able to schedule these actions to be carried out at a set time daily without any user intervention. I am looking for suggestions on what ways that this can be accomplished? Thanks, Ciaran _ Ciaran Hanley Software Development Sentenial Ltd. Tel: 00 353 (1) 629 2141 Fax: 00 353 (1) 629 2147 Mob: 00 353 (0) 87 916 4943 E-Mail: [EMAIL PROTECTED] Web: www.sentenial.ie http://www.sentenial.ie/ _ Notice: The information in this e-mail is intended only for the named recipient and may be privileged or confidential. If you are not the intended recipient, please notify us immediately and do not copy, distribute or take any action based on this e-mail. Sentenial Ltd will not be liable for direct, special, indirect or consequential loss as a result of any virus being passed on or arising from alteration of the contents of this e-mail by a third party. All e-mail sent to or from this address is subject to archive and review by someone other than the intended recipient. Any opinions expressed in this e-mail are those of the individual and not necessarily those of Sentenial Ltd. All Personal Data acquired by Sentenial Ltd for which the Data Protection Act 1998 (the Act) applies shall be stored and processed in accordance with the Act. Should you wish to check, amend or remove the details of your Personal Data held by Sentenial Ltd, please contact us at mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Format Date Question
In JSP2.0 you could use JSTL fn:toUpperCase() after you format the date. c:set var=upperDate value=${fn:toUpperCase(formattedDate}/ robert -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 2:50 PM To: '[EMAIL PROTECTED]' Subject: Format Date Question I am using the fmt:formateDate taglib with a pattern in order to present dates in a specified format. Ideally we'd like to output our dates as such 02-APR-2004 instead of 02-Apr-2004. Is there any pattern or way I could force format date to output the date in uppercase? ___ Chris Cranford Programmer/Developer SETECH Inc. Companies 6302 Fairview Rd, Suite 201 Charlotte, NC 28210 Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042 Email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Format Date Question
Well, you could try to use and if it works, then your container supports it :) else robert -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 3:21 PM To: 'Struts Users Mailing List' Subject: RE: Format Date Question I ended up grabbing the strings taglib and wrapped it as follows: string:upperCase fmt:formatDate value=${transaction.transactionDate} pattern=dd-MMM-/ /string:upperCase This works great. I don't think we're using the JSTL library yet that includes the fn:toUpperCase functionality... How can I verify that? Thanks Chris -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 3:16 PM To: Struts Users Mailing List Subject: RE: Format Date Question In JSP2.0 you could use JSTL fn:toUpperCase() after you format the date. c:set var=upperDate value=${fn:toUpperCase(formattedDate}/ robert -Original Message- From: CRANFORD, CHRIS [mailto:[EMAIL PROTECTED] Sent: Friday, October 01, 2004 2:50 PM To: '[EMAIL PROTECTED]' Subject: Format Date Question I am using the fmt:formateDate taglib with a pattern in order to present dates in a specified format. Ideally we'd like to output our dates as such 02-APR-2004 instead of 02-Apr-2004. Is there any pattern or way I could force format date to output the date in uppercase? ___ Chris Cranford Programmer/Developer SETECH Inc. Companies 6302 Fairview Rd, Suite 201 Charlotte, NC 28210 Phone: (704) 362-9423, Fax: (704) 362-9409, Mobile: (704) 650-1042 Email: [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Returned Receipts
I would like to respectfully request that those of you have returned receipts enabled in your emails to this mailing list, please disable them. I know they have a legitimate purpose in some cases, but for those searching the archives on a thread subject and getting a bunch of returned receipt notices in the search results is not very helpful. In addition, they are just another annoying windoze event I have to address when scrolling through email messages in my client. Maybe that's my fault, maybe I should use a different client or maybe there is a way to disable the returned receipt events in my email client. Never the less, the returned receipts become part of the mailing list archives and just take up valuable knowledge space. robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checking a cookie or redirecting - best way?
Why not use a Filter? The logic goes in one place and you can map the Filter to all requests. robert -Original Message- From: Dave Johnson [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 21, 2004 8:42 AM To: Struts Users Mailing List Subject: Checking a cookie or redirecting - best way? hi all Well now I've got this cookie that I need to check for, and if it exists, lovely. Nothing else needs to be done. if NOT, I need to send the user to a specific page (/error.jsp). I was thinking of using logic:present to check for the bean, but I dont want to wrap all my jsp code with that tag, what I really want is something simple at the beginning that checks if the bean is there then does a redirect if there's an error. should I be using a struts tag or scriptlet? what about if I need to include something like that in HTML (using javascript) has anyone done that? Thanks D - 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: I'm going back to just using regular Actions.. a question
Rick, I have been using the following package layout for a while and it seems to make sense. For example, let's say the foo web application consists of various sub applications like account, store, product download, etc com.acme.applications.web.foo.account.action com.acme.applications.web.foo.account.service com.acme.applications.web.foo.store.action com.acme.applications.web.foo.store.service etc... May not be the best way, but like I said, it seems to make sense and it works for me. robert -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 2:42 PM To: Struts Users Mailing List Subject: I'm going back to just using regular Actions.. a question After thinking about the flavors of Dispatch actions I use, and after having used them as my primary type of Actions for the past 3+ years, I've decided to go back to just using regular Actions. I like the modular self contained Actions. My question is more of design practice for those that just use standard Actions. How do you design your packages? For example... EmployeeUpdateAction: 1) package com.acme.ui.action.employee; or 2) package com.acme.ui.employee.action; or just put them all in one package: 3) package com.acme.ui.action; I'm leaning towards option 1 myself. Other thoughts? -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: I'm going back to just using regular Actions.. a question
Yep. I usually bunch all action type stuff in the action package. Like forms, action utils, value objects used in actions, etc... I guess it more or less represents the presentation part of the package and the service represents the business part. I only see a need to dissect it into these two because the actions should only need to talk to the service layer. The service layer should be talking to reusable components in some other package like com.acme.components.whatever. robert -Original Message- From: Rick Reumann [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 3:05 PM To: Struts Users Mailing List Subject: Re: I'm going back to just using regular Actions.. a question Robert Taylor wrote the following on 9/17/2004 2:58 PM: com.acme.applications.web.foo.account.action com.acme.applications.web.foo.account.service Yea that was my option 2 I posted. I'm still debating about this one as well. I can see both approaches being decent: com.acme.applications.web.foo.account.action com.acme.applications.web.foo.account.form com.acme.applications.web.foo.service.action com.acme.applications.web.foo.service.form OR: com.acme.applications.web.foo.action.account com.acme.applications.web.foo.action.service com.acme.applications.web.foo.form.account com.acme.applications.web.foo.form.service I'm leaning towards the later approach since when I'm looking for something I usually know that I'm looking for a form or an action so I can then look to that top level and go down. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Idea for chain and DB transactions
Sean, have you looked at Spring? It uses AOP and you can set up transactions declaratively. I'm just starting to investigate using Spring and I'm really impressed. Like you I had a requirement to demarcate transactions at a high level so that all business objects within the transaction were subject to the same transaction semantics unless a business object explicitely needed to be isolated. I ended up creating a Transaction framework of sorts which uses ThreadLocal to propogate the Connection to my DAO's. All DAO's that need to be included in a transaction had to subclass a TransactionalDAO which knew how to access the current TransactionContext from ThreadLocal. It has worked for a couple years now, but its not that clean or elegant. That's why I was so excited to read about Spring and IoC. It does all that stuff for you. robert -Original Message- From: Sean Schofield [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 2:44 PM To: [EMAIL PROTECTED] Subject: Idea for chain and DB transactions I have a problem and a proposed solution. I would greatly appreciate any feedback about the proposed solution. Problem: === I'm currently using a Struts application with a connection pool (using DBCP as supplied by Tomat). When a database update is needed, the Struts actions will call the facade which will talk to my service layer (currently POJO's which handle business logic.) My service layer in turn talks to the appropriate DAO. Each of these DAO's extends from a common abstract class that provides basic functionality including obtaining a connection from the DataSource (via the pool). A key aspect of my design is that some updates are in distinct areas of the database and so I have different DAO's for each area (ex. one for workflow on for document.) As currently implemented I am unable to take advantage of transactions because the two DAOs will be getting a connection indepently from the pool and they will most likely not obtain the connection each time. If I could just get the same connection each time, then I could use setAutoCommit(false). Proposed Solution: == I'm thinking I could set up a few chains for the various kind of updates. The chains would be called by the POJO service layer (instead of calling the DAO's directly.) The first Command in the chain would be to indentify all database updates in the chain as needing transactions. This would be done through a static method on a new object called TransactionManager. Basically I would have a hashtable that would maintain connections for the duration of the chain. The connections would be stored by the current thread (use that as the key to the table.) Then when a command down the line needs a database connection, it would first check to see if there is one already set aside for it to use. Actually the command would call the DAO and the DAO would check. The command would also be decorated by a custom wrapper so that if the DAO's try to close the connection, I'll ignore it. Then when the chain does the post processing in reverse order. So the last clean up step will be to check for my custom DAOException. If there is one, then rollback, otherwise commit. Finally, the connection is removed from the TransactionManager. I think this might be crazy enough to work. I know we could allways use EJB and get transactions but that might be overkill since the volume is very light (this is custom software for a government agency not ecommerce.) Please let me know what you think. A big question I have is about storing and retrieving the datbase connection using the current thread as the key to a hashtable. Also, I know that I will have to be careful with thread synchronization. Thanks, sean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validator with DispatchAction...help!...newbie
ValidatorForm, ValidatorActionForm, DynaValidatorForm, and DynaValidatorActionForm allow you to leverage the validation framework in Struts. How you use DispatchAction determines what you need to do to make it work with the validation framework. For example there are two basic approaches: 1. Differentiate different validation routines based on form name. Using DispatchAction you could use the same form and identify it with different names in the struts-config.xml file. You can then ensure that each action mapping using the DispatchAction used the appropriate form name to invoke the appropriate validation rules in validation.xml. 2. Differentiate different validation routines based on action mapping. Using DispatchAction you could use the same form with the same identity. You can then use different action mappings which all map to the same DispatchAction using the same form. Each unique action mapping would then invoke the appropriate validation rules in validation.xml. There are other variations of DispatchAction such as MappedDispatchAction and LookupDispatchAction. Each of these might be leveraged differently to work with the validation framework. I've yet to use them, so I can't offer any advice; however, recently, there have been some healthy threads on both. Just don't ask Rick about LookupDispatchAction and you'll be okay :) Now, it gets kind of tricky when you want to use DispatchAction (or some variant there of) to perform different validation routines using the same form name and the same action mapping. This is typical when you have a single form with multiple buttons, where each button invokes a different operation on the DispatchAction and you want to use different validation routines for each operation. Since validation routines basically key off of the name attribute of the form element in validation.xml, you can modify/override the getValidationKey() in ValidatorForm or ValidatorActionForm to return a name including the invoked operation. There are probably other ways to do this and most likely more elegant. I think you can also use the form name in conjunction with the page attribute as the validation key but I haven't done this yet. Digging around the source code always helps me to understand how things work. robert -Original Message- From: O. Oke [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 8:04 PM To: Struts Users Mailing List Subject: Validator with DispatchAction...help!...newbie --- Matt Bathje [EMAIL PROTECTED] wrote: O. Oke wrote: Can anyone please tell me how to use the Struts Validator with DispatchAction. This article in bugzilla does not seem to deal with the issue: http://issues.apache.org/bugzilla/showattachment.cgi?attach_id=8633 Thank you. Ola Ola - we more information to be able to help you. I can't even tell what your problem is, or why you think that bugzilla report is/isn't related to it. (Also, there are hundreds of bugzilla reports that do not apply to your problem...that doesn't mean they are helpful to explain what is going on.) Matt Matt, Please find further detail below: GENERAL INFORMATION === My understanding is that the Stuts validator is not designed to work with classes that extend DispatchAction (as against Action). However, the information I have found on the internet appears to suggest that there is a way to make them work with each other. This article (http://issues.apache.org/bugzilla/showattachment.cgi?attach_id=8633) is meant to be an explanation of howto, but on closer examination, it did not seem to deal with the issue. Can you please tell me how to make them work with each other? Thank you. Ola. ___ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Moving from environment to environment
Dave, I have 3 environments: Development, Staging, and Production. I use Ant and have different deployment targets. Each target replaces tokens with the values which correspond to its deployment environment. Ant makes this pretty easy to do. http://ant.apache.org/manual/CoreTypes/filterset.html hth, robert -Original Message- From: Dave Bender [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 4:59 PM To: 'Struts Users Mailing List' Subject: Moving from environment to environment How do you easily move a Struts application from one environment to another, e.g. from development to test to production, without having to change the struts-config.xml file to use a different database? The datasources seem like they can be configured only in that file, but if you want to have different database configs in the different environments, it seems like you have to edit that file. Am I missing something? Is there a way around that? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT]: Best book J2EE Design patterns
+1. Both Johnson books are top notch. I highly recommend them to any J2EE developer. robert -Original Message- From: Nail, Evan Burke [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 7:57 AM To: Struts Users Mailing List Subject: RE: [OT]: Best book J2EE Design patterns Another good book is J2EE Design and Development by Rod Johnson http://www.amazon.com/exec/obidos/tg/detail/-/0764543857/qid=1094730665/sr=8-1/ref=pd_cps_1/102-7925651-9470545?v=glances =booksn=507846 It references the core patterns book and gives some real world examples of a few of the most common patterns in the context of showing how to solve design issues. I think a new addition is out called ..Design without EJB or something like that. It has a download version from Amazon I believe. Burke -Original Message- From: Janarthan Sathiamurthy [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 3:22 AM To: Struts Users Mailing List Subject: Offtopic: Best book J2EE Design patterns Hi, Can any one suggest a good book for Design patterns in J2EE? Regards, Janarthan S ** This e-mail is the property of Enron Corp. and/or its relevant affiliate and may contain confidential and privileged material for the sole use of the intended recipient (s). Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender or reply to Enron Corp. at [EMAIL PROTECTED] and delete all copies of the message. This e-mail (and any attachments hereto) are not intended to be an offer (or an acceptance) and do not create or evidence a binding and enforceable contract between Enron Corp. (or any of its affiliates) and the intended recipient or any other party, and may not be relied on by anyone as the basis of a contract by estoppel or otherwise. Thank you. ** - 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: [ANN] Bridgetown IoC Framework
Peter, this sounds interesting, but what would Bridgetown offer over a more mature IoC container like Spring? robert -Original Message- From: Pilgrim, Peter [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 3:52 AM To: Struts User Apache (E-mail) Subject: FW: [ANN] Bridgetown IoC Framework FYI -Original Message- From: Peter A. Pilgrim [mailto:[EMAIL PROTECTED] Sent: 08 September 2004 07:12 To: Struts Developers List Subject: [ANN] Bridgetown IoC Framework Hi I have been quietly working on my own Inversion of Control lightweight framework over the last couple of months. My itch was scratched when I suddenly realised that ``Commons BeanUtils'' and ``Common Digester'' could be simply combined together into a bean assembly factory. An assembly factory could manage service beans in a lightweight container. Services could then be retrieved by name, and one doesn't have to worry about connecting different services together. Experiments showed that this idea was pretty cool and have implemented property and method dependency injection (aka ``BeanUtils'' and ``MethodUtils''). [Constructor injection is on the todo list. ] I am at the point where the current codebase is stable enough for development, but if I want the container to be more useful, then I need to open- source the project. It would allow others to write Dynamic proxy service beans, integrate with Struts 1.2/2+, or extend with AOP library, or whatever persistence layer EJB 3.0 decides to become. It cannot be down by just one man writing software. As an independent consultant I simply have not got the time to build everything. Moreover, I intend to follow the Struts style ``open integration'' philosophy that should allow Bridgetown IoC container to be added any other framework. (I intend add support to the Expresso Framework in the near term, since I am a core committer there) So my simple IoC Test Container became ``Bridgetown IoC''. I uploaded the source code to ``Sourceforge'' and slapped on it an Apache License 2.0 badge. The software is ALPHA quality but it compiles and run with Eclipse SDK 3, and there are junit test and a couple of examples. `` http://bridgetown.sf.net '' is the hook. I'd like publicly thank the man, Craig McClanahan, for his two inventions `BeanUtils' and `Digester'. Without those two components it just wouldn't have happened. Enjoy baby bop# -- Peter Pilgrim __ _ _ _ / //__ // ___// ___/ + Serverside Java / /___/ // /__ / /__ + Struts / // ___// ___// ___/ + Expresso Committer __/ // /__ / /__ / /__ + Independent Contractor /___/////// + Intrinsic Motivation On Line Resume http://jroller.com/page/peter_pilgrim || \\=== `` http://www.xenonsoft.demon.co.uk/no-it-striker.html '' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] [ Not subscribed to the users list at home ;-( ] -- Peter Pilgrim Operations/IT - Credit Suisse First Boston, 10 South Colonnade, London E14 4QJ, United Kingdom Tel: +44 (0)207 883 4447 == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. == - 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: Proper place for validation
I would avoid putting any business logic in the action class. Place this type of logic in the business class as it most likely is validation that is valid across all application logic and not for just one use case. robert -Original Message- From: Janne Mattila [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 8:15 AM To: [EMAIL PROTECTED] Subject: Proper place for validation I am wondering what would be the propert place for some validation code. Let's say I have a registration page where user inputs his/her information for a new user account. There's a field for e-mail address. On one level that information is validated on the ActionForm, for things such as - field is not left empty, if it is required - field is a valid e-mail address That much seems quite clear. But where should I put a check that ensures that same e-mail address is not already used by an existing account? On the other hand, I could put it in the registration action, because checking that is (kind of) user-input validation, and action is a natural place to do this. On the other hand, I could put it in my business class. The pros for this would be smaller and simpler action code, and reuse if same check is needed with different actions. Any suggestions? Intuitively, I think I would put that check in the Action, but I am happy to hear any arguments in favor or opposing that. _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - 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: Height and width missing from html:image
If you are using it to render an img .../ then use html:img .../ which should have the appropriate attributes. The html:image .../ is for rendering input type=image .../ which does not have the height and width attributes. robert -Original Message- From: Janne Mattila [mailto:[EMAIL PROTECTED] Sent: Thursday, September 02, 2004 7:23 AM To: [EMAIL PROTECTED] Subject: Height and width missing from html:image Damn, why no width and height attributes for html:image? Disappointing. _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SecurityFilter Question?
I haven't been following this thread too closely but I know its been some what long so if this solution has already been proposed, I apologize in advance. We use SecurityFilter and an additional filter which checks for the Principal in the request. If the Principal exists, then we can be assured that the user has successfully logged in; at which point we check to see if the required information is in the session. If not, then we persist the required information into the session. If so, then we do nothing. In either case we allow the filter chain to proceed. It has worked quite nicely so far. Principal principal = req.getUserPrincipal(); if (principal != null) { if (req.getSession().getAttribute(requiredInformation) == null) { // do other login stuff here } } chain.doFilter(req, res); hth, robert -Original Message- From: struts Dude [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 8:19 PM To: Struts Users Mailing List Subject: Re: SecurityFilter Question? - Original Message - From: Jason Lea [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, August 30, 2004 6:07 PM Subject: Re: SecurityFilter Question? Can't u do this using an Action? Say, accessing /admin/LogAction.do invokes SecurityFilter, after authentication by SecurityFilter is passed, go directly to LogAction as below The problem comes if the user bookmarks a url like /user/abc.do, starts up their browser and goes directly to the protected URL. The security filter will take them to the login form, they submit username/password and seucirty filter authenticates them. Once they are authenticated they are redirected back to /users/abc.do - they don't pass through LogAction at all. So I normally have a filter that makes sure the bean is in session from where ever they are called. You don't have to use a filter though, you could make a base action that does puts the bean into session and have all your actions sub-class that one. Using action to put bean in Session after SecurityFilter, how is that possible when after authentication by SecurityFilter, u taken right back to /user/abc.do where u 1st request it and doesn't pass through to action attribute as specified in action-mapping of struts-config.xml? I have tried to use action, after authentication, I am indeed taken back to the page /admin/logon.do or /user/logon.do and got error message in browser: HTTP Status 400 - Invalid path /admin/Logon was requested message Invalid path /admin/Logon was requested description The request sent by the client was syntactically incorrect (Invalid path /admin/Logon was requested). - My action mapping is struts-conf.xml Both action path=/admin/Logon.do type=org.apache.struts.actions.ForwardAction parameter=LogAction.do?action=logon/ action path=/user/Logon.do type=org.apache.struts.actions.ForwardAction parameter=LogAction.do?action=logon/ !-- My LogAction extends DispatchAction and will try to put User bean in session. -- or action path=/admin/Logon.do type=org.apache.struts.actions.ForwardAction parameter=Welcome.do/ action path=/user/Logon.do type=org.apache.struts.actions.ForwardAction parameter=Welcome.do/ won't work. --- BTW, how wud u use html:form to display login fields? I can't get struts tag to work with login fields except for using things like: form action=j_security_check method=POST Username: input type=text name=j_usernamep Password: input type=password name=j_passwordp input type=Submit /form -- Ok, using filter (as u said) after SecurityFilter wud solve this simply but I like to stick with pure Struts approach if possible. Thanks Jason Lea - 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]