Re: showing nested collections in a JSP
2005/8/17, [EMAIL PROTECTED] [EMAIL PROTECTED]: I think I can figure out how to display the tables using the nested:XX tags, but cant figure out how to display the nested collection by radio button. I guess I need to understand how to index a collection dynamiclly. I know JSTL is the preferred way, but I'm stuck with only the struts tags to build Don't know if I undeerstood well your need, but I would use client logic, as javascript functions, to realize this behaviour. Why don't make use of the 'style' property of visual elements to hide/display them depending on radio button clicking events? -- TREMALNAIK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pre-population of html:select tag using multiple html:option tags
Hello Everybody, I am trying to pre-populate a jsp page form via the reset function of an ActionForm. All values appear correctly in the form except the select / option combinations. Could somebody have a look at the following and provide some pointers? (Have not used html:select before...) The ActionForm: public final class ProccessPropertiesFormAction extends ActionForm { private String listlength = 20 ; private String usesig = 0 ; private String signature = ; private String fullname = ; private String replyto = ; private String maxwidth = 72 ; private String maxheight = 20 ; private String defsort = date ; --- used to create the select ... public void reset(ActionMapping mapping, HttpServletRequest request) { User user = (User) request.getSession().getAttribute(user) ; listlength = Integer.toString(user.getPagesize()) ; if (user.getUseSig()) usesig = 1 ; else usesig = 0 ; signature = user.getSignature(); fullname = user.getRealname() ; replyto = user.getReplyto() ; maxwidth = user.getMaxwidth() ; maxheight = user.getMaxheight(); defsort = user.getSortby(); // -- (this is date, subject, etc) and the JSP Page: ... html:form action=/ProcessProperties tr class=row1 td align=leftbean:message key=properties.replyto//td td align=righthtml:text size=30 property=replyto//td /tr tr class=row2 td align=left bean:message key=properties.defsort/ /td td colspan=2 align =right html:select property=defsort option value=subjectbean:message key=properties.subject//option option value=datebean:message key=properties.date//option option value=senderbean:message key=properties.sender//option option value=sizebean:message key=properties.size//option option value=newbean:message key=properties.new//option option value=repforbean:message key=properties.repfor//option /html:select /td /tr ... Thanks in advance, Fotis
Problems declaring DataSources
Hello All, I have the following datasource declared. The password, URL and user name as well as Database name (on the URL) are corrected and I have them tested. Here it is: data-sources data-source key=ds1 type=org.apache.commons.dbcp.BasicDataSource set-property property=driverClass value=com.mysql.jdbc.Driver / set-property property=url value=jdbc:mysql://localhost:3306/Test / set-property property=user value=antunes / set-property property=password value=antunes / set-property property=description value=Test_db / set-property property=readOnly value=false / set-property property=autoCommit value=false / set-property property=loginTimeout value=5000 / set-property property=maxWait value=5000 / set-property property=maxActive value=500 / /data-source /data-sources However, when I put it in my struts-config.xml I have the erros bellow. What am I missing here? Am I missing any properties? Shall I use any other type other than org.apache.commons.dbcp.BasicDataSource for MySQL? Thanks, C.F. Errors: SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency. java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328) at java.lang.Class.getConstructor0(Class.java:2640) at java.lang.Class.newInstance0(Class.java:321) at java.lang.Class.newInstance(Class.java:303) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143) at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:805) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335) at javax.servlet.GenericServlet.init(GenericServlet.java:211) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4118) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:894) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:857) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409) Aug 18, 2005 2:33:21 AM org.apache.catalina.core.ApplicationContext log INFO: Marking servlet action as unavailable Aug 18, 2005 2:33:21 AM org.apache.catalina.core.StandardContext loadOnStartup SEVERE: Servlet /upload2 threw load() exception javax.servlet.UnavailableException: org/apache/commons/pool/impl/GenericObjectPool at org.apache.struts.action.ActionServlet.init(ActionServlet.java:368) at javax.servlet.GenericServlet.init(GenericServlet.java:211) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857) at
Re: Shale ... where can I find out more?
is there a road map/milestone for Shale developemnt ? I am pretty comfortable with Struts now but would like to explore Shale in the next project. thanks lixin On 8/18/05, Craig McClanahan [EMAIL PROTECTED] wrote: On 8/17/05, Joe Germuska [EMAIL PROTECTED] wrote: At 11:49 AM +0100 8/17/05, John Atherton wrote: Okay I've found the place to go for all things Shale but my other two questions still stand. first, a disclaimer: I've never written a JSF app let alone a Shale app. Then I came across Shale. I've never used JSF so firstly, is this now the way to go? Roughly, Shale is to JSF as Struts is to JSP: it provides a framework which supports best-practices application development with features that are outside of the scope of the basic Sun technology. Roughly that's pretty accurate :-), although there is one level of internal difference that you will want to be aware of. JSF includes a controller servlet (like Struts and other MVC frameworks), and supports other controller features like navigation, itself. Shale builds around the edges to add value (functionality and/or ease of use improvements), without any attempt to redundantly implement features that JSF provides by itself. One place I *don't* see Shale going, by the way, is to become yet another library of JSF components. There will be a few such components that integrate directly with Shale features (like the ones that integrate the Commons Validator facilities), but the whole idea of a standard component API is that you should be able to use *anyone's* components with it. If you're going to use JSF, you should probably check out Shale. I would agree with this ... especially for new app development. You can use struts-faces to connect JSF to Struts, but if you have no deep Struts experience, you wouldn't be gaining much of anything, and in fact you'd lose all the benefits that Shale has by virtue of learning from several years of Struts development experience. The integration library should be primarily considered as a tool useful in a migration strategy. Secondly, where can I find out more? And finally how steep is the learning curve? There doesn't appear to be the Shale equivalent of http://struts.apache.org Shale's website, by the way, is at: http://struts.apache.org/shale/ The feature descriptions have not all been fleshed out yet, but the javadocs are pretty thorough for those cases. I'm not sure what the second question was: about the learning curve? I'm not the one to answer that. But since Shale is a subproject of Struts, there is no shale.apache.org Since there has not been a full release of Shale, the struts-dev list is generally considered the more fruitful place for discussions about it. Hope this helps, Joe Craig - 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: Problems declaring DataSources
Hi all, Problem solved. So I will share the solution in case someone has the same problem. Just use the following class: com.mysql.jdbc.jdbc2.optional.MysqlDataSource as the DataSource class. so, the correct code is: data-sources data-source key=ds1 type=com.mysql.jdbc.jdbc2.optional.MysqlDataSource set-property property=driverClass value=com.mysql.jdbc.Driver / set-property property=url value=jdbc:mysql://localhost:3306/Test / set-property property=user value=antunes / set-property property=password value=antunes / set-property property=description value=Test_db / set-property property=readOnly value=false / set-property property=autoCommit value=false / set-property property=loginTimeout value=5000 / set-property property=maxWait value=5000 / set-property property=maxActive value=500 / /data-source /data-sources Thanks. C.F. Scheidecker Antunes wrote: Hello All, I have the following datasource declared. The password, URL and user name as well as Database name (on the URL) are corrected and I have them tested. Here it is: data-sources data-source key=ds1 type=org.apache.commons.dbcp.BasicDataSource set-property property=driverClass value=com.mysql.jdbc.Driver / set-property property=url value=jdbc:mysql://localhost:3306/Test / set-property property=user value=antunes / set-property property=password value=antunes / set-property property=description value=Test_db / set-property property=readOnly value=false / set-property property=autoCommit value=false / set-property property=loginTimeout value=5000 / set-property property=maxWait value=5000 / set-property property=maxActive value=500 / /data-source /data-sources However, when I put it in my struts-config.xml I have the erros bellow. What am I missing here? Am I missing any properties? Shall I use any other type other than org.apache.commons.dbcp.BasicDataSource for MySQL? Thanks, C.F. Errors: SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency. java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328) at java.lang.Class.getConstructor0(Class.java:2640) at java.lang.Class.newInstance0(Class.java:321) at java.lang.Class.newInstance(Class.java:303) at org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.java:143) at org.apache.struts.action.ActionServlet.initModuleDataSources(ActionServlet.java:805) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:335) at javax.servlet.GenericServlet.init(GenericServlet.java:211) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4118) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:894) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:857) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at
SV: Tiles standalone jar
Thnx :) Hermod -Opprinnelig melding- Fra: Craig McClanahan [mailto:[EMAIL PROTECTED] Sendt: 17. august 2005 17:52 Til: Struts Users Mailing List Emne: Re: Tiles standalone jar On 8/17/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Does anbody know where to get hold of the Tiles standalone .jar file. I have only found the source files in the SVN sandbox. Nightly builds are available at: http://cvs.apache.org/builds/jakarta-struts/nightly/sandbox/tiles-core/ Be warned, however, that a couple of changes in the Struts 1.3 version of Tiles have not yet been ported over ... I hope to do that this weekend. Craig Hermod * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - 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]
LookupDispatchAction, trying Ted Husted Tip #3
Trying the example in http://husted.com/struts/tips/index.html #3 Use LookupDispatchAction ... I use following Action, Form, JSP, application.properties and struts-config +++Action public final class MyAction extends LookupDispatchAction { private static Log log = LogFactory.getLog(MyAction.class); protected Map getKeyMethodMap() { Map map = new HashMap(); map.put(button.add, add); map.put(button.delete, delete); return map; } public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // do add log.info(--- in add()); return mapping.findForward(success); } public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // do delete log.info(--- in delete()); return mapping.findForward(success); } } +++Form: public final class MyForm extends ActionForm { private String prop; public String getProp() { return prop; } public void setProp(String prop) { this.prop = prop; } } +++JSP: /tiles/test.jsp %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% %@ include file=taglibs.jsp% !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 titletest LookupDispatchAction.../title /head body html:form action=/test html:submit property=method bean:message key=button.add/ /html:submit html:submit property=method bean:message key=button.delete/ /html:submit /html:form /body /html +++application.properties: button.add=add it all button.delete=delete it all +++struts-config global-forwards forward name=welcome path=/Welcome.do/ forward name=testit path=/test.do/ /global-forwards form-bean name=MyForm type=lau.layers.actions.forms.MyForm/ action-mappings action path=/test type=lau.layers.actions.MyAction name=MyForm scope=request input=/tiles/test.jsp parameter=method forward name=success path=/Welcome.do/forward /action /action-mappings The forward html:link forward=testit styleClass=menuitemtest it/html:link gets ERROR DispatchAction:220 - Request[/test] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text. Altering the global forward 'testit' to forward name=testit path=/test.do?method=button.add/ gets javax.servlet.ServletException: Action[/test] missing resource 'button.add' in key method map org.apache.struts.actions.LookupDispatchAction.getLookupMapName(LookupDispatchAction.java:240) org.apache.struts.actions.LookupDispatchAction.getMethodName(LookupDispatchAction.java:281) org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:158) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) What have I missunderstood about LookupDispatchAction ? Many thanks for a hint! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What do you do with ActionError in Struts 1.2
use saveMessages(request, errors); instead - Original Message - From: Tuan Jean Tee [EMAIL PROTECTED] To: user@struts.apache.org Sent: Thursday, August 18, 2005 6:06 AM Subject: RE: What do you do with ActionError in Struts 1.2 David, Thank you for the good link. Base on it, I have change the code to the following: -- -- import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessages; import org.apache.struts.action.ActionMessage; import org.apache.struts.util.MessageResources; . . . public ActionMessage validate(HttpServletRequest request) { ActionMessages messages = new ActionMessages(); if (firstName == null || firstName.trim().equals()) { messages.add( ActionMessages.GLOBAL_MESSAGE, new ActionMessage( not.authorized.for.account ) ); saveErrors(request,messages); } } -- -- I have got the error of: The method saveErrors is undefined. Have I missed out anything. Thank you again. Regards, Tuan [EMAIL PROTECTED] 18/Aug/2005 12:27:14 pm Tuan, I think you should check out various wiki sections relating to the versions you're using and the one you plan on switching over to. You probably want to scroll down to the section marked ActionError(s) and ActionMessage(s) in the page: http://wiki.apache.org/struts/StrutsUpgradeNotes11to124 Regards, David -Original Message- From: Tuan Jean Tee [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 17, 2005 10:14 PM To: user@struts.apache.org Subject: What do you do with ActionError in Struts 1.2 I am learning Struts 1.2 and would like to find out what is the replacement for ActionError knowing it's deprecated in Struts 1.2 if (firstName == null || firstName.trim().equals()) { errors.add(firstName, new ActionError(error.cust.firstname.empty)); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] IMPORTANT - Please consider our environment before printing this email. This email and any attachments are confidential and may be legally privileged in which case neither is intended to be waived or lost by mistaken delivery to you. If you have received this message in error, please notify us and remove it from your system. If you are not the intended recipient, any unauthorised use is expressly prohibited. It is your responsibility to check any attachments for viruses and defects before opening or sending them on. Minter Ellison collects personal information to provide and market our services. For more information about use, disclosure and access, see our privacy policy at http://www.minterellison.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: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug
Thank you Christian - you are correct. A colleague also referred me to: http://www.systemmobile.com/wp/?p=152 I had a copy of jsp-api.jar in my app (/WEB-INF/lib/jsp-api.jar) And Tomcat (both 5.0.28 and 5.5.9) has a copy under $CATALINA_HOME/common/lib/jsp-api.jar This makes the copy in my app redundant and it can safely be removed. By removing it, it resolves the ClassCastException with org.apache.struts.taglib.html.MessagesTei But why should this double presence of jsp-api.jar be a problem for Tomcat 5.5.9 but not for 5.0.28? Thank you, Stewart -Original Message- From: Christian Dionne [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 14:14 To: 'Struts Users Mailing List' Subject: RE: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug Hi Stewart, I had the same problem and I received a great answer on this mailing list a few days ago. The problem is caused by either one of these libraries that are conflicting with Struts: - jsp-api.jar - jsp-2.0-api.jar On my side, removing these libraries from my project (they were not used) solved the problem. Thanks, Christian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: August 17, 2005 6:24 AM To: [EMAIL PROTECTED]; user@struts.apache.org Subject: Tomcat 5.5.9 with Struts 1.2.7 - ClassCastException - looks like a Tomcat bug Using Struts 1.2.7 with the latest Tomcat 5.5.9 I get the following in localhost.date.log when I first try to access my web application: 17-Aug-2005 11:02:02 org.apache.catalina.core.Stand-ardHostValve custom SEVERE: Exception Processing ErrorPage[exceptionType=java.l-ang.Exception, location=/error.jsp] org.apache.jasper.JasperExcept-ion: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.html.-MessagesTei And in stdout_date.log I get: ERROR:org.apache.catalina.core-.ApplicationDispatcher.invoke(-Applicatio nDispatcher.java:704-) Servlet.service() for servlet jsp threw exception java.lang.ClassCastException: org.apache.struts.taglib.html.-MessagesTei Through trial and error I have found that this does not happen with Tomcat 5.0.28, with all other factors (struts, my application, etc) kept the same. Thought you all might like to know. Stewart - 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]
How to write logic:iterate for the Collection of HashMap.
Hello List, I need to display the results stored in the Hashmap. How can I achieve it by using logic:iterate I know the way to do it for List type data. Can anyone help me in this ? Thankx n regds, Amol
RE: Question on log on with SecurityFilter and JDBCRealm
Have you considered using a Filter to put the extra stuff in your Session? We use an initialization Filter that looks up a User record based on the authenticated user id. We then place that User object both in the Session and a thread local variable so that it is available to all the layers of our framework. Our DAO classes use the thread local variable to set things like Last Updated By. If you use the thread local variable make sure the last thing the Filter does is to set it to null so that the thread is not returned to the container's thread pool with the User object. public void doFilter( final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain ) throws IOException, ServletException { if ( servletRequest instanceof HttpServletRequest ) { final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; final String remoteUser = httpServletRequest.getRemoteUser(); if ( DataHelper.empty( remoteUser ) || null.equalsIgnoreCase( remoteUser ) ) { if ( log.isDebugEnabled() ) { log.debug( No User info Available ); } //end if ThreadContext.setUser( null ); } //end if else { final HttpSession session = httpServletRequest.getSession( true ); User user = (User) session.getAttribute( SESSION_TOKEN_SYSUSER ); if ( user == null ) { try { user = UserController.findUserByLoginId( remoteUser ); if ( log.isDebugEnabled() ) { log.debug( Initializing user + user.getUserId() ); } //end if } //end try catch ( final Exception e ) { throw new ServletException( e ); } //end catch session.setAttribute( SESSION_TOKEN_SYSUSER, user ); } //end if ThreadContext.setUser( user ); } //end else } //end if filterChain.doFilter( servletRequest, servletResponse ); ThreadContext.setUser( null ); //Clear the thread before returning it to the server's thread pool } Steve Mitchell UMB Bank -Original Message- From: C.F. Scheidecker Antunes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 17, 2005 12:50 PM To: Struts Users Mailing List Subject: Question on log on with SecurityFilter and JDBCRealm Hello all, I've managed to have successful authentication with securityFilter and JDBCRealm. I have a few questions that I was hoping you could clarify for me. After the login is successful, is there any way to forward that to a success page/action so that I can add extra stuff to the session context? This is my login-config session in the securityfilter-config.xml file: *login-config* *auth-method*FORM*/auth-method* *form-login-config* *form-login-page*/login.jsp*/form-login-page* *form-error-page*/error.jsp*/form-error-page* *form-default-page*/index.html*/form-default-page* */form-login-config* */login-config* My second question is concernig accessing the username value from the session context. How is that stored in the session? How can I access it? My login.jsp form uses standard j_security_check for the action on the login form, j_username, j_password for the 2 inputs. I would like, after the login is succesful to forward that to an action in order to access the database using the username as a key and return an userID number that I also want to store in the session. How can I accomplish this? Thanks in advance, C.F. - 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] Loading data for view
Sometimes the simplest answer is the best... and even when it isn't the best, it's *still* simple :) ... How about just creating a new DAO/DTO that only contains the data you need? It would be a duplication to a degree, but that's not *always* an absolutely evil thing... especially since it sounds like the new A object you want to display on the page may not truly model a real domain object (where they others I presume are) but is instead something of a hybrid, I could personally live with this. Either that, or I would just create a single Miscellaneous DAO that has methods that don't *quite* fit in other DAOs... maybe this is one of them... then you would still have a DTO for this particular case, and a new one for each particular case in the DAO, if any more came up. FYI, most of my apps have the true DAO/DTOs, but they all also have such a miscellaneous class for handling things exactly like this. There tend to be very few such cases, but they do come up, and I find this to be a nice way to organize them. In fact, in a couple of cases I've decided to make the DTOs inner classes of the DAO, just to make it obvious they are related and probably limited in their use cases. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, August 18, 2005 8:00 am, Tom Ziemer said: Hi everybody! In my app, I am using DAOs/DTOs to perform CRUD operations on a legacy database packed with lots of triggers and stored procedures. Some of my DTOs are pretty complex, meaning, they have to be assembled from many tables. A simple example: Object a (loaded by aDAO) has a list of b objects (loaded by bDAO), which in turn has a list of c objects (loaded by cDAO) The problem: In my struts-based webapp, I want to display some a objects on a page (the objects won't be used after that anymore). I need a few attributes from related object b but nothing at all from the related c objects. When I use my aDAO to retrieve my a objects, this will cause a large number of sql queries (1 per object), resulting in lots of data I do not need. The question: Wouldn't it be more effecient to use a single query, that only loads the required data? This would mean though, that I cannot use my DTOs. Any thoughts? Regards, Tom - 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]
Struts and Laszlo
Hia guys... I´would it be a nosense to integrate Laszlo with struts??? I think Laszlo is responsible for controlling the application, so, may be we can hav struts incharge of generating data in XML format so that Laszlo presentation server show it??? I´m thinking of extending struts so that its output be XML for laszlo (or who ever), abstracting it form HTML... am I making a mountain from a stone ... I mean, a servlet would be enough??? Luc __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
html-el:messages - bis
Greetings, I have sent this post more almost 2 days ago without one response. I hope it was simply lost with other posts but still worthy of attention. Here is the original post: I am unable to find a solution... even after searching... and waiting for the espresso to kick in. I have messages and would like to determine the number of messages in the bean. If there is more than one message format the output as a list or else just display the message. Unable to come up with something. This is what I am currently using: logic:messagesPresent message=true tr td colspan=5 class=informationalMessage html-el:messages id=message message=true bean: write name=message filter=false/br /html-el:messages /td td/td /tr tr td colspan=6 height=5/td /tr /logic:messagesPresent Any ideas would be greatly appreciated ! - Glenn
RE: [OT] Loading data for view
If you are thinking about using a single query and bypassing your DTO's then consider using the Data Transfer RowSet pattern; it can be a useful pattern for easily transferring data from a DAO to a view component. If it's disadvantages (clients need to know something about the database metadata, it ignores the domain model) are not relevant in your situation or if they can be minimised (allow its use for read only display or closely controlled use cases only) then it might work for you. BeanUtils provides a neat wrapper for the disconnected recordsets used in this pattern: org.apache.commons.beanutils.RowSetDynaClass. -Original Message- From: Tom Ziemer [mailto:[EMAIL PROTECTED] Sent: 18 August 2005 13:01 To: Struts Users Mailing List Subject: [OT] Loading data for view Hi everybody! In my app, I am using DAOs/DTOs to perform CRUD operations on a legacy database packed with lots of triggers and stored procedures. Some of my DTOs are pretty complex, meaning, they have to be assembled from many tables. A simple example: Object a (loaded by aDAO) has a list of b objects (loaded by bDAO), which in turn has a list of c objects (loaded by cDAO) The problem: In my struts-based webapp, I want to display some a objects on a page (the objects won't be used after that anymore). I need a few attributes from related object b but nothing at all from the related c objects. When I use my aDAO to retrieve my a objects, this will cause a large number of sql queries (1 per object), resulting in lots of data I do not need. The question: Wouldn't it be more effecient to use a single query, that only loads the required data? This would mean though, that I cannot use my DTOs. Any thoughts? Regards, Tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Modularizing struts-config.xml
At 11:44 AM +0530 8/18/05, sachin wrote: hi , Yes, you can use any number of struts-config files; there is a servlet init parameter which accepts a comma-separated list. I Have many struts-config files in one of my application and i initialized them with a comma separeted List ... EveryThing Works fine until it comes to ActionMessages In each struts-config file i defined the message-resources with a Key and accesssed them with that Key ... message-resources key=master parameter=org.para.resources.master.MasterMessageResources null=false / But the ActionMessage could not pick up messages from resource files which gave the biggest blow to my software and i had to show messages with JavaScript. could u please tell me how to Make the ActionMessages work with Multiple Struts Config file If you use key when defining a message resources file, then you must use the same value in the bundle attribute when using JSP tags which are meant to retrieve messages. As in: html:messages bundle=master id=msg${msg}/html:messages I've never needed to use more than one message-resources element in a project, so I haven't spent much time using these features, but that's how it works. If you are not specifying a bundle in html:messages or html:errors then Struts will look for a message-resources which was configured without any key attribute. See: http://struts.apache.org/userGuide/configuration.html#resources_config http://struts.apache.org/userGuide/struts-html.html#messages Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts with XSLT
Hi folks, This isn't your usual How do I do X? type question so get ready. Hopefully it will fuel a good discussion. I'm fairly new to struts but have a solid grasp of Model 2 design ideas. The problem, I suppose, is that I am a lone developer (for my own company) which makes it hard to get the balanced view of the technology arena that is aquired through working with other developers. Therefore I have a couple of high level architecture questions that I am interested to hear your views on. The current application that I am working on uses XSLT to generate web pages. As you wold expect a bunch of beans (and some other objects) get converted into XML, run against a stylesheet and out pops a page. This is fine and the application uses a good dose of Model 2 goodness so it's easy to manage and extend. Unfortunately, it has been developed with it's own MVC framework. I would like to convert it to use Struts but I don't want to throw away the flexibility given by using XSLT. Whoa. Before you all shout But Struts can use any technology for the view look at stxx I have had a look at it and stxx has the smell of death around it. As far as I can tell it has been abandoned and doesn't support Struts 1.2.x (the front page hasn't been updated in well over a year). Further more it is fairly obvious that Struts was designed with JSP in mind and while it may work with XSLT my experience of other technologies is that this type of usage with not be easy or pleasant. You are probably wondering by now why I even want to use XSLT rather than JSP. The reason is simple. XSLT provides a huge amount of flexibility and the cleanest separation of the view that I have found. I admit that it is a little more work to create a stylesheet rather than a JSP but I feel that is worth it. I'm not 100% dead set on using XSLT. I have learnt that it is generally not a good idea to go against the grain and if the arguments are compelling enough I will switch to JSP. The problem I have with JSP is that with every release it feels like it gets closer to XSLT. A site I recently developed using JSF + JSP 2.0 (jspx) felt like the pages were nothing more than dumbed down stylesheets. My other concern is that Struts 2.x seems to be heading towards total integration with JSF. While I love the simplicity of JSF and the speed with which one can create a web application it is unsuitable for use on an ecommerce site where the users are expected to be able to bookmark pages (using a refresh is a poor hack IMHO) and, more importantly, robots can't navigate JSF sites. A combination of technologies could be used but that then multiplies the cost of development and maintenance. Finally then the questions. * Should I just stop fighting city hall and abandon XSLT in favour of JSP? * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? Thanks for reading this far. I really look forward to hearing your views. Graham - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Loading data for view
Thanks for your answers. I added a new method to my DAO that allows me to execute predefined queries and returns kind of general-purpose-dtos, that only consist of a treemap which stores the requested values from the db. So I get one g-p-DTO per row in my ResultSet that can be passed to the view for rendering. Is this a bad design? Is the Transfer RowSet pattern suggested by Colm a cleaner approach? I am wondering whether this is not a common problem for any application that is based on database with a hierarchical design. Most of the time you won't need an entire object tree but only parts of it. Regards, Tom Frank W. Zammetti wrote: Sometimes the simplest answer is the best... and even when it isn't the best, it's *still* simple :) ... How about just creating a new DAO/DTO that only contains the data you need? It would be a duplication to a degree, but that's not *always* an absolutely evil thing... especially since it sounds like the new A object you want to display on the page may not truly model a real domain object (where they others I presume are) but is instead something of a hybrid, I could personally live with this. Either that, or I would just create a single Miscellaneous DAO that has methods that don't *quite* fit in other DAOs... maybe this is one of them... then you would still have a DTO for this particular case, and a new one for each particular case in the DAO, if any more came up. FYI, most of my apps have the true DAO/DTOs, but they all also have such a miscellaneous class for handling things exactly like this. There tend to be very few such cases, but they do come up, and I find this to be a nice way to organize them. In fact, in a couple of cases I've decided to make the DTOs inner classes of the DAO, just to make it obvious they are related and probably limited in their use cases. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and Laszlo
On 8/18/05, Lucas Bern [EMAIL PROTECTED] wrote: I´would it be a nosense to integrate Laszlo with struts??? Not a complete non-sense, but maybe an overkill ... I think Laszlo is responsible for controlling the application, so, may be we can hav struts incharge of generating data in XML format so that Laszlo presentation server show it??? Struts is great for the controller model it provides. If you develop a Laszlo application, Laszlo will probably take the role of the controller (at least that's how I would do it). The the server side should only serve stateless XML data. That's pretty easy to do with whatever technology. I´m thinking of extending struts so that its output be XML for laszlo (or who ever), abstracting it form HTML... am I making a mountain from a stone ... More or less yes. There's not much HTML dependant in Struts. I would say that the tag libs are the only really HTML dependant parts of Struts. And it's pretty easy to output XML with just the JSTL ... I mean, a servlet would be enough??? Yo uhave to think at which parts of Struts will be usefull for you. The input checking forms are probably usefull, the taglibs probably not ... I hope that helps a bit ... Guillaume PS : I've worked with Laszlo for a few month before abandoning it and coming back to Struts (with the help of AndroMDA - team.andromda.org). There was too many problems with memory management, asynchronous execution ... be carefull ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with XSLT
On Thursday 18 August 2005 16:02, Don Brown wrote: Hmm...smell of death for stxx might be a bit harsh :) Yeah ok, it was a bit harsh - sorry. I'll take another look. It's sometimes hard to know when a project is on it's last legs though. A message from one of the core developers within an hour is a pretty good assurance that it's alive and kicking though :o) While it true I need to get a release out that better supports 1.2, I've been using it in production for over a year without problems, and would recommend you take another look. You, of course, are welcome to get involved, submit patches, even join the project. I have been looking for a project to work on in my spare time (just a mo while I pick myself up off the floor from laughing at the idea of having spare time). If I decide to stick with XSLT I'll probably contribute. Regarding Struts and XSLT, I've had a good experience ditching JSP. XSLT is powerful and fun even once you get the hang of it. Now to your questions... On 8/18/05, Graham Smith [EMAIL PROTECTED] wrote: snip / * Should I just stop fighting city hall and abandon XSLT in favour of JSP? * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? Of course there isn't a Struts 2.0, yet anyways, but Struts Shale is already exploring an alternate view, HTML templates, for JSF and JSF itself is designed to be view independent, however, I haven't heard of any view handlers that use XSLT yet. I certainly couldn't call myself a JSF expert but I have, I believe, had enough experience of it to realise that the intended goal writing one page and using alternative renders for different devices doesn't really work. While it's great that you can, in theory, install other renders for the JSF tags it rapidly becomes almost impossible to maintain. I can't believe, for instance, that it would be possible to develop a page that would look good in both a standard browser and a mobile phone. This is at the heart of my interest in XSLT. It removes the whole plug-in render mess that JSF seems to have got itself into. On the flip side the reason I am interested in using JSPs is that I only need to develop for fully featured browsers. Thanks for the feedback, Graham Another project we are working on in the sandbox, Struts Ti, already has support for XSLT. Hope that helps, Don * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? Thanks for reading this far. I really look forward to hearing your views. Graham - 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]
link with img and request attribute
Hi EveryBody i have problem with this: 1) i have: a href=PreAddComment.do?idUser=bean:write name=user property=idUser /add/a 2) and it works fine, but i want to put image button insted of link add 3) how do i have to do that? html:link href= ? ? ? ? html:img page=/button.gif / /html:link 4) where put bean:write name=user property=idUser / ? thanks for reply regards Weź udział w naszym letnim konkursie AlleJazda! Główna nagroda to Nisan Micra! http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Faj.htmlsid=472 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Need help using tiles taglib with JSTL
I'm trying to use the tiles taglib with JSTL (servlet spec 2.4).. if I use just the HTML tags they work file, and JSTL 1.1 by itself works fine. The problem comes when I need to use them together. Here I have a list of inscriptions in the request scope and I want to loop through them and pass each one to a tile to display each one (individually). I can't figure out the way to call the tiles:useAttribute tag: c:forEach items=${listeInscriptions.inscriptions} var=inscription tiles:insert name=web-inscription flush=true tiles:useAttribute id=${inscription} classname=fr.data.Inscription name=inscription scope=request ignore=false/ /tiles:insert /c:forEach I'd be grateful for a bit of help with this. I've tried asking about mixing struts tags JSTL in the past week but haven't had a concrete example like this and now I'm really stuck. :) -Michael -- This E-mail is confidential. It may also be legally privileged. If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return E-mail. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Loading data for view
Sounds like you're using a data transfer (tree)map pattern, this is largely similar to the rowset version except for the following: * You have to copy values from the underlying data access solution into the TreeMap * Your view component needs to know about the contract for attribute keys in the map (or perhaps not, perhaps this is why you are using a TreeMap) In the rowset version you would wrap a disconnected recordset along with some meta data then use this meta data in your view component e.g. iterate over the metadata to output column headers for your table, then iterate over the data rows to output your data rows. Which is better? No cut and dried answer but here are the pros and cons for both so that you can decide. Rowset Approach --- Pros: * Common interface for all general purpose, read only query operations * Enables you to write generic table display code by using taglibs to iterate over the rowset/map * Responds well to change - the absence of a data translation layer coupled with the use of generic table display code leaves you view indifferent to changes in the underlying data set Cons: * Clients need to know the name of database table columns * Bypasses the domain model, breaks some rules about separation of responsibilities (this shouldn't be a showstopper if it is used in carefully controlled situations such as displaying read only data in a tabular manner) * Loss of type safety (no compile time checking) Map Approach Pros: * Minimises the data translation layer (assuming you can generically translate a record set into a map) * Enables you to write generic table display code by using taglibs to iterate over the rowset/map (assuming you can make assumptions about the order in which the map entries are stored) * Responds well to change - although not as well as the rowset version Cons: * Clients need to know about the contract governing the naming of the map keys * Loss of type safety (no compile time checking) * You'll need to wrap primitives and most access will require casting -Original Message- From: Tom Ziemer [mailto:[EMAIL PROTECTED] Sent: 18 August 2005 15:52 To: Struts Users Mailing List Subject: Re: [OT] Loading data for view Thanks for your answers. I added a new method to my DAO that allows me to execute predefined queries and returns kind of general-purpose-dtos, that only consist of a treemap which stores the requested values from the db. So I get one g-p-DTO per row in my ResultSet that can be passed to the view for rendering. Is this a bad design? Is the Transfer RowSet pattern suggested by Colm a cleaner approach? I am wondering whether this is not a common problem for any application that is based on database with a hierarchical design. Most of the time you won't need an entire object tree but only parts of it. Regards, Tom Frank W. Zammetti wrote: Sometimes the simplest answer is the best... and even when it isn't the best, it's *still* simple :) ... How about just creating a new DAO/DTO that only contains the data you need? It would be a duplication to a degree, but that's not *always* an absolutely evil thing... especially since it sounds like the new A object you want to display on the page may not truly model a real domain object (where they others I presume are) but is instead something of a hybrid, I could personally live with this. Either that, or I would just create a single Miscellaneous DAO that has methods that don't *quite* fit in other DAOs... maybe this is one of them... then you would still have a DTO for this particular case, and a new one for each particular case in the DAO, if any more came up. FYI, most of my apps have the true DAO/DTOs, but they all also have such a miscellaneous class for handling things exactly like this. There tend to be very few such cases, but they do come up, and I find this to be a nice way to organize them. In fact, in a couple of cases I've decided to make the DTOs inner classes of the DAO, just to make it obvious they are related and probably limited in their use cases. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Loading data for view
Thank you, for your very elaborate answer. After reading your post, it seems that there is really no big difference between the two approaches, so I guess I'll stick with what I've already implemented. I guess losing type safety is not a big issue, since I'll only use my special DTOs for display purposes and thus all values are casted to stings anyway. So could we summarize this thread by saying, use DTOs only when all relationships are required and stick to custom queries when it comes to displaying data, or is this view to simplistic? Are there any common guidelines that help you decide, which approach to apply in a given situation? Regards, Tom McDonnell, Colm (MLIM) wrote: Sounds like you're using a data transfer (tree)map pattern, this is largely similar to the rowset version except for the following: * You have to copy values from the underlying data access solution into the TreeMap * Your view component needs to know about the contract for attribute keys in the map (or perhaps not, perhaps this is why you are using a TreeMap) In the rowset version you would wrap a disconnected recordset along with some meta data then use this meta data in your view component e.g. iterate over the metadata to output column headers for your table, then iterate over the data rows to output your data rows. Which is better? No cut and dried answer but here are the pros and cons for both so that you can decide. Rowset Approach --- Pros: * Common interface for all general purpose, read only query operations * Enables you to write generic table display code by using taglibs to iterate over the rowset/map * Responds well to change - the absence of a data translation layer coupled with the use of generic table display code leaves you view indifferent to changes in the underlying data set Cons: * Clients need to know the name of database table columns * Bypasses the domain model, breaks some rules about separation of responsibilities (this shouldn't be a showstopper if it is used in carefully controlled situations such as displaying read only data in a tabular manner) * Loss of type safety (no compile time checking) Map Approach Pros: * Minimises the data translation layer (assuming you can generically translate a record set into a map) * Enables you to write generic table display code by using taglibs to iterate over the rowset/map (assuming you can make assumptions about the order in which the map entries are stored) * Responds well to change - although not as well as the rowset version Cons: * Clients need to know about the contract governing the naming of the map keys * Loss of type safety (no compile time checking) * You'll need to wrap primitives and most access will require casting -Original Message- From: Tom Ziemer [mailto:[EMAIL PROTECTED] Sent: 18 August 2005 15:52 To: Struts Users Mailing List Subject: Re: [OT] Loading data for view Thanks for your answers. I added a new method to my DAO that allows me to execute predefined queries and returns kind of general-purpose-dtos, that only consist of a treemap which stores the requested values from the db. So I get one g-p-DTO per row in my ResultSet that can be passed to the view for rendering. Is this a bad design? Is the Transfer RowSet pattern suggested by Colm a cleaner approach? I am wondering whether this is not a common problem for any application that is based on database with a hierarchical design. Most of the time you won't need an entire object tree but only parts of it. Regards, Tom Frank W. Zammetti wrote: Sometimes the simplest answer is the best... and even when it isn't the best, it's *still* simple :) ... How about just creating a new DAO/DTO that only contains the data you need? It would be a duplication to a degree, but that's not *always* an absolutely evil thing... especially since it sounds like the new A object you want to display on the page may not truly model a real domain object (where they others I presume are) but is instead something of a hybrid, I could personally live with this. Either that, or I would just create a single Miscellaneous DAO that has methods that don't *quite* fit in other DAOs... maybe this is one of them... then you would still have a DTO for this particular case, and a new one for each particular case in the DAO, if any more came up. FYI, most of my apps have the true DAO/DTOs, but they all also have such a miscellaneous class for handling things exactly like this. There tend to be very few such cases, but they do come up, and I find this to be a nice way to organize them. In fact, in a couple of cases I've decided to make the DTOs inner classes of the DAO, just to make it obvious they are related and probably limited in their use cases.
Re: Struts with XSLT
On 8/18/05, Graham Smith [EMAIL PROTECTED] wrote: * Should I just stop fighting city hall and abandon XSLT in favour of JSP? Two thoughts strike me as I read your discussion, and the reasoning for which you like XSLT: * You seem to be concluding that XSLT and JSP are mutually exclusive. Especially with JSP 2.0, this isn't really true ... any well formed XML document is also a valid JSP2 page (in the XML syntax). Why not build your XML document templates as JSPX pages, use the Struts or JSF tags to pull in the dynamic data, and post-process with XSLT in a filter? * If you really like XSLT, you should probably look at using a framework like Cocoon, where transformation pipelines *are* the mainstream technology. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts with XSLT
I used XSLT for all my applications to generate content as html files which Struts includes in a page template using tiles. It also allows me to search the pages as pure html content. If you are putting logic in your page you could... don't shudder, use XSLT to generate JSP's. -Original Message- From: Graham Smith [mailto:[EMAIL PROTECTED] Sent: 18 August 2005 15:13 To: user@struts.apache.org Subject: Struts with XSLT Hi folks, This isn't your usual How do I do X? type question so get ready. Hopefully it will fuel a good discussion. I'm fairly new to struts but have a solid grasp of Model 2 design ideas. The problem, I suppose, is that I am a lone developer (for my own company) which makes it hard to get the balanced view of the technology arena that is aquired through working with other developers. Therefore I have a couple of high level architecture questions that I am interested to hear your views on. The current application that I am working on uses XSLT to generate web pages. As you wold expect a bunch of beans (and some other objects) get converted into XML, run against a stylesheet and out pops a page. This is fine and the application uses a good dose of Model 2 goodness so it's easy to manage and extend. Unfortunately, it has been developed with it's own MVC framework. I would like to convert it to use Struts but I don't want to throw away the flexibility given by using XSLT. Whoa. Before you all shout But Struts can use any technology for the view look at stxx I have had a look at it and stxx has the smell of death around it. As far as I can tell it has been abandoned and doesn't support Struts 1.2.x (the front page hasn't been updated in well over a year). Further more it is fairly obvious that Struts was designed with JSP in mind and while it may work with XSLT my experience of other technologies is that this type of usage with not be easy or pleasant. You are probably wondering by now why I even want to use XSLT rather than JSP. The reason is simple. XSLT provides a huge amount of flexibility and the cleanest separation of the view that I have found. I admit that it is a little more work to create a stylesheet rather than a JSP but I feel that is worth it. I'm not 100% dead set on using XSLT. I have learnt that it is generally not a good idea to go against the grain and if the arguments are compelling enough I will switch to JSP. The problem I have with JSP is that with every release it feels like it gets closer to XSLT. A site I recently developed using JSF + JSP 2.0 (jspx) felt like the pages were nothing more than dumbed down stylesheets. My other concern is that Struts 2.x seems to be heading towards total integration with JSF. While I love the simplicity of JSF and the speed with which one can create a web application it is unsuitable for use on an ecommerce site where the users are expected to be able to bookmark pages (using a refresh is a poor hack IMHO) and, more importantly, robots can't navigate JSF sites. A combination of technologies could be used but that then multiplies the cost of development and maintenance. Finally then the questions. * Should I just stop fighting city hall and abandon XSLT in favour of JSP? * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? Thanks for reading this far. I really look forward to hearing your views. Graham - 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: Best way to store config variables
Have you considered Spring and it's IOC framework? Works wonderfully with Struts (even has a lovely plug-in to get the whole thing working together). The configuration is only one aspect of the whole Spring framework. I was reading about Sprint but I was unable to catch what the Spring really is. I have found tutorials but there was only presented some features, no methodology like in Struts tutorials. I must sit and read about it more. Configuration using some framework sounds very interesting. Could you give me some links where I could see how to handle configuration using Spring? Best regards, Konrad Billewicz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How can I refer a control in javascript which hava a . in its name
Hi everyone: Here is my jsp: html:form ... html:select ... onChange=change(this) ... /html:select html:text name=myForm property=myobject.subobject .../ /html:form If user change the selection in the select, I would like to change the content of the text. Thus, I write my change() function in javascript: script language=javascript function change(select){ document.form[0].myobject.subobject = select.options[select.selectedIndex]; } But looks like this does not work. The problem is the name of the text. In the html it is myobject.subobject. But seems that javascript does not take that How can I refer the text in javascript? Thanks, Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can I refer a control in javascript which hava a . in its name
html:text name=myForm property=myobject.subobject styleId=subobject .../ then get the field by using document.getElementById(subobject); Tony Smith [EMAIL PROTECTED] Tony Smith [EMAIL PROTECTED] 08/18/2005 01:07 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject How can I refer a control in _javascript_ which hava a . in its name Hi everyone: Here is my jsp: html:form ... html:select ... > ... /html:select html:text name=myForm property=myobject.subobject .../ /html:form If user change the selection in the select, I would like to change the content of the text. Thus, I write my change() function in _javascript_: script language=_javascript_ function change(select){ document.form[0].myobject.subobject = select.options[select.selectedIndex]; } But looks like this does not work. The problem is the name of the text. In the html it is myobject.subobject. But seems that _javascript_ does not take that How can I refer the text in _javascript_? Thanks, Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html-el:messages - bis
I can't think of a way to find out how many messages are queued for display, but you could do something like this (ugly, and untested): c:set var=first value=true/ c:set var=prev value=/ html:messages id=msg c:if test=${not empty prev} %-- 2nd or subsequent messsage --% c:if test=${first} %-- This is the 2nd message of N; start the list --% c:set var=first value=false/ ul /c:if %-- output previous message --% lic:out value=${prev}//li /c:if %-- Store current message --% c:set var=prev value=${msg}/ /html:messages c:if test=${not empty prev} %-- There was at least one message --% c:if test=${first} %-- There was only one message; show it --% c:out value=${prev}/ /c:if c:if test=${not first} %-- There was more than one message; output final message and end list. --% lic:out value=${prev}//li/ul /c:if /c:if [EMAIL PROTECTED] wrote: Greetings, I have sent this post more almost 2 days ago without one response. I hope it was simply lost with other posts but still worthy of attention. Here is the original post: I am unable to find a solution... even after searching... and waiting for the espresso to kick in. I have messages and would like to determine the number of messages in the bean. If there is more than one message format the output as a list or else just display the message. Unable to come up with something. This is what I am currently using: logic:messagesPresent message=true tr td colspan=5 class=informationalMessage html-el:messages id=message message=true bean: write name=message filter=false/br /html-el:messages /td td/td /tr tr td colspan=6 height=5/td /tr /logic:messagesPresent Any ideas would be greatly appreciated ! - Glenn -- Laurie Harper Open Source advocate, Java geek: http://www.holoweb.net/laurie Founder, Zotech Software: http://www.zotechsoftware.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html-el:messages - bis
Heh: even more of a hack, provided you're OK keeping with lists rather than tables as in your original example: logic:messagesPresent message=true c:set var=count value=0/ ul id=msgs html:messages id=msg c:set var=count value=${count + 1}/ lic:out value=${msg}//li /html:messages /ul c:if test=${count gt 1}/ style #msgs { list-style: none; } /style /c:if /logic:messagesPresent/ Laurie Harper wrote: I can't think of a way to find out how many messages are queued for display, but you could do something like this (ugly, and untested): c:set var=first value=true/ c:set var=prev value=/ html:messages id=msg c:if test=${not empty prev} %-- 2nd or subsequent messsage --% c:if test=${first} %-- This is the 2nd message of N; start the list --% c:set var=first value=false/ ul /c:if %-- output previous message --% lic:out value=${prev}//li /c:if %-- Store current message --% c:set var=prev value=${msg}/ /html:messages c:if test=${not empty prev} %-- There was at least one message --% c:if test=${first} %-- There was only one message; show it --% c:out value=${prev}/ /c:if c:if test=${not first} %-- There was more than one message; output final message and end list. --% lic:out value=${prev}//li/ul /c:if /c:if [EMAIL PROTECTED] wrote: Greetings, I have sent this post more almost 2 days ago without one response. I hope it was simply lost with other posts but still worthy of attention. Here is the original post: I am unable to find a solution... even after searching... and waiting for the espresso to kick in. I have messages and would like to determine the number of messages in the bean. If there is more than one message format the output as a list or else just display the message. Unable to come up with something. This is what I am currently using: logic:messagesPresent message=true tr td colspan=5 class=informationalMessage html-el:messages id=message message=true bean: write name=message filter=false/br /html-el:messages /td td/td /tr tr td colspan=6 height=5/td /tr /logic:messagesPresent Any ideas would be greatly appreciated ! - Glenn -- Laurie Harper Open Source advocate, Java geek: http://www.holoweb.net/laurie Founder, Zotech Software: http://www.zotechsoftware.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with XSLT
I have also successfully used Struts and XSLT, Haven't had an issue. I currently use JSP to generate the dynamic top component, and then include the XSLT generated HTML in the main content area. I think that it is easier to manipulate XML with XSLT then it is to do it with JSP/Tags. -John On Aug 18, 2005, at 12:36 PM, Mark Benussi wrote: I used XSLT for all my applications to generate content as html files which Struts includes in a page template using tiles. It also allows me to search the pages as pure html content. If you are putting logic in your page you could... don't shudder, use XSLT to generate JSP's. -Original Message- From: Graham Smith [mailto:[EMAIL PROTECTED] Sent: 18 August 2005 15:13 To: user@struts.apache.org Subject: Struts with XSLT Hi folks, This isn't your usual How do I do X? type question so get ready. Hopefully it will fuel a good discussion. I'm fairly new to struts but have a solid grasp of Model 2 design ideas. The problem, I suppose, is that I am a lone developer (for my own company) which makes it hard to get the balanced view of the technology arena that is aquired through working with other developers. Therefore I have a couple of high level architecture questions that I am interested to hear your views on. The current application that I am working on uses XSLT to generate web pages. As you wold expect a bunch of beans (and some other objects) get converted into XML, run against a stylesheet and out pops a page. This is fine and the application uses a good dose of Model 2 goodness so it's easy to manage and extend. Unfortunately, it has been developed with it's own MVC framework. I would like to convert it to use Struts but I don't want to throw away the flexibility given by using XSLT. Whoa. Before you all shout But Struts can use any technology for the view look at stxx I have had a look at it and stxx has the smell of death around it. As far as I can tell it has been abandoned and doesn't support Struts 1.2.x (the front page hasn't been updated in well over a year). Further more it is fairly obvious that Struts was designed with JSP in mind and while it may work with XSLT my experience of other technologies is that this type of usage with not be easy or pleasant. You are probably wondering by now why I even want to use XSLT rather than JSP. The reason is simple. XSLT provides a huge amount of flexibility and the cleanest separation of the view that I have found. I admit that it is a little more work to create a stylesheet rather than a JSP but I feel that is worth it. I'm not 100% dead set on using XSLT. I have learnt that it is generally not a good idea to go against the grain and if the arguments are compelling enough I will switch to JSP. The problem I have with JSP is that with every release it feels like it gets closer to XSLT. A site I recently developed using JSF + JSP 2.0 (jspx) felt like the pages were nothing more than dumbed down stylesheets. My other concern is that Struts 2.x seems to be heading towards total integration with JSF. While I love the simplicity of JSF and the speed with which one can create a web application it is unsuitable for use on an ecommerce site where the users are expected to be able to bookmark pages (using a refresh is a poor hack IMHO) and, more importantly, robots can't navigate JSF sites. A combination of technologies could be used but that then multiplies the cost of development and maintenance. Finally then the questions. * Should I just stop fighting city hall and abandon XSLT in favour of JSP? * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? Thanks for reading this far. I really look forward to hearing your views. Graham - 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: Struts with XSLT
On 8/18/05, Graham Smith [EMAIL PROTECTED] wrote: * Should I just stop fighting city hall and abandon XSLT in favour of JSP? No. XML/XSLT is more flexible than JSP and has been supported bunch of other markup tecnhologies like XML, XHTML and XPath for a long time. Keep it if it works. Don't forget that modern browsers can accept XML and have built-in XSLT processor. So, you can send your serialized bean data as XML with linked XSLT stylesheet with linked CSS stylesheet. * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? You can do it in Struts 1.x too. Instead of forwarding to JSP page just stick XML (or XML/XSLT already processed into HTML) into response object and return null from an Action class. Apparently, you would use ActionForm for input only with request scope, and store your app data somewhere in the session or in database. Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with XSLT
On Thursday 18 August 2005 20:32, Michael Jouravlev wrote: On 8/18/05, Graham Smith [EMAIL PROTECTED] wrote: * Should I just stop fighting city hall and abandon XSLT in favour of JSP? No. XML/XSLT is more flexible than JSP and has been supported bunch of other markup tecnhologies like XML, XHTML and XPath for a long time. Keep it if it works. Don't forget that modern browsers can accept XML and have built-in XSLT processor. So, you can send your serialized bean data as XML with linked XSLT stylesheet with linked CSS stylesheet. I'm glad to see there is some support for XSLT. Makes me feel like I haven't been barking up the wrong tree for the last few years. Sending the XML to the client is a nice idea in principal but has so many problems that IMHO it's not worth it. Transformation server side is cheap enough now that I don't worry about doing it. * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? You can do it in Struts 1.x too. Instead of forwarding to JSP page just stick XML (or XML/XSLT already processed into HTML) into response object and return null from an Action class. Apparently, you would use ActionForm for input only with request scope, and store your app data somewhere in the session or in database. That's an interesting idea. I have a look into that. Thanks Graham Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Struts with XSLT
-Ursprüngliche Nachricht- Von: Michael Jouravlev [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 18. August 2005 21:33 An: Struts Users Mailing List Betreff: Re: Struts with XSLT On 8/18/05, Graham Smith [EMAIL PROTECTED] wrote: * Should I just stop fighting city hall and abandon XSLT in favour of JSP? Yes :-) Really. We did it a year ago, and gained A LOT of performance. Not to mention that XSLT is much less powerful then jsp (custom tags, etc). At least as long, as you are using an existing renderer. No. XML/XSLT is more flexible than JSP and has been supported bunch of other markup tecnhologies like XML, XHTML and XPath for a long time. And are very much slower to. Keep it if it works. Don't forget that modern browsers can accept XML and have built-in XSLT processor. So, you can send your serialized bean data as XML with linked XSLT stylesheet with linked CSS stylesheet. Now this is an urban legend :-) Each browser support it it's own way. Not to mention each version of the redmond browser supports ist own extensions. None of them are compatible. * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? You can do it in Struts 1.x too. Instead of forwarding to JSP page just stick XML (or XML/XSLT already processed into HTML) into response object and return null from an Action class. Apparently, you would use ActionForm for input only with request scope, and store your app data somewhere in the session or in database. Actually it's better to write out the dom object (if you have one, but you should, if you seriously want xslt/xml). I would also look into rendering with SAX, it could probably give you 40-50% more performance then dom rendering. Regards Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with XSLT
I'm glad to see there is some support for XSLT. Makes me feel like I haven't been barking up the wrong tree for the last few years. Sending the XML to the client is a nice idea in principal but has so many problems that IMHO it's not worth it. Transformation server side is cheap enough now that I don't worry about doing it. Aehm... Sorry, but this isn't quite true. Server side transformation is the most expensive part and the biggest problem of XSLT (and client transformation doesn't work properly, as you mentioned). We tested relatively complex html pages, rendered with xslt against jsp. The simpliest transformation (3K page) lasted about 50 milliseconds, a JSP needed max 5 ms on the same machine. Complex pages (a lot of iterations and custom/struts tags) needed about 50-70 ms, same page with XSLT took half a second. And then, with XSLT DOM transformation you need TONS of RAM. I don't think you can serve max 200-250 users per machine with XSLT, whether with JSP you can easily go into 600-700 hundreds on a cheap intel machine (3.4Ghz prescott with 1024 cache, 2 gig ram for example). Regards Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with XSLT
On Thursday 18 August 2005 20:52, Leon Rosenberg wrote: I'm glad to see there is some support for XSLT. Makes me feel like I haven't been barking up the wrong tree for the last few years. Sending the XML to the client is a nice idea in principal but has so many problems that IMHO it's not worth it. Transformation server side is cheap enough now that I don't worry about doing it. Aehm... Sorry, but this isn't quite true. Server side transformation is the most expensive part and the biggest problem of XSLT (and client transformation doesn't work properly, as you mentioned). We tested relatively complex html pages, rendered with xslt against jsp. The simpliest transformation (3K page) lasted about 50 milliseconds, a JSP needed max 5 ms on the same machine. Complex pages (a lot of iterations and custom/struts tags) needed about 50-70 ms, same page with XSLT took half a second. And then, with XSLT DOM transformation you need TONS of RAM. I don't think you can serve max 200-250 users per machine with XSLT, whether with JSP you can easily go into 600-700 hundreds on a cheap intel machine (3.4Ghz prescott with 1024 cache, 2 gig ram for example). I agree it is a lot more expensive than JSP but you get a lot of flexibility and it is very easy to create a transformation farm. (Un)Fortunately I don't have to deal with those sorts of loads at the moment. Graham 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: Struts with XSLT
On 8/18/05, Leon Rosenberg [EMAIL PROTECTED] wrote: On 8/18/05, Graham Smith [EMAIL PROTECTED] wrote: * Should I just stop fighting city hall and abandon XSLT in favour of JSP? Yes :-) Really. We did it a year ago, and gained A LOT of performance. Not to mention that XSLT is much less powerful then jsp (custom tags, etc). At least as long, as you are using an existing renderer. Examples? Custom tags, you say? Parameterised templates are at least no worse. Also, XSLT can be used with any host system, be it Java or .NET. Portability, is what this is called? ;) No. XML/XSLT is more flexible than JSP and has been supported bunch of other markup tecnhologies like XML, XHTML and XPath for a long time. And are very much slower to. Ever heard of translets? But even if you call XSLT processor for every request, I D-O-N'T C-A-R-E. This is not a software problem, this is a hardware problem. And even expensive hardware in the end of the day comes cheaper than money spent for software workarounds. Your experience with zillions of concurrent customers may tell you different things, I try to respect that ;) Keep it if it works. Don't forget that modern browsers can accept XML and have built-in XSLT processor. So, you can send your serialized bean data as XML with linked XSLT stylesheet with linked CSS stylesheet. Now this is an urban legend :-) Each browser support it it's own way. Not to mention each version of the redmond browser supports ist own extensions. None of them are compatible. Umm, MSXML or whatever it was called, has an old XSLT implementation. MSIE 6.0 XSLT processor is much better. And it is around for 5 years, so customers with MSIE less than version 6 should be simply not supported. Heck, they probably already have bought a new car since they installed MSIE 5. Now it is time to change oil in their computer too. * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? You can do it in Struts 1.x too. Instead of forwarding to JSP page just stick XML (or XML/XSLT already processed into HTML) into response object and return null from an Action class. Apparently, you would use ActionForm for input only with request scope, and store your app data somewhere in the session or in database. Actually it's better to write out the dom object (if you have one, but you should, if you seriously want xslt/xml). I would also look into rendering with SAX, it could probably give you 40-50% more performance then dom rendering. Did not quite get that. If you want to work directly with DOM, then you probably need to return XML, that is what Ajax components usually do. If you return server-side-processed HTML, then what DOM are you talking about? Well yes, browser will create DOM based on HTML received, but you do not alter DOM *directly* from server. Oh, you did not mean browser DOM? You meant to return XML containg app data from server-side DOM? Then how does that correlate with your dismissal of client-side XSLT processing? Also, try StAX. I have not run any perfomance tests myself, but they say it is faster than SAX. At least, not slower. And is easier to use. Get one from Sun's JSWDP 1.6, don't use JSWDP 1.5, it contains a serious parsing bug. Had a problem and it took a while to realise that it had been in fact not my fault this time ;) Michael. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Testing Struts With JUnit
I´m trying to test the action below : public class FamiliaDNCAction extends BasicAction { public ActionForward unspecified(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws BusinessException { Set msgs = new HashSet(); return loadPage(actionMapping,actionForm,request,response); } public ActionForward loadPage(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws BusinessException { HttpSession session=request.getSession(); CadastroFamiliaDNC cad = new CadastroFamiliaDNC(); FamiliaDNCForm form = (FamiliaDNCForm) actionForm; List dados = cad.findByCodigoDependencia(form.getCodDependencia().intValue()); session.setAttribute(dadosdnc,dados); return actionMapping.findForward(inicial); } } The parameters for the action are FamiliaDNC.do -- calls the class ev -- the parameter for the method, when not set calls unspecified method public class TestFamiliaDNCAction extends MockStrutsTestCase{ FamiliaDNCAction fdnca; public TestFamiliaDNCAction(String nomeDoTeste) { super(nomeDoTeste); } public void setUp() throws Exception { super.setUp(); fdnca = new FamiliaDNCAction(); } public void testLoadPage() { addRequestParameter(codDependencia,1); addRequestParameter(codTipoFamiliaInsumo,0); addRequestParameter(ev,unspecified); setRequestPathInfo(/corporativo/cadastro/cadFamiliaDNC); actionPerform(); verifyForward(inicial); verifyForwardPath(/corporativo/cadastro/corp_cad_familia_dnc.jsp); verifyNoActionErrors(); } I´m getting nullPointerException, when i try to test it. I´m not sure witch parameters i add to the request for example in the action form i have: form name=form2 method=post action=./cadFamiliaDNC.do input type=hidden name=codFamiliaDNC value= input type=hidden name=codTipoFamiliaInsumo input type=hidden name=codDependencia . /form My question is, witch parameters do i put in the addRequestParameter(?,?); ? any clue ? Thanks in advance regards.. Luiz Octavio Godoy Desenvolvimento de Sistemas __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: How can I refer a control in javascript which hava a . in its name
You also have the option of doing document.form[0]['myobject.subobject']. On 8/18/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: html:text name=myForm property=myobject.subobject styleId=subobject .../ then get the field by using document.getElementById(subobject); Tony Smith [EMAIL PROTECTED] Tony Smith [EMAIL PROTECTED] 08/18/2005 01:07 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject How can I refer a control in javascript which hava a . in its name Hi everyone: Here is my jsp: html:form ... html:select ... onChange=change(this) ... /html:select html:text name=myForm property=myobject.subobject .../ /html:form If user change the selection in the select, I would like to change the content of the text. Thus, I write my change() function in javascript: script language=javascript function change(select){ document.form[0].myobject.subobject = select.options[select.selectedIndex]; } But looks like this does not work. The problem is the name of the text. In the html it is myobject.subobject. But seems that javascript does not take that How can I refer the text in javascript? Thanks, Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Struts with XSLT
-Ursprüngliche Nachricht- Von: Michael Jouravlev [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 18. August 2005 22:11 An: Struts Users Mailing List Betreff: Re: Struts with XSLT Ever heard of translets? But even if you call XSLT processor for every request, I D-O-N'T C-A-R-E. This is not a software problem, this is a hardware problem. And even expensive hardware in the end of the day comes cheaper than money spent for software workarounds. Your experience with zillions of concurrent customers may tell you different things, I try to respect that ;) Well, there are actually some hardware requirements, like max. amount of RAM you can use effectively on linux and so on. But, by the way, who said, the software development with XSLT/XML is faster then with JSP/JAVA-Objects? I highly doubt it :-) Keep it if it works. Don't forget that modern browsers can accept XML and have built-in XSLT processor. So, you can send your serialized bean data as XML with linked XSLT stylesheet with linked CSS stylesheet. Now this is an urban legend :-) Each browser support it it's own way. Not to mention each version of the redmond browser supports ist own extensions. None of them are compatible. Umm, MSXML or whatever it was called, has an old XSLT implementation. MSIE 6.0 XSLT processor is much better. And it is around for 5 years, so customers with MSIE less than version 6 should be simply not supported. Heck, they probably already have bought a new car since they installed MSIE 5. Now it is time to change oil in their computer too. I'm not even sure, that 6.0 sp1 and 6.0 sp2 have the same xslt processor. My experience with microsoft tells me, that 7.0 will differ. Not to mention mozilla and opera. And what about the coming google browser? * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? You can do it in Struts 1.x too. Instead of forwarding to JSP page just stick XML (or XML/XSLT already processed into HTML) into response object and return null from an Action class. Apparently, you would use ActionForm for input only with request scope, and store your app data somewhere in the session or in database. Actually it's better to write out the dom object (if you have one, but you should, if you seriously want xslt/xml). I would also look into rendering with SAX, it could probably give you 40-50% more performance then dom rendering. Did not quite get that. If you want to work directly with DOM, then you probably need to return XML, that is what Ajax components usually do. If you return server-side-processed HTML, then what DOM are you talking about? Well yes, browser will create DOM based on HTML received, but you do not alter DOM *directly* from server. Oh, you did not mean browser DOM? You meant to return XML containg app data from server-side DOM? Then how does that correlate with your dismissal of client-side XSLT processing? I must have misunderstand what i read, mea culpa :-) But funny things, with resin, a jsp which is rendering xml is faster then xml written out by servlet, which is faster then xml written out by the action (The JSPWriter in resin is highly optimized). What i ment with DOM, was not writing xml somehow, but leting your business logic return dom-objects instead of whatever-we-might-call-it normal java objects. On the other hand, it would mean transmitting overhead on the net between webserver and business logic. But if you use an XML DB on the other hand... Ok, let's say, you have to test it out :-) Also, try StAX. I have not run any perfomance tests myself, but they say it is faster than SAX. At least, not slower. And is easier to use. Get one from Sun's JSWDP 1.6, don't use JSWDP 1.5, it contains a serious parsing bug. Had a problem and it took a while to realise that it had been in fact not my fault this time ;) Notched, thanx. Michael. 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: Struts with XSLT
Anybody knows how I can generate JSP with struts tags with XSLT and pass JSP to JSPProcessor, for compile them? Because I have tags that client browse simple don't known. -Original Message- From: John Martyniak [mailto:[EMAIL PROTECTED] Sent: Thu 8/18/2005 7:08 AM To: Struts Users Mailing List Cc: Subject: Re: Struts with XSLT I have also successfully used Struts and XSLT, Haven't had an issue. I currently use JSP to generate the dynamic top component, and then include the XSLT generated HTML in the main content area. I think that it is easier to manipulate XML with XSLT then it is to do it with JSP/Tags. -John On Aug 18, 2005, at 12:36 PM, Mark Benussi wrote: I used XSLT for all my applications to generate content as html files which Struts includes in a page template using tiles. It also allows me to search the pages as pure html content. If you are putting logic in your page you could... don't shudder, use XSLT to generate JSP's. -Original Message- From: Graham Smith [mailto:[EMAIL PROTECTED] Sent: 18 August 2005 15:13 To: user@struts.apache.org Subject: Struts with XSLT Hi folks, This isn't your usual How do I do X? type question so get ready. Hopefully it will fuel a good discussion. I'm fairly new to struts but have a solid grasp of Model 2 design ideas. The problem, I suppose, is that I am a lone developer (for my own company) which makes it hard to get the balanced view of the technology arena that is aquired through working with other developers. Therefore I have a couple of high level architecture questions that I am interested to hear your views on. The current application that I am working on uses XSLT to generate web pages. As you wold expect a bunch of beans (and some other objects) get converted into XML, run against a stylesheet and out pops a page. This is fine and the application uses a good dose of Model 2 goodness so it's easy to manage and extend. Unfortunately, it has been developed with it's own MVC framework. I would like to convert it to use Struts but I don't want to throw away the flexibility given by using XSLT. Whoa. Before you all shout But Struts can use any technology for the view look at stxx I have had a look at it and stxx has the smell of death around it. As far as I can tell it has been abandoned and doesn't support Struts 1.2.x (the front page hasn't been updated in well over a year). Further more it is fairly obvious that Struts was designed with JSP in mind and while it may work with XSLT my experience of other technologies is that this type of usage with not be easy or pleasant. You are probably wondering by now why I even want to use XSLT rather than JSP. The reason is simple. XSLT provides a huge amount of flexibility and the cleanest separation of the view that I have found. I admit that it is a little more work to create a stylesheet rather than a JSP but I feel that is worth it. I'm not 100% dead set on using XSLT. I have learnt that it is generally not a good idea to go against the grain and if the arguments are compelling enough I will switch to JSP. The problem I have with JSP is that with every release it feels like it gets closer to XSLT. A site I recently developed using JSF + JSP 2.0 (jspx) felt like the pages were nothing more than dumbed down stylesheets. My other concern is that Struts 2.x seems to be heading towards total integration with JSF. While I love the simplicity of JSF and the speed with which one can create a web application it is unsuitable for use on an ecommerce site where the users are expected to be able to bookmark pages (using a refresh is a poor hack IMHO) and, more importantly, robots can't navigate JSF sites. A combination of technologies could be used but that then multiplies the cost of development and maintenance. Finally then the questions. * Should I just stop fighting city hall and abandon XSLT in favour
RE: Struts with XSLT
Hi All, Seems a bit of the silver bullet scenario is going in the discussion of XSLT versus Struts approach, someone has correctly said there's no silver bullet. You are required to use your judgement based on your experience on which tool/technique to use for what situation for optimal results. Again I don't claim to know all but here' my 2 cents on some of these off the top of my head:- XML/XSLT Pros i. Multiple rendering formats for multiple channels/devices. HTML/WML/... Cons i. Usually very slow for complex page with lot of transformations Struts Pros - a. Cleaning up very complex navigations into more manageable and maintainable structure. Cons a. It's in bed with JSP rendering, and lot of the add-ons can't be utilized generically such as in the case of XMS/XSLT Again technologies tend to evolve over time, just like Servlets was the thing to do when all you had was CGI, and Struts improvised on Servlets to make the hard wiring and navigation of the controller servlet into more managable XML configuration. And now there's JSF/Shales/Spring Framework and God knows what else... so take your pick and mix and match for best results! There no silver bullet is what I'll still say... with time everything changes. Regards, Dharmendra ps: have a good day! -Original Message- From: Leon Rosenberg [mailto:[EMAIL PROTECTED] Sent: Thursday, August 18, 2005 4:28 PM To: 'Struts Users Mailing List' Subject: AW: Struts with XSLT -Ursprüngliche Nachricht- Von: Michael Jouravlev [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 18. August 2005 22:11 An: Struts Users Mailing List Betreff: Re: Struts with XSLT Ever heard of translets? But even if you call XSLT processor for every request, I D-O-N'T C-A-R-E. This is not a software problem, this is a hardware problem. And even expensive hardware in the end of the day comes cheaper than money spent for software workarounds. Your experience with zillions of concurrent customers may tell you different things, I try to respect that ;) Well, there are actually some hardware requirements, like max. amount of RAM you can use effectively on linux and so on. But, by the way, who said, the software development with XSLT/XML is faster then with JSP/JAVA-Objects? I highly doubt it :-) Keep it if it works. Don't forget that modern browsers can accept XML and have built-in XSLT processor. So, you can send your serialized bean data as XML with linked XSLT stylesheet with linked CSS stylesheet. Now this is an urban legend :-) Each browser support it it's own way. Not to mention each version of the redmond browser supports ist own extensions. None of them are compatible. Umm, MSXML or whatever it was called, has an old XSLT implementation. MSIE 6.0 XSLT processor is much better. And it is around for 5 years, so customers with MSIE less than version 6 should be simply not supported. Heck, they probably already have bought a new car since they installed MSIE 5. Now it is time to change oil in their computer too. I'm not even sure, that 6.0 sp1 and 6.0 sp2 have the same xslt processor. My experience with microsoft tells me, that 7.0 will differ. Not to mention mozilla and opera. And what about the coming google browser? * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? You can do it in Struts 1.x too. Instead of forwarding to JSP page just stick XML (or XML/XSLT already processed into HTML) into response object and return null from an Action class. Apparently, you would use ActionForm for input only with request scope, and store your app data somewhere in the session or in database. Actually it's better to write out the dom object (if you have one, but you should, if you seriously want xslt/xml). I would also look into rendering with SAX, it could probably give you 40-50% more performance then dom rendering. Did not quite get that. If you want to work directly with DOM, then you probably need to return XML, that is what Ajax components usually do. If you return server-side-processed HTML, then what DOM are you talking about? Well yes, browser will create DOM based on HTML received, but you do not alter DOM *directly* from server. Oh, you did not mean browser DOM? You meant to return XML containg app data from server-side DOM? Then how does that correlate with your dismissal of client-side XSLT processing? I must have misunderstand what i read, mea culpa :-) But funny things, with resin, a jsp which is rendering xml is faster then xml written out by servlet,
Re: Struts and Laszlo
Luc, I have designed Laszlo applications having both PHP and Servlets as controllers. It worked great and your idea is right on. In fact I am starting a Struts/Laszlo app pretty soon. Have in mind that Laszlo is the View of the MVC model. I understand that you can also use Laszlo as the controler. But I had a project done for School with laszlo and Servlets and the way I've used Laszlo was to act as the view model and do browser validation as you can have Javascript with Laszlo. Other than that all the logic and interaction with the business layer were done by my servlets. With Struts the principle is the same. Keep in mind one thing for Laszlo. Even if you only post data to your Struts action you have to return some sort of xml structure or your Laszlo app will crash. Something like: result statussuccess/status /result or result status=success/ Basicaly instead of having a JSP front end you will have a Laszlo front end. However programming it with Laszlo is more like doing a GUI app with events and all other than a CGI application. good luck Luc Lucas Bern wrote: Hia guys... I´would it be a nosense to integrate Laszlo with struts??? I think Laszlo is responsible for controlling the application, so, may be we can hav struts incharge of generating data in XML format so that Laszlo presentation server show it??? I´m thinking of extending struts so that its output be XML for laszlo (or who ever), abstracting it form HTML... am I making a mountain from a stone ... I mean, a servlet would be enough??? Luc __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question on log on with SecurityFilter and JDBCRealm
Steven, Thanks! Yeah, great idea. In fact I was reading about that on O'Reilly's Struts Cookbook. I have one question to you though: How is the filter executed? After the login? Or after every http request to the server? What does fire the filter up? Is it like an event for a GUI app? I would like to understand this concept better. regards, C.F. Mitchell, Steven C wrote: Have you considered using a Filter to put the extra stuff in your Session? We use an initialization Filter that looks up a User record based on the authenticated user id. We then place that User object both in the Session and a thread local variable so that it is available to all the layers of our framework. Our DAO classes use the thread local variable to set things like Last Updated By. If you use the thread local variable make sure the last thing the Filter does is to set it to null so that the thread is not returned to the container's thread pool with the User object. public void doFilter( final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain ) throws IOException, ServletException { if ( servletRequest instanceof HttpServletRequest ) { final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; final String remoteUser = httpServletRequest.getRemoteUser(); if ( DataHelper.empty( remoteUser ) || null.equalsIgnoreCase( remoteUser ) ) { if ( log.isDebugEnabled() ) { log.debug( No User info Available ); } //end if ThreadContext.setUser( null ); } //end if else { final HttpSession session = httpServletRequest.getSession( true ); User user = (User) session.getAttribute( SESSION_TOKEN_SYSUSER ); if ( user == null ) { try { user = UserController.findUserByLoginId( remoteUser ); if ( log.isDebugEnabled() ) { log.debug( Initializing user + user.getUserId() ); } //end if } //end try catch ( final Exception e ) { throw new ServletException( e ); } //end catch session.setAttribute( SESSION_TOKEN_SYSUSER, user ); } //end if ThreadContext.setUser( user ); } //end else } //end if filterChain.doFilter( servletRequest, servletResponse ); ThreadContext.setUser( null ); //Clear the thread before returning it to the server's thread pool } Steve Mitchell UMB Bank -Original Message- From: C.F. Scheidecker Antunes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 17, 2005 12:50 PM To: Struts Users Mailing List Subject: Question on log on with SecurityFilter and JDBCRealm Hello all, I've managed to have successful authentication with securityFilter and JDBCRealm. I have a few questions that I was hoping you could clarify for me. After the login is successful, is there any way to forward that to a success page/action so that I can add extra stuff to the session context? This is my login-config session in the securityfilter-config.xml file: *login-config* *auth-method*FORM*/auth-method* *form-login-config* *form-login-page*/login.jsp*/form-login-page* *form-error-page*/error.jsp*/form-error-page* *form-default-page*/index.html*/form-default-page* */form-login-config* */login-config* My second question is concernig accessing the username value from the session context. How is that stored in the session? How can I access it? My login.jsp form uses standard j_security_check for the action on the login form, j_username, j_password for the 2 inputs. I would like, after the login is succesful to forward that to an action in order to access the database using the username as a key and return an userID number that I also want to store in the session. How can I accomplish this? Thanks in advance, C.F. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I refer a control in javascript which hava a . in i ts name
Try this: document.all['myForm'].value __ Senior Programmer Analyst, Tax Distributed Systems Development Tax Compliance Development, ADP IT Phone: (909) 592-6411 Ext. 3863 e-mail: [EMAIL PROTECTED] -Original Message- From: Jeff Beal [mailto:[EMAIL PROTECTED] Sent: Thursday, August 18, 2005 1:26 PM To: Struts Users Mailing List Subject: Re: How can I refer a control in javascript which hava a . in its name You also have the option of doing document.form[0]['myobject.subobject']. On 8/18/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: html:text name=myForm property=myobject.subobject styleId=subobject .../ then get the field by using document.getElementById(subobject); Tony Smith [EMAIL PROTECTED] Tony Smith [EMAIL PROTECTED] 08/18/2005 01:07 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject How can I refer a control in javascript which hava a . in its name Hi everyone: Here is my jsp: html:form ... html:select ... onChange=change(this) ... /html:select html:text name=myForm property=myobject.subobject .../ /html:form If user change the selection in the select, I would like to change the content of the text. Thus, I write my change() function in javascript: script language=javascript function change(select){ document.form[0].myobject.subobject = select.options[select.selectedIndex]; } But looks like this does not work. The problem is the name of the text. In the html it is myobject.subobject. But seems that javascript does not take that How can I refer the text in javascript? Thanks, Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs - 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] - This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How can I refer a control in javascript which hava a . in i ts name
Be aware that document.all is IE specific. [EMAIL PROTECTED] [EMAIL PROTECTED] 08/18/2005 06:43 PM Please respond to Struts Users Mailing List user@struts.apache.org To user@struts.apache.org cc Subject RE: How can I refer a control in _javascript_ which hava a . in i ts name Try this: document.all['myForm'].value __ Senior Programmer Analyst, Tax Distributed Systems Development Tax Compliance Development, ADP IT Phone: (909) 592-6411 Ext. 3863 e-mail: [EMAIL PROTECTED] -Original Message- From: Jeff Beal [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 18, 2005 1:26 PM To: Struts Users Mailing List Subject: Re: How can I refer a control in _javascript_ which hava a . in its name You also have the option of doing document.form[0]['myobject.subobject']. On 8/18/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: html:text name=myForm property=myobject.subobject styleId=subobject .../ then get the field by using document.getElementById(subobject); Tony Smith [EMAIL PROTECTED] Tony Smith [EMAIL PROTECTED] 08/18/2005 01:07 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject How can I refer a control in _javascript_ which hava a . in its name Hi everyone: Here is my jsp: html:form ... html:select ... > ... /html:select html:text name=myForm property=myobject.subobject .../ /html:form If user change the selection in the select, I would like to change the content of the text. Thus, I write my change() function in _javascript_: script language=_javascript_ function change(select){ document.form[0].myobject.subobject = select.options[select.selectedIndex]; } But looks like this does not work. The problem is the name of the text. In the html it is myobject.subobject. But seems that _javascript_ does not take that How can I refer the text in _javascript_? Thanks, Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs - 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] - This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shale ... where can I find out more?
thanks ! On 8/18/05, Wendy Smoak [EMAIL PROTECTED] wrote: From: Lixin Chu [EMAIL PROTECTED] is there a road map/milestone for Shale developemnt ? I am pretty comfortable with Struts now but would like to explore Shale in the next project. Craig has posted a roadmap on the Struts Wiki: http://wiki.apache.org/struts/StrutsShale -- Wendy - 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]
Resizing output image from a Struts Action
Hello all, I have an action to retrieve an image from a database BLOB field and display it. It works great. However I wanted to resize the image proportionaly. Hence I think on writing a second action, that would call the first in order to retrieve the image. Then, would work on this image to resize it and send it over to the browser. Or maybe change the original action to do that to save the overhead. I would like to know how to accomplish image resizing in Java. The image can be a JPG, a GIF or a BMP. Hence I need to handle all these situations depending on the Content/Type that is stored in the database along with the BLOB. When you retrieve a BLOB you write it to a ByteArrayOutputStream. Then you just set the response.SetContentType , setContentLength and send the ByteArrayOutputStream by calling the method .toByteArray() and .flush. I have two options, I can change the original Action to accept a request attribute to determine the width or height. Then I can work the image and spit it out. The way I think about it is that I would need to, somehow, create an Image object by taking the ByteArray from the ByteArrayOutputStream. This image object could be a JPG, GIF or BMP. I would determine which one to use based on the Content/Type of the database. They this object could be resized and return a byteArray that I could send to the browser. I guess I have most of it done but I would like advise on how to: 1) Construct a JPG, GIF or BMP object with the ByteArray 2) Resize this object and produce a resided ByteArray so that I can send it to the browser. Any ideas on how to perform that? Any documentation regarding this that I could browse? Thanks, C.F. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Using custom tags and struts together
Hello all Has anybody successfully used Stuts tags and Custom tags together? For example: Consider a custom tag with the following code: out.println(html:link action=\Update.do\ + entry[ix] + /html:link); The custom tag appears to write the output directly to the socket without further Struts tag evaluation, consequently the HTML source on the browser includes html:link which it doesn't understand. 1. How about writing the link using a href=/WEB-INF/pages/update.jsp/a When I do this I lose the connection to my current session. Not a solution. 2. Try return true in the theBodyShouldBeEvaluatedAgain method. I tried this and the code got into a loop (I believe this simply recurses back through my code). If I am supposed to use this somebody will need to tell me a simple way of stopping the recursion. 3. The only other alternative I have is to look into the Struts source code and try and find some internal method to call to evaluate the generated code before I print it to the socket. Hope somebody has tried to do this before... Kind regards mc FOCUS Computing Mob: 0415 24 26 24 [EMAIL PROTECTED] http://www.focus-computing.com -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.12/77 - Release Date: 18/08/2005 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts with XSLT
We have been using stxx for a while now, mostly for output transformations only and it work perfectly. I would recommend you to consider it, and I have no stock in stxx ;-) ! Apart from this, we quite often use inline XSL transformations provided by JSTL nowadays not as flexible, but certainly useful in 'hybrid' designs. Complex form stuff, and pages which need to be update oftern are mostly taken care of by jsp2.0 pages seems that our designers prefer jsp2.0 over the (for them) more complex XSLT. regards, Peter On Thu, 2005-08-18 at 16:31 +0100, Graham Smith wrote: On Thursday 18 August 2005 16:02, Don Brown wrote: Hmm...smell of death for stxx might be a bit harsh :) Yeah ok, it was a bit harsh - sorry. I'll take another look. It's sometimes hard to know when a project is on it's last legs though. A message from one of the core developers within an hour is a pretty good assurance that it's alive and kicking though :o) While it true I need to get a release out that better supports 1.2, I've been using it in production for over a year without problems, and would recommend you take another look. You, of course, are welcome to get involved, submit patches, even join the project. I have been looking for a project to work on in my spare time (just a mo while I pick myself up off the floor from laughing at the idea of having spare time). If I decide to stick with XSLT I'll probably contribute. Regarding Struts and XSLT, I've had a good experience ditching JSP. XSLT is powerful and fun even once you get the hang of it. Now to your questions... On 8/18/05, Graham Smith [EMAIL PROTECTED] wrote: snip / * Should I just stop fighting city hall and abandon XSLT in favour of JSP? * Perhaps it's still a little early to say exactly how Struts 2.x will turn out but will the idea of view technology independence be maintained? Of course there isn't a Struts 2.0, yet anyways, but Struts Shale is already exploring an alternate view, HTML templates, for JSF and JSF itself is designed to be view independent, however, I haven't heard of any view handlers that use XSLT yet. I certainly couldn't call myself a JSF expert but I have, I believe, had enough experience of it to realise that the intended goal writing one page and using alternative renders for different devices doesn't really work. While it's great that you can, in theory, install other renders for the JSF tags it rapidly becomes almost impossible to maintain. I can't believe, for instance, that it would be possible to develop a page that would look good in both a standard browser and a mobile phone. This is at the heart of my interest in XSLT. It removes the whole plug-in render mess that JSF seems to have got itself into. On the flip side the reason I am interested in using JSPs is that I only need to develop for fully featured browsers. Thanks for the feedback, Graham Another project we are working on in the sandbox, Struts Ti, already has support for XSLT. Hope that helps, Don * If Struts 2.x doesn't (essentiall) force us to use something akin to JSF will XSLT still be a viable option? Thanks for reading this far. I really look forward to hearing your views. Graham - 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]