Re: Changing The Result Page
This looks like a good Idea. I will test it and Dave N's suggestion as well. Thank you All On Tue, Feb 1, 2011 at 3:14 PM, Chris Pratt wrote: > To extend on this idea, instead of requiring all your actions to add a > getBtype(), you could use an interceptor that determine's the Browser Type > and sets a context attribute you could access using: > > /${#btype}/Profile.jsp > > (*Chris*) > > On Tue, Feb 1, 2011 at 10:36 AM, Greg Lindholm wrote: > >> You could also add a "btype" (browser type) macro to your jsp paths like >> this... >> >> /struts2/${btype}/Profile.jsp >> >> Your actions would have to have a getBtype() method that supplied that >> portion of the path. >> >> This assumes you keep the mobile jsp pages in a separate directory >> then the desktop. >> >> Another way is to create a custom result type ( extend >> org.apache.struts2.dispatcher.ServletDispatcherResult) have it mung >> with your paths and set it to be the default result-type. >> >> (One of the things I love about Struts 2 is number of options you have >> to solve a problem). >> >> >> On Tue, Feb 1, 2011 at 12:56 PM, Dave Newton >> wrote: >> > Interceptor w/ pre-result listener? >> > >> > Dave >> > >> > On Tue, Feb 1, 2011 at 12:50 PM, Richard Sayre > >wrote: >> > >> >> I am making a mobile site for my current web application. I have a >> >> huge number of actions that return to JSP pages. I have a mobile >> >> detection class written. >> >> >> >> Is there a way that I can change the result page if the user is on a >> >> mobile device? >> >> >> >> I want to avoid having to write this in all my actions: >> >> >> >> if(mobile) { >> >> >> >> return SUCCESS_MOBILE >> >> >> >> } else { >> >> >> >> return SUCCESS >> >> >> >> } >> >> >> >> >> >> If I could change the result page it would make it easier. For >> >> example if it is mobile then I replace the result page of >> >> /mydir/myPage.jsp to /mydir/myPage-m.jsp. >> >> >> >> Any suggestions? >> >> >> >> Thank you, >> >> >> >> Rich >> >> >> >> - >> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> >> >> > >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Changing The Result Page
I am making a mobile site for my current web application. I have a huge number of actions that return to JSP pages. I have a mobile detection class written. Is there a way that I can change the result page if the user is on a mobile device? I want to avoid having to write this in all my actions: if(mobile) { return SUCCESS_MOBILE } else { return SUCCESS } If I could change the result page it would make it easier. For example if it is mobile then I replace the result page of /mydir/myPage.jsp to /mydir/myPage-m.jsp. Any suggestions? Thank you, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
DOJO Rendering
Due to the deprecation of the DOJO plugin I have been trying to recreate all of my web site GUI without using Struts 2 tags. When I create a Tabbed Pane, the web site loads, then the Tabbed Pane renders in view of the user. Before the UI renders it looks like a mess. When I used the struts 2 tags I did not have this problem. The GUI 99% of the time was rendered before I could see it. Now it seems that I always see the GUI render. I dont want the user to see any GUI until it is rendered properly. Was there something configured in Struts 2 that had the pane rendered before the client saw it? Is it possible to achieve this without the Struts 2 tag library? Thank you, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Performance issue with large data(such as images)
I should have also mentioned that there are security issues with persisting to the hard drive. I would recommend saving to the database and loading the images as needed. Do not save them to session. I do not think you will have a performance problem. Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Performance issue with large data(such as images)
>Thanks, Rich, I''m happy to help. > If I use BLOB, I have to make a lot of change to my code. Therefore, I have > to persist it as String. I used base64 to encode and decode the byte[] into > String. Because I resize the images to small ones. I use a VARCHAR length > about 10k~20k to persist the String. Thats fine, if you don't want to do a hugh code change then keep it the same > "How often do you need to load all 300 images? If it is forum style I > would imangine a limited number of posting per page say max 20. So > the would be a maximum of 20 images per page load." > If this is true, which method is the best among the above three? Which method is 'best' depends on what you want. For fast access and low memory - persist to hard drive > "If you must use the least amount of memory as possible, persist the > images to the hard drive and store the file reference to the url in > the database. " > If I want to persist images to the hard drive of server. Shall I persist the > data inside WAR or outside? Because user can change their portrait, does it > mean it must be persisted outside WAR? No just make a base dir in your app called 'userAvatar' or something similar. Then persist the image as user_.gif ( = the user id). When they chage their image override the file. Also as stated by Pawel, make sure you have a performance problem before you try to solve a performance problem. > -- > View this message in context: > http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23948048.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem with displayTag
You need to set hte requestURI attribute see http://displaytag.sourceforge.net/1.2/displaytag/tagreference.html#display-el:table On Mon, Jun 8, 2009 at 12:11 PM, Bhaarat Sharma wrote: > Hi guys, > I'm starting displaytag for the first time. > > I have a simple Struts2 action that is returning a list. The list contains > elements of Class Apple. > > Following is the code I have: > > > > > > > > > This works ok, however, when I click 'next page' the page says 'Nothing > found to display.' > > Does anyone know how to fix this? > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Performance issue with large data(such as images)
You should persist the images as bytes, in a binary field or something similar. > 1. Because the image is large, it's not efficient to store it in > objects(beans). Well this depends on the Bean. Is the bean stored in session? If yes then it will take up some memory. If you dont have alot of memory I would not recommend this. > 2. Because I have many users(say 300), if I store all the maps(userId and > image) in the session, the session will be huge. Again if your requirement is low memory usage then dont store large objects in momory for a long time > 3. Because I have many users(say 300), if I access the db for each user's > image, the worse case is I will have to access db for 300 times. Well this is the trade off Memory vs Resources to Connect to a DB. Even if the images are not stored in session they will still be held in memory when getting them from the DB. How often do you need to load all 300 images? If it is forum style I would imangine a limited number of posting per page say max 20. So the would be a maximum of 20 images per page load. You could also Store the images in the hard drive of the server, and store a URL to the image in the database. This would reduce the memory overhead. Did you try to do any test to see what the impact of retrieveing the data from the database is? If you must use the least amount of memory as possible, persist the images to the hard drive and store the file reference to the url in the database. Or even store the images as userId_avatar.gif. That way you can link the file to a user id and have no need to store the url. Use a base directory for storing the images. Before you guess if something is a performance issue, you should test to see what the actual cost of each method of image storing and retrival is. Rich On Tue, Jun 9, 2009 at 12:49 PM, fireapple wrote: > > Firstly, I persist the portraits (images) of all users in the db as Strings > (large one, say length 5000). Then, I want to get the String and display the > portraits of users on the web page(like a topic in a forum). Here I know > three solutions but none of them is efficient: > 1. Because the image is large, it's not efficient to store it in > objects(beans). > 2. Because I have many users(say 300), if I store all the maps(userId and > image) in the session, the session will be huge. > 3. Because I have many users(say 300), if I access the db for each user's > image, the worse case is I will have to access db for 300 times. > > Is there any solution (such as a design pattern or interceptor) for this > performance issue? Many thanks! > -- > View this message in context: > http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23945029.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Design Question Global Properties
I have some global properties in my application that I need to access from several of my JSP pages. In my application I have a base action which all of my actions use. I was thinking of putting a getGlobalProperties method in that action that return an instance of an Singleton that holds my properties. My other thought was to use an interceptor plus a singleton to add the properties to the stack. I'm not sure if this is possible with an interceptor. I am looking for some feedback on these designs. I am leaning towards the base action + singleton to do this but I want to make sure I am making a good decision here. Thanks, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
OGNL Check for Enum in a list of Strings
I have a String array and I am trying to see if there is a value in it. Using: works. I want to use the value of an enum in place of foo. I tried which didn't work. Using the String literal works: Is it possible to do this using @my.package.mye...@enum_value? Thanks Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Keep Action Properties over multiple requests
Is it possible to specify all action properties in session param tag using regex or wildcards? On Mon, May 25, 2009 at 8:39 AM, Nils-Helge Garli Hegvik wrote: > Yes, the ScopeInterceptor should be able to handle this case. > > Nils-H > > On Mon, May 25, 2009 at 1:02 PM, Richard Sayre wrote: >> I have an action that does some server side logic, based on that logic >> I want to present the user with a Yes/No message. If they click yes I >> want to save the data the user filled out before the Yes/No message. >> >> Is it possible to carry action properties over multiple requests? I >> found the ScopeInterceptor but I am unsure if that is what I need to >> use. >> >> Thanks >> >> Rich >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Keep Action Properties over multiple requests
I have an action that does some server side logic, based on that logic I want to present the user with a Yes/No message. If they click yes I want to save the data the user filled out before the Yes/No message. Is it possible to carry action properties over multiple requests? I found the ScopeInterceptor but I am unsure if that is what I need to use. Thanks Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Changing the default attribute value for a tag
I want to have all of s:url tags use forceAddSchemeHostAndPort="true" Is there a way to set this property globaly? I couldn;t find anything in struts.properties. Thanks, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts newbie - Advice on file downloading
Hi, I have the following defined: application/pdf fileStream filename="Report.pdf" 1024 My action lookks like this public String generateReport() { //use api to build PDF //the api takes an output stream //so at the end of my method i have an output stream containg the file... //bout is my output stream //file stream is a member of my Action (referenced in the fileStream param) //fileStream is an InputStream fileStream = new ByteArrayInputStream(bout.toByteArray()); return SUCCESS; } You will have to parameterize the XML to handle multiple file types: ${mimeType} Which you will set in your action. Same goes for the other parameters. I'm not sure how to get the browser to display a save dialog, I think it has to do with the mime type. I think application/octet-stream will work. -Rich On Wed, May 13, 2009 at 8:55 AM, Steve wrote: > Hi, > > > > I'm a Struts 2 newbie and I need to write some code to download dynamically > created files in various formats (csv, txt and xml). I want the user to be > presented with a "Save As" dialog regardless of file type. > > > > Does anyone have any advice / URL's for example code? I have found the > "Result Stream" documentation on the Struts site and various code snippets. > But I can't find any good complete examples. > > > > Many Thanks, > > > > Steve > > Steve Higham > > > > > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Converter trying to set String on int field
After some debugging the culprit was the checkbox interceptor. It uses false as a default value when nothing is selected. I tried setting the uncheckedValue to -1 and it didnt work. -1 I upgraded to the latest version of Struts 2 and then it worked. On Mon, May 11, 2009 at 3:01 PM, Richard Sayre wrote: > It is also happening in a Date field I have. If no dates are entered > in the text box then I get the same error. If I provide a date then > the conversion works. > > I am currently moving through the XWork and OGNL source to see what is > causing this. > > > On Mon, May 11, 2009 at 1:48 PM, wrote: >> >> I bet it has something to do with a null not being assignable to an int. >> Chris >> >> >> >> >> >> >> >> -Original Message- >> From: Richard Sayre >> To: Struts Users Mailing List >> Sent: Mon, 11 May 2009 11:44 am >> Subject: Re: Converter trying to set String on int field >> >> >> >> >> >> >> >> >> >> >> After some further investigation I found that any array type that has >> no values from the form on submit will call setXXX(String). >> >> I checked the source of >> com.opensymphony.xwork2.util.XWorkBasicConverter and this is the first >> thing it does: >> >> if (value == null || toType.isAssignableFrom(value.getClass())) { >> // no need to convert at all, right? >> return value; >> } >> >> So I'm still unclear as to why setXXX(String) is called. I even used >> a custom converter, and I am getting the same results. When I return >> null from my converter setXXX(String) is called. >> >> If anyone has any suggestions on how to handle this it would be >> greatly appreciated >> >> Thanks >> Rich >> >> >> On Mon, May 11, 2009 at 11:10 AM, Richard Sayre >> wrote: >>> I have a bunch of check boxes called userId. In my action I have int >>> userId[] and setUserId(int[] ids) >>> >>> When I select a checkbox the conversion works normally. ?When I dont >>> check any boxes on the form and submit, I get the following: >>> >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null >>> for property userId. Mapping size: 4 >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type >>> converter for property [userId] = none found >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type >>> converter for property [userId] = none found >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to >>> default type converter >>> [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null >>> for property userId. Mapping size: 4 >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type >>> converter for property [userId] = none found >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type >>> converter for property [userId] = none found >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to >>> default type converter >>> [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] >>> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Error setting value >>> ognl.MethodFailedException: Method "setUserId" failed for object >>> com.abc.usersact...@1db2215 [java.lang.NoSuchMethodException: >>> setUserId(java.lang.String)] >>> >>> For some reason when no ids are selected it is trying to set the value >>> as a String. >>> >>> 1) Is this normal behavior? >>> 2) Is there a way to work around it? >>> >>> Thank you, >>> >>> Rich >>> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> >> >> >> > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Converter trying to set String on int field
It is also happening in a Date field I have. If no dates are entered in the text box then I get the same error. If I provide a date then the conversion works. I am currently moving through the XWork and OGNL source to see what is causing this. On Mon, May 11, 2009 at 1:48 PM, wrote: > > I bet it has something to do with a null not being assignable to an int. > Chris > > > > > > > > -----Original Message- > From: Richard Sayre > To: Struts Users Mailing List > Sent: Mon, 11 May 2009 11:44 am > Subject: Re: Converter trying to set String on int field > > > > > > > > > > > After some further investigation I found that any array type that has > no values from the form on submit will call setXXX(String). > > I checked the source of > com.opensymphony.xwork2.util.XWorkBasicConverter and this is the first > thing it does: > > if (value == null || toType.isAssignableFrom(value.getClass())) { > // no need to convert at all, right? > return value; > } > > So I'm still unclear as to why setXXX(String) is called. I even used > a custom converter, and I am getting the same results. When I return > null from my converter setXXX(String) is called. > > If anyone has any suggestions on how to handle this it would be > greatly appreciated > > Thanks > Rich > > > On Mon, May 11, 2009 at 11:10 AM, Richard Sayre > wrote: >> I have a bunch of check boxes called userId. In my action I have int >> userId[] and setUserId(int[] ids) >> >> When I select a checkbox the conversion works normally. ?When I dont >> check any boxes on the form and submit, I get the following: >> >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null >> for property userId. Mapping size: 4 >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type >> converter for property [userId] = none found >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type >> converter for property [userId] = none found >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to >> default type converter >> [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null >> for property userId. Mapping size: 4 >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type >> converter for property [userId] = none found >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type >> converter for property [userId] = none found >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to >> default type converter >> [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] >> 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Error setting value >> ognl.MethodFailedException: Method "setUserId" failed for object >> com.abc.usersact...@1db2215 [java.lang.NoSuchMethodException: >> setUserId(java.lang.String)] >> >> For some reason when no ids are selected it is trying to set the value >> as a String. >> >> 1) Is this normal behavior? >> 2) Is there a way to work around it? >> >> Thank you, >> >> Rich >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > > > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Converter trying to set String on int field
After some further investigation I found that any array type that has no values from the form on submit will call setXXX(String). I checked the source of com.opensymphony.xwork2.util.XWorkBasicConverter and this is the first thing it does: if (value == null || toType.isAssignableFrom(value.getClass())) { // no need to convert at all, right? return value; } So I'm still unclear as to why setXXX(String) is called. I even used a custom converter, and I am getting the same results. When I return null from my converter setXXX(String) is called. If anyone has any suggestions on how to handle this it would be greatly appreciated Thanks Rich On Mon, May 11, 2009 at 11:10 AM, Richard Sayre wrote: > I have a bunch of check boxes called userId. In my action I have int > userId[] and setUserId(int[] ids) > > When I select a checkbox the conversion works normally. When I dont > check any boxes on the form and submit, I get the following: > > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null > for property userId. Mapping size: 4 > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to > default type converter > [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null > for property userId. Mapping size: 4 > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type > converter for property [userId] = none found > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to > default type converter > [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] > 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Error setting value > ognl.MethodFailedException: Method "setUserId" failed for object > com.abc.usersact...@1db2215 [java.lang.NoSuchMethodException: > setUserId(java.lang.String)] > > For some reason when no ids are selected it is trying to set the value > as a String. > > 1) Is this normal behavior? > 2) Is there a way to work around it? > > Thank you, > > Rich > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Converter trying to set String on int field
I have a bunch of check boxes called userId. In my action I have int userId[] and setUserId(int[] ids) When I select a checkbox the conversion works normally. When I dont check any boxes on the form and submit, I get the following: 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null for property userId. Mapping size: 4 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type converter for property [userId] = none found 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type converter for property [userId] = none found 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to default type converter [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Property: userId 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Class: com.abc.UsersAction 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - converter is null for property userId. Mapping size: 4 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - field-level type converter for property [userId] = none found 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - global-level type converter for property [userId] = none found 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - falling back to default type converter [com.opensymphony.xwork2.util.xworkbasicconver...@82fba9] 2009-05-11 10:54:28,606 [http-8080-6] DEBUG []: - Error setting value ognl.MethodFailedException: Method "setUserId" failed for object com.abc.usersact...@1db2215 [java.lang.NoSuchMethodException: setUserId(java.lang.String)] For some reason when no ids are selected it is trying to set the value as a String. 1) Is this normal behavior? 2) Is there a way to work around it? Thank you, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: determine if iphone user?
I think the HTTP_USER_AGENT header should be similar to: Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 If a request comes from the IPhone browser On Fri, May 1, 2009 at 3:06 PM, Andy wrote: > > Hi, is there an easy way to tell in an s2 action if the request is coming > from an iphone/mobile device? > > Thanks! > > _ > Insert movie times and more without leaving Hotmail®. > http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd1_052009 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Submitting a Date to an Action
My date field is one text box with a Date Picker Widget. The converter does the valid date validation for me by attempting to parse the date in the Util class. If it returns null then I know I got a parse exception. I am including my convertFromString code below. I need it to handle both single dates and an array of dates. My form always has a date range, plus N number of date ranges to select. I wrote it to work for both. Any criticisms or questions about the code are welcomed. public Object convertFromString(Map context, String[] values, Class toClass) throws TypeConversionException { ArrayList dates = new ArrayList(); Date returnDates[] = null; if (toClass == Date.class || toClass == Date[].class) { StrutsRequestWrapper srw = (StrutsRequestWrapper) context.get("com.opensymphony.xwork2.dispatcher.HttpServletRequest"); User u = (User) srw.getSession().getAttribute(Constants.USER_SESSION_KEY); Util util = new Util(); for (int i = 0; i < values.length; i++) { if (values[i].trim().length() > 0) { //all date ranges are submitted even if they are empty Date tmpDate = util.parseDate(values[i], u.getDateFormat()); dates.add(tmpDate); if (tmpDate == null) { //parsing failed throw new TypeConversionException("Could not parse date [" + values[i] + "] using format [" + u.getDateFormat() + "]"); } } } returnDates = dates.toArray(new Date[0]); } if (returnDates.length > 1) { return returnDates; } return returnDates[0]; } On Fri, May 1, 2009 at 12:32 PM, Andy Sykes wrote: > I wrote my own method based on having three select dropdown boxes for the > date - day, month and year. > > Rather than do it as a type converter, I did it as an interceptor, with > three getters/setters in the action (getStartTime_Day, getStartTime_Month, > getStartTime_Year). The interceptor uses reflection when it encounters a > Date setter (with a suitable annotation) in the action to look up these > fields and parse them into a Date for setting. Lets me do validation at the > same time. > > Andy. > > On 1 May 2009, at 12:44, Richard Sayre wrote: > >> I think I am going to write my own. After experimenting with the date >> time picker it only seems to convert the date if its in this format >> mm/dd/yy. In my application the user can choose their own date format. >> When I have a format like 1 May 2009, the datetime picker value does >> not get converted. It is expecting to set a String instead of a Date. >> I am still trying to get my own converter to work right. If I get >> something written I will share it with the group. >> >> >> >> On Thu, Apr 30, 2009 at 10:19 PM, Zoran Avtarovski >> wrote: >>> >>> That¹s exactly right but sometimes you want to use a format that isn¹t >>> the >>> short format for the locale and I suspect that¹s what is happening with >>> Richard. >>> >>> He has two choices, either configure his date time picker to produce the >>> date in the required format, or as suggested write your own converter. My >>> only concern with Matt¹s version is that the conversion exception is >>> buried >>> which will have implications for validation. >>> >>> Z. >>> >>> >>>> >>>> Hi Richard, >>>> >>>> Have a look at http://struts.apache.org/2.1.6/docs/type-conversion.html >>>> It says that "dates - uses the SHORT format for the Locale associated >>>> with the >>>> current request" >>>> >>>> May be this will help. >>>> >>>> Thank you. >>>> Regards, >>>> Kishan.G >>>> >>>> Senior Software Engineer. >>>> www.spansystems.com >>>> >>>> >>>> >>>> >>>> -Original Message- >>>> From: Richard Sayre [mailto:richardsa...@gmail.com] >>>> Sent: Thursday, April 30, 2009 4:14 PM >>>> To: Struts Users Mailing List >>>> Subject: Re: Submitting a Date to an Action >>>> >>>> Thank you. I will give it a try. >>>> >>>> On Thu, Apr 30, 2009 at 1:22 AM, Matt Jiang >>>> wrote: >>>>>> >>>>>> Hi >>>>>> >>>>>> It is nothing about date picker tag. You can have a Converter to >>>>>> conve
Re: Submitting a Date to an Action
I think I am going to write my own. After experimenting with the date time picker it only seems to convert the date if its in this format mm/dd/yy. In my application the user can choose their own date format. When I have a format like 1 May 2009, the datetime picker value does not get converted. It is expecting to set a String instead of a Date. I am still trying to get my own converter to work right. If I get something written I will share it with the group. On Thu, Apr 30, 2009 at 10:19 PM, Zoran Avtarovski wrote: > That¹s exactly right but sometimes you want to use a format that isn¹t the > short format for the locale and I suspect that¹s what is happening with > Richard. > > He has two choices, either configure his date time picker to produce the > date in the required format, or as suggested write your own converter. My > only concern with Matt¹s version is that the conversion exception is buried > which will have implications for validation. > > Z. > > >> >> Hi Richard, >> >> Have a look at http://struts.apache.org/2.1.6/docs/type-conversion.html >> It says that "dates - uses the SHORT format for the Locale associated with >> the >> current request" >> >> May be this will help. >> >> Thank you. >> Regards, >> Kishan.G >> >> Senior Software Engineer. >> www.spansystems.com >> >> >> >> >> -Original Message- >> From: Richard Sayre [mailto:richardsa...@gmail.com] >> Sent: Thursday, April 30, 2009 4:14 PM >> To: Struts Users Mailing List >> Subject: Re: Submitting a Date to an Action >> >> Thank you. I will give it a try. >> >> On Thu, Apr 30, 2009 at 1:22 AM, Matt Jiang wrote: >>> > Hi >>> > >>> > It is nothing about date picker tag. You can have a Converter to convert >>> > String to Date and vice versa. >>> > Below is my implementation for your reference: >>> > (For DateUtil, please replace with yours) >>> > >>> > public class DateConverter extends StrutsTypeConverter { >>> > >>> > private static final String PATTERN = DateUtil.PATTERN__MM_DD; >>> > >>> > �...@override >>> > /** >>> > * Converts one or more String values to the specified class. >>> > * >>> > * @param context the action context >>> > * @param values the String values to be converted, such as those >>> > submitted from an HTML form >>> > * @param toClass the class to convert to >>> > * @return the converted object >>> > */ >>> > public Object convertFromString(Map context, String[] values, Class >>> > toClass) { >>> > >>> > Date returnObject = null; >>> > String value = values[0]; >>> > if (value != null && !value.trim().equals("")) { >>> > try { >>> > returnObject = DateUtil.parseDate(value, PATTERN); >>> > } catch (ParseException e) { >>> > // Just to ignore the parse exception >>> > } >>> > } >>> > return returnObject; >>> > } >>> > >>> > �...@override >>> > /** >>> > * Converts the specified object to a String. >>> > * >>> > * @param context the action context >>> > * @param o the object to be converted >>> > * @return the converted String >>> > */ >>> > public String convertToString(Map context, Object o) { >>> > >>> > Date date = (Date) o; >>> > String formatedDate = DateUtil.dateFormater(date, PATTERN); >>> > return formatedDate; >>> > } >>> > } >>> > >>> > >>> > >>> > On Thu, Apr 30, 2009 at 1:19 AM, Richard Sayre >>> wrote: >>> > >>>> >> I have an Action with a date attribute >>>> >> >>>> >> private Date myDate; >>>> >> >>>> >> public void setMyDate(Date myDate) { >>>> >> this.myDate = myDate; >>>> >> } >>>> >> >>>> >> I have a form that has a date picker (not the struts 2 date picker) >>>> >> that populates a text field. When I submitt the form to my action the >>>> >> property does not get set because Struts 2 is looking for >>>> >> setMyDate(String myDate). >>>> >> >>>> >> How do I tell Struts that the field is a Date? >>>> >> >>>> >> >>>> >> Thank you, >>>> >> >>>> >> Rich >>>> >> >>>> >> - >>>> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>>> >> For additional commands, e-mail: user-h...@struts.apache.org >>>> >> >>>> >> >>> > >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> > > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: How to hide a link
try cssStyle="display:none" On Fri, May 1, 2009 at 4:23 AM, taj uddin wrote: > Hi > > In my application there is a need to hide a link. I have used the tag > to generate a link and the necessity is to hide this link. > can any one pls help out in this regard > > > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Submitting a Date to an Action
Thank you. I will give it a try. On Thu, Apr 30, 2009 at 1:22 AM, Matt Jiang wrote: > Hi > > It is nothing about date picker tag. You can have a Converter to convert > String to Date and vice versa. > Below is my implementation for your reference: > (For DateUtil, please replace with yours) > > public class DateConverter extends StrutsTypeConverter { > > private static final String PATTERN = DateUtil.PATTERN__MM_DD; > > �...@override > /** > * Converts one or more String values to the specified class. > * > * @param context the action context > * @param values the String values to be converted, such as those > submitted from an HTML form > * @param toClass the class to convert to > * @return the converted object > */ > public Object convertFromString(Map context, String[] values, Class > toClass) { > > Date returnObject = null; > String value = values[0]; > if (value != null && !value.trim().equals("")) { > try { > returnObject = DateUtil.parseDate(value, PATTERN); > } catch (ParseException e) { > // Just to ignore the parse exception > } > } > return returnObject; > } > > �...@override > /** > * Converts the specified object to a String. > * > * @param context the action context > * @param o the object to be converted > * @return the converted String > */ > public String convertToString(Map context, Object o) { > > Date date = (Date) o; > String formatedDate = DateUtil.dateFormater(date, PATTERN); > return formatedDate; > } > } > > > > On Thu, Apr 30, 2009 at 1:19 AM, Richard Sayre wrote: > >> I have an Action with a date attribute >> >> private Date myDate; >> >> public void setMyDate(Date myDate) { >> this.myDate = myDate; >> } >> >> I have a form that has a date picker (not the struts 2 date picker) >> that populates a text field. When I submitt the form to my action the >> property does not get set because Struts 2 is looking for >> setMyDate(String myDate). >> >> How do I tell Struts that the field is a Date? >> >> >> Thank you, >> >> Rich >> >> - >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Submitting a Date to an Action
Yes I can Get it to work with the S2 date picker, I just cant figure out what is telling it to convert the String to a date. 2009/4/30 Paweł Wielgus : > Hi all, > as far as i know, date has its converter inside struts2 distribution, > so one shoul do nothing to make it work. > > Best greetings, > Pawel Wielgus. > > 2009/4/30, Matt Jiang : >> Hi >> >> It is nothing about date picker tag. You can have a Converter to convert >> String to Date and vice versa. >> Below is my implementation for your reference: >> (For DateUtil, please replace with yours) >> >> public class DateConverter extends StrutsTypeConverter { >> >> private static final String PATTERN = DateUtil.PATTERN__MM_DD; >> >> @Override >> /** >> * Converts one or more String values to the specified class. >> * >> * @param context the action context >> * @param values the String values to be converted, such as those >> submitted from an HTML form >> * @param toClass the class to convert to >> * @return the converted object >> */ >> public Object convertFromString(Map context, String[] values, Class >> toClass) { >> >> Date returnObject = null; >> String value = values[0]; >> if (value != null && !value.trim().equals("")) { >> try { >> returnObject = DateUtil.parseDate(value, PATTERN); >> } catch (ParseException e) { >> // Just to ignore the parse exception >> } >> } >> return returnObject; >> } >> >> @Override >> /** >> * Converts the specified object to a String. >> * >> * @param context the action context >> * @param o the object to be converted >> * @return the converted String >> */ >> public String convertToString(Map context, Object o) { >> >> Date date = (Date) o; >> String formatedDate = DateUtil.dateFormater(date, PATTERN); >> return formatedDate; >> } >> } >> >> >> >> On Thu, Apr 30, 2009 at 1:19 AM, Richard Sayre >> wrote: >> >>> I have an Action with a date attribute >>> >>> private Date myDate; >>> >>> public void setMyDate(Date myDate) { >>> this.myDate = myDate; >>> } >>> >>> I have a form that has a date picker (not the struts 2 date picker) >>> that populates a text field. When I submitt the form to my action the >>> property does not get set because Struts 2 is looking for >>> setMyDate(String myDate). >>> >>> How do I tell Struts that the field is a Date? >>> >>> >>> Thank you, >>> >>> Rich >>> >>> - >>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >>> For additional commands, e-mail: user-h...@struts.apache.org >>> >>> >> > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Submitting a Date to an Action
I have an Action with a date attribute private Date myDate; public void setMyDate(Date myDate) { this.myDate = myDate; } I have a form that has a date picker (not the struts 2 date picker) that populates a text field. When I submitt the form to my action the property does not get set because Struts 2 is looking for setMyDate(String myDate). How do I tell Struts that the field is a Date? Thank you, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Reusing GUI and Actions
I have a form in my web application that can be accessd from different places (Namespaces) in the web app. It looks something like this /Admin/EditSchedule.action /MySchedules/NewSchedule.action /Create/NewSchedule.action /Create/EditSchedule.action The are subtle differences in how the data is handled each time. For example, in Admin all data can be updated, in Create and MySchedules the data can be added. Also in Create there is another area where the data can be edited with the exception of two fields that can not be changed. The issue I am having is I need to submit the form to different actions depending on where the user is. For example in Admin, the action will do an update on all the data (this takes 3 steps), in Create it does an add plus it uses some other functionality from the model (5 Steps). So far I have used the same action name that saves the data in each name space. So every Forms action is SaveSchedule.action and each of the name spaces provide a mapping for this action name. Each action does different thigs with the data. This has workled so far and has allowed me to use the exact same JSP for all areas in my web application. Since I have added the Edit function to the Create namespace I can not do this anymore. Since they share the same namespace I can not reuse the SaveSchedule Action name. The save from the edit on the Create side on has 2 Steps. Does any one have any suggestions on the best way to handle this? I figured I can do the following: 1) In my JSP pages, leave out the Action in the form and provide it in a java script function. Currently my JSPs look like: //unique things to that area of the app include javaScriptFile include formCode //more unique things Change it to //unique things to that area of the app //common function called from the form code function saveScheduleForm() { ... } include javaScriptFile include formCode //more unique things This way each area that uses the form will provide its own saveScheduleForm method. I don't like this apprach since it could be very confusing to other programmers. 2) Rather than reuse the form code Cut and Paste it to every area of the application I need it and change the action of the form to reflect what action to submitt to. I don't like this option because I dont want to maintain multiple copies of this GUI. 3) Hand in some flag about what page I am on and choose logic based on that. I don't like this because it does not seem like a good practice. Does anyone have any suggestions? Thanks, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Set Unchecked Value in the Checkbox Interceptor
I think I found the problem. All of my check boxes have the same name. After examining the code in the interceptor: if (key.startsWith("__checkbox_")) { String name = key.substring("__checkbox_".length()); iterator.remove(); // is this checkbox checked/submitted? if (!parameters.containsKey(name)) { // if not, let's be sure to default the value to false newParams.put(name, uncheckedValue); } } The name will be in the parameters since they are all the same. So when it finds one that is unchecked (not submitted), it will not get added since the name is already there from a check box that has been submitted. I will have to find another way to achieve this since my check box list is dynamic and can be any size. I will post some code when I finish. Rich On Wed, Apr 15, 2009 at 9:05 AM, Richard Sayre wrote: > After reading some more documentation I tried : > > > -1 > > > completeDefault is a stack I created which includes the checkbox interceptor. > > This is still not setting the value in my int array. > > > > On Wed, Apr 15, 2009 at 8:29 AM, Richard Sayre wrote: >> The Struts 2 docs says the following about the Checkbox Interceptor: >> >> setUncheckedValue - The default value of an unchecked box can be >> overridden by setting the 'uncheckedValue' property. >> >> Where in code can I call the setUncheckedValue(String uncheckedValue) from? >> >> The problem I am facing is the fieldValue (HTML value) if the check >> box is an int. My action has an int[] id. I would like to set the >> value of an array element to 0 when it is not checked. I assumed >> because the current interceptor inserts "false" for unchecked boxes >> this would automatically get converted to an int because my action >> uses an int array. This does not occur. Any advice would be >> appreciated. >> >> Thank you, >> >> Rich >> > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Set Unchecked Value in the Checkbox Interceptor
After reading some more documentation I tried : -1 completeDefault is a stack I created which includes the checkbox interceptor. This is still not setting the value in my int array. On Wed, Apr 15, 2009 at 8:29 AM, Richard Sayre wrote: > The Struts 2 docs says the following about the Checkbox Interceptor: > > setUncheckedValue - The default value of an unchecked box can be > overridden by setting the 'uncheckedValue' property. > > Where in code can I call the setUncheckedValue(String uncheckedValue) from? > > The problem I am facing is the fieldValue (HTML value) if the check > box is an int. My action has an int[] id. I would like to set the > value of an array element to 0 when it is not checked. I assumed > because the current interceptor inserts "false" for unchecked boxes > this would automatically get converted to an int because my action > uses an int array. This does not occur. Any advice would be > appreciated. > > Thank you, > > Rich > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Set Unchecked Value in the Checkbox Interceptor
The Struts 2 docs says the following about the Checkbox Interceptor: setUncheckedValue - The default value of an unchecked box can be overridden by setting the 'uncheckedValue' property. Where in code can I call the setUncheckedValue(String uncheckedValue) from? The problem I am facing is the fieldValue (HTML value) if the check box is an int. My action has an int[] id. I would like to set the value of an array element to 0 when it is not checked. I assumed because the current interceptor inserts "false" for unchecked boxes this would automatically get converted to an int because my action uses an int array. This does not occur. Any advice would be appreciated. Thank you, Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Why does s:file break an ajax form?
I have encountered the same problem. While I have not fixed it with Ajax yet, the reason it does not work is because you can not submit a file through Ajax. You need to use an iFrame to submit file uploads. On Tue, Feb 17, 2009 at 7:14 PM, Jon Wilmoth wrote: > I'm curious to know why the s:file tag breaks an 2.1.6 ajax form resulting in > a javascript error "'message' is null or not an object" in IE6 (target div > isn't updated). The form, which contains some input tags and a s:file tag, > works when the standard s:submit tag is used, but doesn't work with the > sx:submit tag. Removing the s:file tag from the form when using the > sx:submit tag works. Below is a summary of what works and doesn't work using > the "Remote form replacing another div" sample from the showcase: > > Works (ajax w/out file input): > initial content > action='AjaxRemoteForm' method='post'> > > > > > Works (no ajax w/file input): > action='AjaxRemoteForm' method='post' enctype="multipart/form-data"> > > > > > > Doesn't Work (ajax w/file input): > action='AjaxRemoteForm' method='post' enctype="multipart/form-data"> > > > > > > Is there a Struts solution (w/out using 3rd party plugins) for an ajax based > form submission with files? > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: AJAX Valiadation in 2.0.x
On Thu, Jan 22, 2009 at 11:12 AM, Dave Newton wrote: > Richard Sayre wrote: >> >> First I wrote a method called validate. At this point I found out >> that I was overriding the ActionSupport method. When I tried to find >> more information on this method I couldn't. When I search for XWork >> or Struts 2 validation I always get the XML or Annotated validation. >> These validations are too simple for the needs of this particular >> form. >> >> Where can I find out more information on how to implement the validate() >> method? > > What do you want to know? The ValidationAware interface API docs list the > methods available, most of which are self-explanatory. The validate method comes from com.opensymphony.xwork2.Validateable and is implemented by com.opensymphony.xwork2.ActionSupport. The API description from each is : void validate()Performs validation. void validate() A default implementation that validates nothing. Subclasses should override this method to provide validations. I was wondering if this works with Struts 2? I can't find anything outside of XML and Annotated validation when I search. Will it work with built in Ajax validation? If yes, do I implement the validate method using the ValidationAware API? >> Will this method work with Ajax validation? > > I still don't know--if you're already doing Ajax validation, and already > have a validate() method, wouldn't you already have found out? I have a validateData method. I didnt use validate because I wasn't aware on how the valdate method is used with Struts. >> Will this require less work on my part if I do this? > > Less work than what? Less work than my solution. JSON Plugin + Dojo. It wasn't alot of work to do this I just want to make sure I am not rewriting something that Struts 2 already provides. >> By creating the mechanism for populating the did > >> I rewrite somethign that Struts can do for me? > > AFAIK the Ajax validation as shipped only deals with field-specific errors, > not the entire collection of errors--but I've never tried that, so I'm not > really sure. Somebody with more experience doing that may know. I am using the field specific errors, I am just handling them differently. If the shipped version works with the validation javascript provided in the struts.jar then it should work with my code. I kept the same js functions. > Dave > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: AJAX Valiadation in 2.0.x
Here is a solution I came up with so far. I wrote an action to validate. This calls my validateData() method. I Used the JSON plug in to return the fieldsErrors collection to dojo. Here is some javascript: Please note when looking at this that I have modified the original template that displays error messages. I also modified the validation javascript addError to add errors to this box. Hence the null values. I kept the same method signature in case someone needed the old functionality. The old template would take the field name so it could display the error message in the correct spot IIRC. function testAjaxSave() { clearErrorMessages(null); var kw = { url:'', load:function(type, data, evt) { for(i=0;i did I rewrite somethign that Struts can do for me? On Thu, Jan 22, 2009 at 10:40 AM, Dave Newton wrote: > Martin Gainty wrote: >> >> Richard- >> >> this is the AJAX doctype declaration from >> src/main/resources/struts-ajax.xml >> >> >"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" >>"http://struts.apache.org/dtds/struts-2.0.dtd";> >> If you reference the URL you will see 4 distinct elements >> >> Each element contains their own attribute list e.g. >> >> >name CDATA #REQUIRED >>class CDATA #REQUIRED >>default (true|false) "false"> >> >> Did you have a question? > > IIRC the question was whether or not Ajax validation required the use of XML > validation. > > Off the top of my head I don't actually know--since it takes about a minute > to write a validate() method I'd probably just try it and see if it works. > > Dave > >>> From: richardsa...@gmail.com >>> I was wondering if it is nessessary to use the XML for validation with >>> Ajax? I was hoping to use some validation on the server side action >>> to do this. Is it possible? > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
AJAX Valiadation in 2.0.x
I am following this article to get Ajax validation working. http://www.javaworld.com/javaworld/jw-10-2008/jw-10-struts2validation.html?page=1 I was wondering if it is nessessary to use the XML for validation with Ajax? I was hoping to use some validation on the server side action to do this. Is it possible? Thanks Rich - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
OGNL and Java Methods String Arguments
I'm trying to call the String replace method from OGNL. I can't find any specific examples on how to do this. I tried the following as a test: [EMAIL PROTECTED]@toString() This worked ok. My problem is I don't know how to pass string literals to the method. Here is my current code: ' Here is what I would like to call: [EMAIL PROTECTED]@replaceAll("'", Matcher.quoteReplacement("\\'")) (I am replacing a single quite with the JavaScript escape character for single quote \') If some one can help me out or point me to some good examples that would be great. Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Character Encoding and s:textarea
I found the problem and it does not involve Struts 2.We changed our SQL Server 2005 Text columns to varcharmax. For Java to properly read the characters out of the DB we had to use rs.getCharacterStream. Thank you for your help. On Thu, Jul 3, 2008 at 5:01 PM, Laurie Harper <[EMAIL PROTECTED]> wrote: > Richard Sayre wrote: >> >> I have a form containing text areas. When I copy a bunch of character >> data such as: >> 2öÂnJ1ÈÏúÄp8éÎdìåmðh4uæEÍÉieÔWán2ÅìbØÉÅÀ1JÎZÏôsC5LòÚAPúÜaÃÙPC5üÆCJWCOzùÙtÒQqùét >> >> into the text are, it displays normally. When I save the data, the >> database stores the characters properly, when the data returns to the >> s:textarea I displays with ?? replacing some characters. >> >> I can't figure out where this is happening. When I write the data out >> to the page as text it all displays properly. When I initially paste >> it into the textarea it displays correctly, so my browser supports the >> character set (ISO-8859-1 or Latin-1). It's only when it comes from >> the database to the textarea that the characters do not display. And >> I verified that the database can handle the characters and that they >> are stored correctly. >> >> This causes a problem when the user saves the second time, the ? get >> saved in the db as ?. >> >> Any ideas as to what is happening or how to fix it? >> >> Thank you, >> >> Rich > > - Are the characters retrieved from the database correctly? (i.e. if you > check the data you're sending to the textarea, is it right?) > > - What character encoding are you using to serve the page? > > - Do you have a @page directive in the JSP specifying the correct character > encoding? > > - Do you have a meta-equiv element in your HTML area to tell the > browser what encoding the page is in? > > - I assume you are using Struts :-) What version? > > L. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Character Encoding and s:textarea
I have a form containing text areas. When I copy a bunch of character data such as: 2öÂnJ1ÈÏúÄp8éÎdìåmðh4uæEÍÉieÔWán2ÅìbØÉÅÀ1JÎZÏôsC5LòÚAPúÜaÃÙPC5üÆCJWCOzùÙtÒQqùét into the text are, it displays normally. When I save the data, the database stores the characters properly, when the data returns to the s:textarea I displays with ?? replacing some characters. I can't figure out where this is happening. When I write the data out to the page as text it all displays properly. When I initially paste it into the textarea it displays correctly, so my browser supports the character set (ISO-8859-1 or Latin-1). It's only when it comes from the database to the textarea that the characters do not display. And I verified that the database can handle the characters and that they are stored correctly. This causes a problem when the user saves the second time, the ? get saved in the db as ?. Any ideas as to what is happening or how to fix it? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 Performance
After some searching I found: http://lazutkin.com/blog/2007/feb/1/improving-performance/ Under ' Optimizing widget initialization' there is an explantion on what to set (parseWidgets) and how to create them in code. I realized I am using version 2.0.8 and me IDE says that parseContent is not a valid attribute for the s:head. What release was that attribure introduced? Thank you, Rich On Mon, Jun 9, 2008 at 11:49 AM, Dave Newton <[EMAIL PROTECTED]> wrote: > Doesn't have a parseContent attribute? > > Either way, you may just be able to replicate the generated code > with your own. > > Dave > > --- On Mon, 6/9/08, Richard Sayre <[EMAIL PROTECTED]> wrote: > >> From: Richard Sayre <[EMAIL PROTECTED]> >> Subject: Re: Struts 2 Performance >> To: "Struts Users Mailing List" >> Date: Monday, June 9, 2008, 10:53 AM >> Thank you for the dojo info. I did a custom build for dojo >> using >> http://cwiki.apache.org/confluence/display/S2WIKI/Creating+a+custom+Dojo+profile+for+Struts+2.0.x >> and it reduced alot of requests >> >> I would like to turn off the page scan that dojo does and >> add the >> bootstrap code for the widgits my self. I'm not sure >> what to search >> for to find information on this. Can you point me to any >> articles or >> documentation? >> >> Thank you, >> >> Rich >> >> >> On Fri, May 30, 2008 at 5:05 PM, Laurie Harper >> <[EMAIL PROTECTED]> wrote: >> > Richard Sayre wrote: >> >> >> >> Hi, >> >> >> >> I have a few questions regarding performance in >> Struts 2. >> >> >> >> First of all we are using 2.0.9. I am trying to >> get the source to fix >> >> the following memory leaks : >> >> https://issues.apache.org/struts/browse/WW-2167 >> but I can't find the >> >> 2.0.9 build. Can anyone point me to the source >> for that build? >> > >> > >> http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_0_9/ >> > >> >> We have several Struts 2 applications hosted on a >> Tomcat server. We >> >> have a copy of our Struts libraries in each of the >> applications >> >> WEB-INF folder. Is there a better way to have >> this set up to save >> >> memory? I know this is more of a tomcat question >> but I figured some >> >> one here might have some suggestions. >> > >> > As Giovanni said, you can put the struts jars (and >> dependencies) into a >> > shared lib folder. You don't need to introduce >> Tomcat instancing to do this, >> > though. I should also point out that this isn't a >> tested configuration, so >> > you will want to test thoroughly. >> > >> >> Also, when I run Firebug to check the loading time >> of my page it seems >> >> that alot of time is spent downloading Dojo >> scripts. I am only using >> >> the Ajax and the Tabbed Panel provided by dojo, >> nothing else. Is >> >> there a way to configure dojo to only use what is >> nessessary? I did >> >> see a post on this list a while ago that involved >> extracting the files >> >> and rewriting the dojo require file, is this >> still the best way to >> >> increase dojo performance? >> > >> > Yes; you can improve the Dojo multiple-http-requests >> issue by creating a >> > custom Dojo build, which will bundle everything you >> use into dojo.js. You >> > will then see only one request (for dojo.js) in place >> of the multiple >> > requests you have now. See the Dojo documentation for >> how to create a custom >> > profile/build, or see below. >> > >> >> I was also getting a "script is busy - cancel >> or continue" in IE and >> >> Firefox. This was on a page that has a alot of >> HTML divs. I finally >> >> narrowed it down to some dojo that was running >> that seemed to be >> >> looping through every element on the page after it >> loaded. Does >> >> anyone have any insight into this behavior? Why >> is it needed? >> > >> > By default, Dojo scans the entire page looking for >> widgets to instantiate >> > (i.e. looking for tags with a dojoType attribute). For >> pages with a lot of >> > markup, that can be quite costly. There's a Dojo >> configuration switch to >> > turn that off, but then you nee
Re: Struts 2 Performance
Thank you for the dojo info. I did a custom build for dojo using http://cwiki.apache.org/confluence/display/S2WIKI/Creating+a+custom+Dojo+profile+for+Struts+2.0.x and it reduced alot of requests I would like to turn off the page scan that dojo does and add the bootstrap code for the widgits my self. I'm not sure what to search for to find information on this. Can you point me to any articles or documentation? Thank you, Rich On Fri, May 30, 2008 at 5:05 PM, Laurie Harper <[EMAIL PROTECTED]> wrote: > Richard Sayre wrote: >> >> Hi, >> >> I have a few questions regarding performance in Struts 2. >> >> First of all we are using 2.0.9. I am trying to get the source to fix >> the following memory leaks : >> https://issues.apache.org/struts/browse/WW-2167 but I can't find the >> 2.0.9 build. Can anyone point me to the source for that build? > > http://svn.apache.org/repos/asf/struts/struts2/tags/STRUTS_2_0_9/ > >> We have several Struts 2 applications hosted on a Tomcat server. We >> have a copy of our Struts libraries in each of the applications >> WEB-INF folder. Is there a better way to have this set up to save >> memory? I know this is more of a tomcat question but I figured some >> one here might have some suggestions. > > As Giovanni said, you can put the struts jars (and dependencies) into a > shared lib folder. You don't need to introduce Tomcat instancing to do this, > though. I should also point out that this isn't a tested configuration, so > you will want to test thoroughly. > >> Also, when I run Firebug to check the loading time of my page it seems >> that alot of time is spent downloading Dojo scripts. I am only using >> the Ajax and the Tabbed Panel provided by dojo, nothing else. Is >> there a way to configure dojo to only use what is nessessary? I did >> see a post on this list a while ago that involved extracting the files >> and rewriting the dojo require file, is this still the best way to >> increase dojo performance? > > Yes; you can improve the Dojo multiple-http-requests issue by creating a > custom Dojo build, which will bundle everything you use into dojo.js. You > will then see only one request (for dojo.js) in place of the multiple > requests you have now. See the Dojo documentation for how to create a custom > profile/build, or see below. > >> I was also getting a "script is busy - cancel or continue" in IE and >> Firefox. This was on a page that has a alot of HTML divs. I finally >> narrowed it down to some dojo that was running that seemed to be >> looping through every element on the page after it loaded. Does >> anyone have any insight into this behavior? Why is it needed? > > By default, Dojo scans the entire page looking for widgets to instantiate > (i.e. looking for tags with a dojoType attribute). For pages with a lot of > markup, that can be quite costly. There's a Dojo configuration switch to > turn that off, but then you need to add code to bootstrap the widgets. > >> Does the latest version 2.0.11.1 use a different version of dojo? >> Does it perform better? Would there be alot of code changes to change >> from 0.4 to the version that the current build uses? > > 2.0.11.1 doesn't offer much improvement, but 2.1.2 (beta) does. 2.1.2 comes > with a custom Dojo build pre-baked and with widget scanning turned off (it > also handles the widget bootstrapping for you). It's certainly more work to > upgrade to 2.1.2 than 2.0.11.1 but, given your concerns, it is probably > worth it. > > L. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can you set parameters in using in the tag body?
Could you use s:hidden on the form to store your params? On Wed, May 7, 2008 at 10:47 PM, Eduardo Dela Rosa <[EMAIL PROTECTED]> wrote: > Hi, > > I was trying to use the and invoke it with *some *parameters > using . > > i.e., > > * > > > > * > > However, the parameters don't seem to be getting through to the > HttpServletRequest object > when interrogated inside the Action. > > I know I can use the instead, but I preferred the . > > I'm implementing ServletRequestAware interface, by the way. > > Thanks. > > -- > Eduardo Dela Rosa > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple Results or How should I handle this?
I have an Action that could display several pages based on some info passed to it. Basically, its a preview action that will show the proper preview page based on some input. The way I am think of doing it is to use custom results to redirect to the proper preview page: if (preview1) { return CUSTOM_RESULT_PREV1; } else if(preview2) { return CUSTOM_RESULT_PREV2; } and so on. But I'm not sure if this is the 'best' way. The page that is calling this, could be accessed from different modules in the application, and the preview gives alot of information about the specific module item that loaded this page. Since this page can be called by X number of modules, and that number of modules will grow in the future, I am looking for a smooth way to handle the 'preview' button on that page. To handle the saving of the data, I abstracted the BridgeDAO. So if the shared module is called ModX then the save action looks like this: The action gets passed the module that called ModX and the id of the module item that called it modxDao.save(modX); bridgeDao = factory.getBridgeDao(ModuleId); //so now we have a dao for assiating the modX record to the module that created it bridgeDao.associateModX(moduleItemId); As you can tell, the MOdX data can be associated with other different modules in my application. So does any have any suggestion on how I should handle the 'preview' portion of this? The preview pages that are currently in the system, are all very unique with regards to content and layout. So I was thinking a bunch of ifs with custom results as shown above would be a good way to go. But I am also wondering if this should be abstracted, or would that be over kill. Any comments would be greatly appreciated, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File Upload Size
No it doesn't On Wed, Mar 19, 2008 at 2:14 PM, Lukasz Lenart <[EMAIL PROTECTED]> wrote: > Does your action implements ValidationAware interface? > > > > > > Regards > -- > Lukasz > > http://www.linkedin.com/in/lukaszlenart > > - > 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: File Upload Size
The reason I am asking this is bacuase when I upload a file over 15MB I get "no result mapped for INPUT" exception in my error log. When I do map a result for input the app hangs. I looked at the file upload in the struts showcase and it returns an error message when the file you upload is too big. I checked the source and I could not find where this is being implemented. I have on my page which i return input to, but as I said earlier my upload action is hanging. On Wed, Mar 19, 2008 at 1:12 PM, Richard Sayre <[EMAIL PROTECTED]> wrote: > I set the file upload max size in the struts.properties to 15MB. When > I upload a file over 15MB my action returns input. Is there any way I > can check to see if the file is over the max size set in the > properties file and handle what result I want to happen myself? I > seems that it returns input before it even goes into my action. Is > this happening in the file upload interceptor? Can I gain more > control over this? > > Thank you, > > Rich > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File Upload Size
I set the file upload max size in the struts.properties to 15MB. When I upload a file over 15MB my action returns input. Is there any way I can check to see if the file is over the max size set in the properties file and handle what result I want to happen myself? I seems that it returns input before it even goes into my action. Is this happening in the file upload interceptor? Can I gain more control over this? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting disable attribute dynamically
Ha ha I was trying this and couldn;t get it to work. My mistake was fullAccess = true, so readOnly="%{fullAccess}" was returning true, i meant to say readOnly="%{!fullAccess}". thanks On Thu, Mar 13, 2008 at 1:01 PM, Rushikesh Thakkar <[EMAIL PROTECTED]> wrote: > I have done it.. It goes like this: > > (1) The Action: > public class PrepareScreen extends ActionSupport { > >private String yesOrNo; > >public String execute() throws Exception { >yesOrNo = "true"; >return SUCCESS; >} > >public String getYesOrNo() { >return yesOrNo; >} >public void setYesOrNo(String yesOrNo) { >this.yesOrNo = yesOrNo; >} > } > > (2) The JSP: > > Is Struts2 good?: value="Yes, it is.."> > > regards, > Rushikesh > > On Thu, Mar 13, 2008 at 3:24 PM, Richard Sayre <[EMAIL PROTECTED]> > > wrote: > > > I made a slight error > > > > readonly="%{fullAccess}" with s:textfield does not work but > > > > > test="!fullAccess">readonly="true" /> > > > > works. > > > > On Thu, Mar 13, 2008 at 10:48 AM, Richard Sayre <[EMAIL PROTECTED]> > > wrote: > > > If the disable attribute is present in a HTML tag it will be disable, > > > no matter what the value of the attribute is. > > > > > > So if I have a s:select and I say disabled="false" it will be > > > disabled (renders disabled="disabled"). > > > > > > But if we have a text, and we set readonly="false" it will not be > > editable. > > > > > > On my page my action determines my users access level - fullAccess > > > (user can edit anything) or partialAccess (user can edit certian > > > fields but see the other fields) > > > > > > I have a text field set up like this s:textfield > > > readonly="%{fullAccess}". which works fine. > > > > > > But s:select disabled="%{fullAccess}" does not work. > > > > > > I tried this disabled="true" > > > /> But the s:if tag is causing a syntax error. > > > > > > The only solution I came up with was > > > > > > > > > > > > > > > > > > > > > > > > > So I have 2 s:selects and s:radios for every radio/select > > > > > > I would prefer to have it like the textfields so I dont have to have 2 > > > pieces of code for each select and radio. > > > > > > I figured i could do an around a
Re: not interpreted
try: ">Copy if id is on the stack, you can get it with OGNL On Thu, Mar 13, 2008 at 10:49 AM, matthieu martin <[EMAIL PROTECTED]> wrote: > Hi all ! > > I have a little issue and I find no clues on the web, so i'm turning myself > to you. > > I have a piece of code like this : > > > > > > > targets="dataImageDiv">Edit > > targets="dataImageDiv">Move > > targets="dataImageDiv">Copy > > > > > > > > this piece of code is placed in a loop, and creates a small menu for each > images I have in galleries. The dataImageDiv is used to contain whatever > form I need. > > The problem is that my tags contained in my tags aren't > interpreted. After few manipulations, I observed that the tag > is interpreted only if it's not contained in a struts tag. For instance : > > > > produces > > > > BUT > > > > produces > > > > > > Thus, my piece of code produces : > > > > 1 > > targets="dataImageDiv">Edit > > targets="dataImageDiv">Move > > targets="dataImageDiv">Copy > > > > is well included in my header. > > Thanks in advance, > > > > Matthieu > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Setting disable attribute dynamically
I made a slight error readonly="%{fullAccess}" with s:textfield does not work but readonly="true" /> works. On Thu, Mar 13, 2008 at 10:48 AM, Richard Sayre <[EMAIL PROTECTED]> wrote: > If the disable attribute is present in a HTML tag it will be disable, > no matter what the value of the attribute is. > > So if I have a s:select and I say disabled="false" it will be > disabled (renders disabled="disabled"). > > But if we have a text, and we set readonly="false" it will not be editable. > > On my page my action determines my users access level - fullAccess > (user can edit anything) or partialAccess (user can edit certian > fields but see the other fields) > > I have a text field set up like this s:textfield > readonly="%{fullAccess}". which works fine. > > But s:select disabled="%{fullAccess}" does not work. > > I tried this disabled="true" > /> But the s:if tag is causing a syntax error. > > The only solution I came up with was > > > > > > > So I have 2 s:selects and s:radios for every radio/select > > I would prefer to have it like the textfields so I dont have to have 2 > pieces of code for each select and radio. > > I figured i could do an around a
Setting disable attribute dynamically
If the disable attribute is present in a HTML tag it will be disable, no matter what the value of the attribute is. So if I have a s:select and I say disabled="false" it will be disabled (renders disabled="disabled"). But if we have a text, and we set readonly="false" it will not be editable. On my page my action determines my users access level - fullAccess (user can edit anything) or partialAccess (user can edit certian fields but see the other fields) I have a text field set up like this s:textfield readonly="%{fullAccess}". which works fine. But s:select disabled="%{fullAccess}" does not work. I tried this disabled="true" /> But the s:if tag is causing a syntax error. The only solution I came up with was So I have 2 s:selects and s:radios for every radio/select I would prefer to have it like the textfields so I dont have to have 2 pieces of code for each select and radio. I figured i could do an around a
Re: Invoking action method from javascript
you can say, document.location.href = '?myId=' + myId; This will cause the whole page to refresh, so you should probably have a prepare method if you have any data that needs to be populated on that page (ie your table). I personally would use Ajax to make the call, having a full page refresh on each click could be annoying to the user. Rich On Fri, Feb 29, 2008 at 11:01 AM, Paranoid_Fabio <[EMAIL PROTECTED]> wrote: > > Hello. I've an action that populates a table with some info. In each row, > there's a button to delete the entry and the associated object from the DB. > In my action class I've a list (something like a queue) of the ID that will > be removed after the user clicks on the "apply" button. > So, all I want to do, is to add each element ID the user selects to the > "remove-queue". When the user clicks on the remove icon, a javascript > function is called: > > the jsp snippet: > > ')" > > ../pages/Images/edit_remove.png > > > the script inside the JSP. > > > function addToRemoveList(id){ > > } > > > The script is correctly invoked and the paramater ID is correctly passed. > Now i would like to call a method of my action class and to refresh the > page. Something like: > > > function addToRemoveList(id){ > > myCurrentAction.addItemToRemove(id) > > > } > > > is it possible? thank you very much > > > -- > View this message in context: > http://www.nabble.com/Invoking-action-method-from-javascript-tp15759459p15759459.html > Sent from the Struts - User mailing list archive at Nabble.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: s:select and pre-selection
I have a select that populates with a int,string id/value combo. To get the s:select to select the proper option I had to crate another value in my action (int myId). This would be set to the id of the option to select. Then I had to set the name attribute of my select to myId (name="myId"). On Fri, Feb 29, 2008 at 5:04 AM, Daniel Baldes <[EMAIL PROTECTED]> wrote: > Hi, > > I have a select box: > > list="availableObjects" listKey="id" listValue="name" /> > > "availableObjects" is a list of objects having an id and a name > property, where id is of type "long". "user.property" is 'converted' to > its id (as String) by a type converter. > > Now, setting user.property works well with this, but the current value > is not pre-selected when I load the form. When I show user.property in a > textfield, the correct ID is displayed (the id of the option which > should be pre-selected). > > I found a hint in the s:select documentation, which says that for > OGNL-generated maps, the type of the key-attribute must be the same as > the type of the listKey property in order to match. So I implemented > "getIdAsString()" and used listKey="idAsString", but it doesn't work either. > > What am I doing wrong here? > > (I am using struts 2.0.11) > > Any help or hint will be appreciated. > > Thanks in advance, > > Daniel > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to add page links dynamically
I think what you are looking for is caled bread crumbs. There is a plug in to help with this http://cwiki.apache.org/S2PLUGINS/breadcrumbs-plugin.html On Fri, Feb 29, 2008 at 5:04 AM, Sanjeewa Saman <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > > > I want to add my page links in the top of the each page, that mean I need to > add the parent page details in sub pages on top like, > > Home > titlepage2 >subtitle page>etc.. please c the image bellow > > > > Can somebody suggest me a way to do this. When I call struts2 actions I get > this pages. So is their way to do that using struts. > > > > Sanjeewa. > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and SOA
Thank you everyone for your input. I will research a little further to see how I am going to do this. On Tue, Feb 26, 2008 at 5:17 PM, Randy Burgess <[EMAIL PROTECTED]> wrote: > > From: Richard Sayre <[EMAIL PROTECTED]> > > Reply-To: Struts Users Mailing List > > Date: Tue, 26 Feb 2008 15:32:56 -0330 > > > To: Struts Users Mailing List > > Subject: Re: Struts 2 and SOA > > > > > Ok. All of my actions call my DAOs for their logic. Most of my > > actions look like this: > > > > > > public String myActionMethod() { > > > >myDAO.getARecord(); > > > > //populate the action with record fields (will be displayed on a > > form or table etc) > > > > if (someField = Status.EDIT && user.hasFullAccess() ) { > > > > fullAccess = true; > > > > } else { > > readOnly = true; > > } > > > > } > > > > The most 'busniess logic' that my action contains is setting > > variables based on database information (fullAccess or readOnly). Im > > not sure if this should be moved out of here and into the DAO or not. > > also might have a save() method that determines if I should call add > > or update on my DAO. > > > > Are fullAccess or readOnly used in your view? How would you expose them if > you put them in a service layer? If they are used in the view then it seems > to me like they have nothing to do with the service and shouldn't be there. > Maybe an interceptor would be a better idea if this logic is sprinkled > throughout your S2 application. > > > > So, would I expose my DAO as a service? Is this a good Idea? DO I > > need to add another layer (POJO) or would that be overkill? If I do > > have some security logic in my Action, should this be moved to a POJO > > that calls the dao and set up its own members, isReadOnly, hasAccess > > etc. I also do some data validation in my action, ie I check to see > > if the data passed to my action is allowed to be accessed by that user > > (this aviods URL rewrting and re writing POST data with proxy > > servers). So I get an id of something the uesr wants to access and I > > make sure that user is allowed to access it. Should this be moved out > > of the action? Did I make a mistake putting it there? If so I > > imagine putting this logic in to a POJO which controlla access to the > > DAO, then the action calls the POJO or web service. I guess then the > > POJO and DAO become my Model and no busniess logic is in the action at > > all. Now that I think about it, this seems like a good idea. I was > > new to MVC when I was thrown into Struts 2 so hopefully this misake > > does nto ccost me too much time. If I do this, (Action -> POJO -> > > DAO) then I would expose the POJO as the web service? > > > > Thank you for your input, > > > > Rich > > > > I recommend checking Amazon for books on SOA or checking out some of the > excellent web sites devoted to it. I googled and came up with this, which > looks pretty good for a start. This is a huge topic in and of itself but it > doesn't really have anything to do with Struts. > > http://java.sun.com/developer/technicalArticles/WebServices/soa3/ > > Randy > > > > > > > On Tue, Feb 26, 2008 at 3:05 PM, Randy Burgess <[EMAIL PROTECTED]> wrote: > >>> From: Richard Sayre <[EMAIL PROTECTED]> > >>> Reply-To: Struts Users Mailing List > >>> Date: Tue, 26 Feb 2008 14:08:18 -0330 > >> > >>> To: Struts Users Mailing List > >>> Subject: Re: Struts 2 and SOA > >>> > >> > >>> Could you elaborate a bit. Would the POJO contain the Business logic > >>> for calling My DAO and other classes? Would the POJO replace the > >>> action functionality? Then my action would use a POJO to do all of > >>> the work? So any logic in MyAction.save() would go into POJO.save() > >>> which would then be called form my action? That way My POJO could be > >>> accessed from my struts application and any other clients that need it > >>> functionality? I dont see any need for .NET interoperability in the > >>> future, but it would hurt to have that option. The main reason for > >>> this is we are designing a new J2EE Application seprate from our > >>> current system. In the future we want to beable to access certian > >>> functionality of each of these systems. So System
Re: Struts 2 and SOA
Ok. All of my actions call my DAOs for their logic. Most of my actions look like this: public String myActionMethod() { myDAO.getARecord(); //populate the action with record fields (will be displayed on a form or table etc) if (someField = Status.EDIT && user.hasFullAccess() ) { fullAccess = true; } else { readOnly = true; } } The most 'busniess logic' that my action contains is setting variables based on database information (fullAccess or readOnly). Im not sure if this should be moved out of here and into the DAO or not. also might have a save() method that determines if I should call add or update on my DAO. So, would I expose my DAO as a service? Is this a good Idea? DO I need to add another layer (POJO) or would that be overkill? If I do have some security logic in my Action, should this be moved to a POJO that calls the dao and set up its own members, isReadOnly, hasAccess etc. I also do some data validation in my action, ie I check to see if the data passed to my action is allowed to be accessed by that user (this aviods URL rewrting and re writing POST data with proxy servers). So I get an id of something the uesr wants to access and I make sure that user is allowed to access it. Should this be moved out of the action? Did I make a mistake putting it there? If so I imagine putting this logic in to a POJO which controlla access to the DAO, then the action calls the POJO or web service. I guess then the POJO and DAO become my Model and no busniess logic is in the action at all. Now that I think about it, this seems like a good idea. I was new to MVC when I was thrown into Struts 2 so hopefully this misake does nto ccost me too much time. If I do this, (Action -> POJO -> DAO) then I would expose the POJO as the web service? Thank you for your input, Rich On Tue, Feb 26, 2008 at 3:05 PM, Randy Burgess <[EMAIL PROTECTED]> wrote: > > From: Richard Sayre <[EMAIL PROTECTED]> > > Reply-To: Struts Users Mailing List > > Date: Tue, 26 Feb 2008 14:08:18 -0330 > > > To: Struts Users Mailing List > > Subject: Re: Struts 2 and SOA > > > > > Could you elaborate a bit. Would the POJO contain the Business logic > > for calling My DAO and other classes? Would the POJO replace the > > action functionality? Then my action would use a POJO to do all of > > the work? So any logic in MyAction.save() would go into POJO.save() > > which would then be called form my action? That way My POJO could be > > accessed from my struts application and any other clients that need it > > functionality? I dont see any need for .NET interoperability in the > > future, but it would hurt to have that option. The main reason for > > this is we are designing a new J2EE Application seprate from our > > current system. In the future we want to beable to access certian > > functionality of each of these systems. So System A will be asking > > System B for info and doing some work based on that info. > > What you are describing here is essentially the standard MVC pattern. The > business object doesn't have to be a POJO. In general there should be no > business logic in your action, it should be in some external class such as a > POJO, EJB or web service of some sort. > > Randy > > > > > > This email and any attachments ("Message") may contain legally privileged > and/or confidential information. If you are not the addressee, or if this > Message has been addressed to you in error, you are not authorized to read, > copy, or distribute it, and we ask that you please delete it (including all > copies) and notify the sender by return email. Delivery of this Message to > any person other than the intended recipient(s) shall not be deemed a waiver > of confidentiality and/or a privilege. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Submit, ajax, targets and action
Sorry this posted too early... I updated the code so it submits the form fields with the ajax request: let me know if it helps. Rich > function submitFunctionA() { > > var kw = { > url:'', > load:function(type, data, evt) { > //up to you what happens here > }, > method: "POST", > formNode: dojo.byId("myForm"), > error: function(type, data, evt){ > //error > } > }; > > dojo.io.bind(kw); > } > > } > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Submit, ajax, targets and action
If I understand you correctly, You could write you own submit function(s) that does its own ajax with dojo function submitFunctionA() { var kw = { url:'', load:function(type, data, evt) { //up to you what happens here }, method: "POST", error: function(type, data, evt){ //error } }; dojo.io.bind(kw); } } So you could have each of your submit buttons call their own function and forget about the form On Tue, Feb 26, 2008 at 2:59 PM, Matthew Seaborn <[EMAIL PROTECTED]> wrote: > > > > > I have a form which contains a number of different submit buttons, each > using the action attribute on the submit tag to control which action this > called, this work fine. > > > > I want this form to load dynamically into a DIV on another page and then > using the AJAX theme and targets attributes on the submit tag such that the > form updates and remains in the DIV, this also works. > > > > However, the action attribute does not appear to work with the AJAX theme; > the called action is the form defined one. Is this deliberate or a bug? > Does anyone know a good workaround? > > > > Many thanks. > > > > > > > > > > > > Matthew Seaborn > > Software Architect > t+44(0) 208 484 0729 > m +44(0) 7949 465 142 > > e [EMAIL PROTECTED] > > > Sussex House > Plane Tree Crescent > Feltham, Middlesex, TW13 7HE > United Kingdom > http://www.performgroup.com/ > > > > > > > CONFIDENTIALITY - This email and any files transmitted with it, are > confidential, may be legally privileged and are intended solely for the use > of the individual or entity to whom they are addressed. If this has come to > you in error, you must not copy, distribute, disclose or use any of the > information it contains. Please notify the sender immediately and delete > them from your system. > > SECURITY - Please be aware that communication by email, by its very nature, > is not 100% secure and by communicating with Perform Group by email you > consent to us monitoring and reading any such correspondence. > > VIRUSES - Although this email message has been scanned for the presence of > computer viruses, the sender accepts no liability for any damage sustained > as a result of a computer virus and it is the recipient's responsibility to > ensure that email is virus free. > > AUTHORITY - Any views or opinions expressed in this email are solely those > of the sender and do not necessarily represent those of Perform Group. > > COPYRIGHT - Copyright of this email and any attachments belongs to Perform > Group, Companies House Registration number 6324278. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and SOA
> > I dont see any need for .NET interoperability in the > > future, but it would hurt to have that option. > > I like your typo more than what you actually meant ;) Ha ha, that is quite funny. > Another thing to look at is the RESTful plugin. It allows the same action to > serve back data in different formats depending on (well, I'm simplifying) the > extension used to call the action. This means your action could return JSON, > XML, HTML, heck, CSV, depending on how it was called. > > This is a lighter-weight approach to SOA that allows for a pretty high degree > of flexibility; it can be used to feed AJAX components, Flash apps, > plain-old-websites, testing, etc. and can serve as a stepping stone* to more > elaborate SOA architectures if it turns out more is necessary. > > Dave > > * RESTful Plugin: the Gateway Drug. I can see how this would work, but it almost seems a little dirty. I would prefer to use the J2EE API to implement the SOA. Could I take the parts of my Strtus app that I want to share, and turn them into services that both my strtus app and any other client can call? I am open to the REST plugin, I would just like to make sure I am not creating more work in the furure if I have to integrate these Services with Workflow apps and other systems. I would like to do it the best way possible the first time, even if it means longer development. Thanks, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: decorator is not working after ajax call
When is you page disappearing? After you click "Submit"? You submit is not using Ajax. If you want to update your div when you submit the form then you could write a function that notifies your listen topic rather than submitting the form. Rich On Tue, Feb 26, 2008 at 7:22 AM, Prashant Khanal <[EMAIL PROTECTED]> wrote: > Hello all, > > Somehow my header and footer provided by my decorator page disappears after > ajax call. My jsp page that makes ajax call is shown below: > <%@ include file="/common/taglibs.jsp"%> > > > Demand Plan > > > > Sequence: value="%{#session.planSequence.sequenceName}" /> > cssClass="text large" required="true" theme="css_xhtml" > onchange="javascript:dojo.event.topic.publish('distributeDemandTopic');" > /> > > > listenTopics="distributeDemandTopic"/> > > > > > The page that is comes as an ajax response is: > <%@ include file="/common/taglibs.jsp" %> > > > > name="selectedDemandPlansMap[%{#attr.selectedDemandPlan.hierarchyLevelEntity.entityId}].forecastDemand" > value="%{#attr.selectedDemandPlan.forecastDemand}" > theme="simple"/> > > name="selectedDemandPlansMap[%{#attr.selectedDemandPlan.hierarchyLevelEntity.entityId}].percentageTotal" > value="%{#attr.selectedDemandPlan.percentageTotal}" > theme="simple"/> > > > The snippet of struts.xml that configures the action is: > > /WEB-INF/pages/demandPlan.jsp > > > method="distribute"> > name="success">/WEB-INF/pages/distributedDemands.jsp > > > After an ajax call my header and footer disappears. > What can be the problem? :( > > -- > Thanks, > Prashant Khanal > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] Date format in TextField
I'm not sure if I understand you correctly but... > I want to display editable dates in textfields. This should be as simple as using a textfield (input type=text) as your date field >I cannot use JavaScript, so > datetimepicker isn't an option. So the user will have to manually enter the date by typing. >Currently the date is displayed as dd/mm/yy > if there is a value. How can I change this to be dd/mm/? We recently has this probem. We gave the user to an option set the date format for our whole system. Now whenver we read dates out of the database they get formatted to the users specified format. If you are using one date, then you can hard code the format (in a properties file) and apply it to all dates that come out of the database. I believe in Oracle, and possibly other DBMS you can also specify a format that you want the date to come out as when it is queried. You wont have to apply any formatting if this is the case. For validation If you can't use java script the best way I can see to do this would be to have your field: MyDate: __ (dd/mm/) This will inform the user of the correct format. You will have to validate this format on the server side and if the format is not dd/mm/ you can return the error and let the user know tha the format is wrong. > > > > Many thanks, > > Martin > > > > Capgemini is a trading name used by the Capgemini Group of companies which > includes Capgemini UK plc, a company registered in England and Wales (number > 943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 > 6DB. > > > > This message contains information that may be privileged or confidential and > is the property of the Capgemini Group. It is intended only for the person to > whom it is addressed. If you are not the intended recipient, you are not > authorized to read, print, retain, copy, disseminate, distribute, or use > this message or any part thereof. If you receive this message in error, > please notify the sender immediately and delete all copies of this message. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 and SOA
I am not using Spring yet. We currently just finished migrating our application to struts 2. We have not had a chance to look into Spring yet but it was recommended by the person who started the struts migration. If this is part of the solution to getting our struts app to share it functionality then we would have to do it. We are developing a new System that in the future will have to talk to certain part of our current system and integrate with work flow applications. I also want to develop this new application so it can share its functionality easily. I am wondering how my design will change knowing that I have to do this. Where does Struts fit in? Does it fit in at all? Any comments are greatly appreciated. Rich On Tue, Feb 26, 2008 at 1:45 PM, Randy Burgess <[EMAIL PROTECTED]> wrote: > Especially if you are using Spring then it will be very simple using CXF to > expose your business logic as a web service. > > Regards, > Randy Burgess > Sr. Web Applications Developer > Nuvox Communications > > > > > From: Richard Sayre <[EMAIL PROTECTED]> > > Reply-To: Struts Users Mailing List > > Date: Tue, 26 Feb 2008 11:05:48 -0330 > > To: Struts Users Mailing List > > Subject: Struts 2 and SOA > > > > > > If I have a struts application, is it posssible to expose some of the > > functionality as a Web Service? After reading some SOA documents on > > the Sun website, it is possible to expose servlets as web services. > > Is this possible with Strus and J2EE? Is there a document that I can > > read on it? Are there any best practices for designing a struts > > application so you can expose certian pieces as a service? > > > > Thank you, > > > > Rich > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > This email and any attachments ("Message") may contain legally privileged > and/or confidential information. If you are not the addressee, or if this > Message has been addressed to you in error, you are not authorized to read, > copy, or distribute it, and we ask that you please delete it (including all > copies) and notify the sender by return email. Delivery of this Message to > any person other than the intended recipient(s) shall not be deemed a waiver > of confidentiality and/or a privilege. > > > > - > 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 2 and SOA
Could you elaborate a bit. Would the POJO contain the Business logic for calling My DAO and other classes? Would the POJO replace the action functionality? Then my action would use a POJO to do all of the work? So any logic in MyAction.save() would go into POJO.save() which would then be called form my action? That way My POJO could be accessed from my struts application and any other clients that need it functionality? I dont see any need for .NET interoperability in the future, but it would hurt to have that option. The main reason for this is we are designing a new J2EE Application seprate from our current system. In the future we want to beable to access certian functionality of each of these systems. So System A will be asking System B for info and doing some work based on that info. After talking briefly with a more experienced analyst, he mentioned that SOA might be worth checking out. I am kind of getting away from a struts topic now but, since I am designing this system from scratch, and it has to communicate with a J2EE / Struts that we currently have in place is SOA a good solution?Are there other solutions that might be better? And way off topic but something that I also want to plan for is integrating parts of our application in to Workflow applications. Sorry for taking this out of the Struts realm on this mailing list. If there is somewhere else to find these answers let me know. The struts aspect of this is , how am I going to get my strus app to share its functionality, what is the best way to achieve this? Thanks Rich On Tue, Feb 26, 2008 at 11:18 AM, Lukasz Lenart <[EMAIL PROTECTED]> wrote: > Hi, > > I think, it will be better if try to use XFire / CXF or Axis2, you can > create simple POJO and expose it as WebService and from the other side > you can use such POJO in your Struts2 actions. And of course you can > use Spring to initialize it and inject to your actions ;-) > If you want to have better interoperability with .NET you should > consider using literal/document style for your WebServices (base on > XSD and XML messages). > > > Regards > -- > Lukasz > > http://www.linkedin.com/in/lukaszlenart > > - > 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 2 and SOA
If I have a struts application, is it posssible to expose some of the functionality as a Web Service? After reading some SOA documents on the Sun website, it is possible to expose servlets as web services. Is this possible with Strus and J2EE? Is there a document that I can read on it? Are there any best practices for designing a struts application so you can expose certian pieces as a service? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reflect.InvocationTargetException
Hi All, I am getting the following error in my Struts 2 application. "class java.lang.reflect.InvocationTargetException : null" None of my classes are showing up in the stack trace. But it is happening at the same spot in my application. Has anyone encountered this before? Any suggestons on how to fix this? Here is the beginning of the stack trace: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Populate Form from DAO
Yes, I know I can do it this way. I'm just being lazy. I want: To automatically get/set MyObject.getMeember1() rather then it automatically setting it in the Action and then having me create the Object and populate it with values. On Feb 1, 2008 9:10 AM, LEONARD Julien (Consulting for ACCOR Hotels) <[EMAIL PROTECTED]> wrote: > Did you try : > > MyObject theObject; > (geter and setter on theObject) > > execute () { > > theObject = myDAO.getRecord(id); > } > > And in the JSP : > > -Message d'origine- > De : Richard Sayre [mailto:[EMAIL PROTECTED] > Envoyé : vendredi 1 février 2008 13:37 > À : Struts Users Mailing List > Objet : Populate Form from DAO > > > Struts 2 allows us to automatically populate our forms if we name our fields > correctly, which is wonderful. > > My actions usually go something like this > > execute () { > > MyObject o = myDAO.getRecord(id); > >member1 = o.getMember1(); >member2 = o.getMember2(); > > } > > MyObject is a JO for hold a row in the database. I like the fact that I can > name my form field 'member1' and it the interceptor will set and get from my > Action. I dont like having to set up each member variable in the action with > the members my class. Is it possible to somehow have Struts automatically > populate an Java Object rather then the Action? I thought I remember reading > about this before but I'm not sure. It's not a big deal, and I know I can > use OGNL to access the value, but I wanted the convience of mapping a > fieldName to my custom object. Is this possible? > > Thank you, > > Rich > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > This e-mail, any attachments and the information contained therein ("this > message") are confidential and intended solely for the use of the > addressee(s). If you have received this message in error please send it back > to the sender and delete it. Unauthorized publication, use, dissemination or > disclosure of this message, either in whole or in part is strictly prohibited. > ** > Ce message électronique et tous les fichiers joints ainsi que les > informations contenues dans ce message ( ci après "le message" ), sont > confidentiels et destinés exclusivement à l'usage de la personne à laquelle > ils sont adressés. Si vous avez reçu ce message par erreur, merci de le > renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, > totale ou partielle ou divulgation sous quelque forme que se soit non > expressément autorisées de ce message, sont interdites. > ** > > > - > 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]
Populate Form from DAO
Struts 2 allows us to automatically populate our forms if we name our fields correctly, which is wonderful. My actions usually go something like this execute () { MyObject o = myDAO.getRecord(id); member1 = o.getMember1(); member2 = o.getMember2(); } MyObject is a JO for hold a row in the database. I like the fact that I can name my form field 'member1' and it the interceptor will set and get from my Action. I dont like having to set up each member variable in the action with the members my class. Is it possible to somehow have Struts automatically populate an Java Object rather then the Action? I thought I remember reading about this before but I'm not sure. It's not a big deal, and I know I can use OGNL to access the value, but I wanted the convience of mapping a fieldName to my custom object. Is this possible? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to improve dojo performance in Struts 2.0.9
Is the $resources$ directory WEB-INF? On Oct 6, 2007 8:51 AM, Jeromy Evans <[EMAIL PROTECTED]> wrote: > I thought I'd share the instructions I prepared for creating a dojo > 0.4.2 custom profile for Struts 2.0.9. The objective is to bundle all > the required dojo resources into dojo.js to avoid the numerous slow > sequential requests for resources. This makes a massive performance > improvement to the default ajax theme. > > Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9: > > $resources$ is assumed to be your web resources directory > > 1. First, configure struts to serve the static files directly from > $resources$/struts instead of from within struts-core-2.0.9.jar: > > a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to > $resources$/struts/ > b. edit struts.properties and set struts.serve.static=false > c. also extract the javascript and css files from > struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will > be helpful later > eg. $resources$/struts/ajax/dojoRequire.js > > Confirm that your application still works before proceeding. It's > essential that resources are loaded from the directory rather than the jar. > > 2. Download the source of dojo 0.4.2. You won't need to modify it. The > download location doesn't matter. We assume it's in release-0.4.2/ > >> svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2 > > This is almost identical to the version bundled with struts2.0.9. > > 3. Use an editor to create a dojo custom profile as the file > release-0.4.2/buildscripts/profiles/struts2.profile.js. This file > defines which dojo resources you use directly. Essentially it specifies > which code will be included in dojo.js. An example that includes almost > everything is provided at the end of this email. > > 4. Copy the struts widgets into the dojo directory so they can be > included within dojo.js. That is, copy $resources$/struts/dojo/struts/* > to release-0.4.2/struts. > This is the directory that contains the widget and widgets > subdirectories, css and some images. > > 5. Build dojo using ant. This will create a new dojo.js file: > > > cd release-0.4.2/buildscripts > > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release > intern-strings strip-resource-comments > > (You may be asked to run it twice). > > Pay some attention to the build process. In particular, note whether it > finds the struts widgets and 'internalises' the related resources. If > not, see Step 4. You'll probably notice a lot of things are included > that you don't need. That will be helpful later for optimizations. > Some errors will occur while stripping the comments but these are ok. > > 6. When the build process completes the release directory will contain > all the files you need. The content of the release directory can be > copied over the top of $resources$/struts/dojo. You'll notice it's > almost exactly the same as the original, although dojo.js is probably > larger. > > It's okay to delete the demo, test and release subfolders before copying > to your application. The src subfolder must be distributed with your > application as it contains images used by dojo. > > 7. Clear your browser cache and test your application again. You should > note the larger dojo.js file being loaded and significantly fewer > requests for resources by dojo Hopefully it's also a lot faster. > > That's it. Now you can go back and optimize the profile by removing > resources you don't need. There's examples in the profiles directory. > Repeat the build/test process to find the right balance. > I also recommend editing $resources$/struts/ajax/dojoRequire.js to > remove the reference to the Editor2 if you don't use this as it's a > very,very heavy-weight resource. > > Hope that helps someone else. Improvements & comments welcome. See > reference [3] below for detailed instructions and rationale. > > regards, > Jeromy Evans > > Resources > [1] http://struts.apache.org/2.x/docs/performance-tuning.html > [2] > http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981 > [3] > http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo-builds-better-performance > > The following profile includes almost everything in dojo.js. It assumes > the struts widgets have been copied into the directory as mentioned at > step 4. > struts2.profile.js: > > var dependencies = [ >"dojo.lang.*", > "dojo.html.*", >"dojo.debug", > "dojo.html.display", > "dojo.html.layout", > "dojo.html.util", > "dojo.lfx.*", > "dojo.event.*", > "dojo.logging.*", > "dojo.io.*", > "dojo.io.IframeIO", > "dojo.date", > "dojo.string.*", > "dojo.regex", > "dojo.rpc.*", > "dojo.xml.*", > // "dojo.flash.*", > // "dojo.storage.*", > "dojo.undo.*", > "dojo.crypto.*", > //"dojo.collections.*", > "dojo.collections.ArrayList", >
Re: DisplayTag - show image by condition
You have to make your own decorator: I assume your table is populated with a 'Member' list or something similar. In your table decorator create a method that returns the image based on the condition: public class MemberListDecorator extends TableDecorator { public String getType() { String returnString = new String(); Member data= (Member)getCurrentRowObject(); if(data.isVip()) { returnString = ""; } else { returnString = ""; } return returnString; } } DOnt forget to include the decorator in your table tag: . . . Rich On Dec 5, 2007 12:16 PM, quinquin2209 <[EMAIL PROTECTED]> wrote: > > Hi All, > > I am trying with the displayTag and I would like to see if it is possible to > display an image at the first column depending on some conditions. For > example, a "vip.gif" should be shown if the person is a VIP and no image > should be shown if the person is normal member. How can I achieve it? Can I > do this with TableDecorator? > > Thanks in advance > > Queenie > -- > View this message in context: > http://www.nabble.com/DisplayTag---show-image-by-condition-tf4950401.html#a14174056 > Sent from the Struts - User mailing list archive at Nabble.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: Can struts2 tag embeded inside javascript
I don't see any javascript in your post but if you are creating an imput element this should work as long as the javascript is on your jsp page in
Struts 2 Session Timeout
I noticed while developing my application that Struts 2 (I think) will recreate your session when it times out. I have several name spaces used in my packages such as: 1. /Admin 2. /Design 3. / While I am hitting actions in the /Admin or /Design area of my application, if the session times out I am redirected back to my main page with a restored session. If any of the link point to / then the session does not get restored. How can I restore the session in the / name space? Is there any reason why this is not happening for the / name space? Thank you Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Submit all Checkboxes
I am using struts 2. Right now when I submit I only get the values of the checked boxes by default. On 10/31/07, Dave Newton <[EMAIL PROTECTED]> wrote: > Which version of Struts? > > S2 has this capability built-in. > S1 can use the same technique by including a hidden > form field. > > d. > > --- Richard Sayre <[EMAIL PROTECTED]> wrote: > > > I have a variable amount of check boxes with the > > same name. I want to > > submit all of the check boxes weather they are > > checked or not. Right > > now I only get an of array for the ones that are > > checked. > > > > My form has x number of 'Name' text fields x number > > of 'Activate' > > check boxes for another. > > > > The user will fill in the 'name' and check the box > > to 'activate' the > > user. I was using two arrays in my action to store > > the values of the > > check box and the text. If I could find a way to > > submit all the check > > boxes the arrays would be parallel and I could > > easily tell which user > > name is activated. Right now I have no way to tell. > > > > Any suggestions? > > > > Thank you, > > > > Rich > > > > > - > > 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]
Submit all Checkboxes
I have a variable amount of check boxes with the same name. I want to submit all of the check boxes weather they are checked or not. Right now I only get an of array for the ones that are checked. My form has x number of 'Name' text fields x number of 'Activate' check boxes for another. The user will fill in the 'name' and check the box to 'activate' the user. I was using two arrays in my action to store the values of the check box and the text. If I could find a way to submit all the check boxes the arrays would be parallel and I could easily tell which user name is activated. Right now I have no way to tell. Any suggestions? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exception Logging
Thank you. That worked perfect. On 10/13/07, Jeromy Evans <[EMAIL PROTECTED]> wrote: > In addition to configuring log4j to use a FileAppender to write logs to > a file, here's a very simple way to log exceptions manually from the > exception page: > > Within your jsp include the following code: > > > <% > String stackTrace = (String) > pageContext.getAttribute("stackTrace"); > new ExceptionLogger().logException(stackTrace); > %> > > where ExceptionLogger is a class you write to log the stackStrace or > other information to a file. > > I use a similar fragment in the JSP to email a copy of the stacktrace to > the administrator if the exception page is ever displayed. > > Hope that helps, > Jeromy Evans > > Richard Sayre wrote: > > I am trying to log the exception that get cought by the struts > > exception handler. > > > > So far I have .jsp page that shows the exception: > > > > An Exception Has occured! > > > > > > > > > > > > = > > > > > > > > > > I am going to change this page to display a generic error message. I > > want to write the value of exception and exceptionStack to a file. > > How can I do this? I can't figure out a way to write those values to > > a file on the JSP page. > > > > > > I tried to pass the values it to an Action but I couldn't pass in the > > exceptionStack. exception and exceptionStack are both Strings in my > > Action class. > > > > > > /SystemError > > true > > ${exception} > > ${exceptionStack} > > > > > > When an exception occues the result does not get executed and I get > > the following Stack Trace. I truncated most of the trace. > > > > java.lang.ArrayIndexOutOfBoundsException: 8192 > > at > > org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:720) > > at > > org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:627) > > at > > org.apache.coyote.http11.InternalOutputBuffer.sendHeader(InternalOutputBuffer.java:500) > > at > > org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1615) > > at > > org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:962) > > at org.apache.coyote.Response.action(Response.java:182) > > at org.apache.coyote.Response.sendHeaders(Response.java:378) > > at > > org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:317) > > at > > org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:278) > > at > > org.apache.catalina.connector.Response.finishResponse(Response.java:476) > > at > > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) > > at > > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) > > at > > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) > > at > > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) > > at > > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) > > at > > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) > > at java.lang.Thread.run(Thread.java:619) > > > > > > Any suggestion on where I am going wrong would be appreciated. > > > > Thanks > > > > Rich > > > > - > > 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: Exception Logging
I thought I would add this part of the stack trace in case it helps: SEVERE: Error finishing response java.lang.ArrayIndexOutOfBoundsException at java.lang.System.arraycopy(Native Method) at org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:689) at org.apache.coyote.http11.InternalOutputBuffer.sendStatus(InternalOutputBuffer.java:428) at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1604) at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:962) at org.apache.coyote.Response.action(Response.java:180) at org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:388) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:906) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:619) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Exception Logging
I am trying to log the exception that get cought by the struts exception handler. So far I have .jsp page that shows the exception: An Exception Has occured! = I am going to change this page to display a generic error message. I want to write the value of exception and exceptionStack to a file. How can I do this? I can't figure out a way to write those values to a file on the JSP page. I tried to pass the values it to an Action but I couldn't pass in the exceptionStack. exception and exceptionStack are both Strings in my Action class. /SystemError true ${exception} ${exceptionStack} When an exception occues the result does not get executed and I get the following Stack Trace. I truncated most of the trace. java.lang.ArrayIndexOutOfBoundsException: 8192 at org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:720) at org.apache.coyote.http11.InternalOutputBuffer.write(InternalOutputBuffer.java:627) at org.apache.coyote.http11.InternalOutputBuffer.sendHeader(InternalOutputBuffer.java:500) at org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1615) at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:962) at org.apache.coyote.Response.action(Response.java:182) at org.apache.coyote.Response.sendHeaders(Response.java:378) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:317) at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:278) at org.apache.catalina.connector.Response.finishResponse(Response.java:476) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:619) Any suggestion on where I am going wrong would be appreciated. Thanks Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How can i get Exception message and StackTrace ?
Hi, You can use to get that information. Rich On 10/11/07, jignesh(india) <[EMAIL PROTECTED]> wrote: > > Hello, > Thanks in advanced.! > Do anyone help me,how can i get exception message,StackTrace into my > user defined class ? > My code is looks like this:- > > > /AMK.fi_view/Exception.jsp > > > > result="Exception"/> > > > > xxxsome action > > > I am able to see user defined Exception page while it occurs,but i also want > that exception messages and stackTrace. > > Best Regards, > Jignesh > > -- > View this message in context: > http://www.nabble.com/How-can-i-get-Exception-message-and-StackTrace---tf4605357.html#a13150176 > Sent from the Struts - User mailing list archive at Nabble.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: Exception Handling and Logging
Hi Paul, I know its been a while but I am now trying to log my exceptions. Previously I was redirecting to a JSP and outputting the error. A requirement has come up where the client does not want the user seeing any stack traces etc. So I want to log the exception in the action and then redirect to a generic error page. I have the exception results and the exception mapping set up. I was wondering what is the best way to log this. Right now I have my Exception result directing to an action which calls my log class. The problem is a can not seem to get the exceptionStack passed into this action so I can not log all of the information. Any ideas? Thanks Rich On 8/2/07, Paul Benedict <[EMAIL PROTECTED]> wrote: > My applications do not catch any errors. I let them bubble out of the > Action and into an ExceptionHandler object for logging. You can log > whatever you want -- including the user -- in the handler. > > Paul > > Richard Sayre wrote: > > After reading the Mail Reader walk through, it would seem the best > > practice for handling exceptions is throwing them back to your Action > > and having a result mapped to handle each specific exception. > > > > Is this the best way to do this? > > > > If I use this method how can I log the stack of each exception that > > was thrown? I know there is a logging interceptor but I have not > > found any docs on how to use it. I would like to make an error log of > > everything that happens in the application. Is it possible to log > > other information with the Exception such as the current user? > > > > Thank you, > > > > Rich > > > > - > > 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: [s2.0.9] Is there a better way to do this...
I use the prepare method to populate my lists. See the Prepareable interface.I also would put this in Action B. Is there a specific reason why you are using 2 actions? On 9/6/07, Al Sutton <[EMAIL PROTECTED]> wrote: > Here's a problem I've come across a couple of times and the solution I have > feels clunky so I thought I'd throw it out to see if anyone has any better > ideas; > > I have a form which has a s:select populated from a Map of objects which > come from a database, at the moment I'm doing the following; > > 1) Action A gets the list from the database > 2) A .JSP displays the form with the s:select and submits to Action B > 3) Action B processes the form. > > This is looks neat until you look at the situation when an error occurs. > > In order to ensure that the s:select is correctly filled the error result > has to send the browser back to Action A, which is being done as a redirect. > The problem with this is that all actionMessages and actionErrors get lost > during the redirect, and thus the user can't see what was wrong. To get > around this I use the store interceptor, but this causes problems if > validation is turned on (it will bounce the user to the error result of > Action A if an errorMessage is present - see > https://issues.apache.org/struts/browse/WW-1963 for the bug report). > > So I end up with the validation interceptor turned off and having to hand > code some validation, and the store interceptor turned on for several > actions. > > So has anyone found a better way of handling the "populate list -> show list > -> handle errors" situation? > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Sanitize Text
I was wondering what the best approach would be for taking form data passed to an Action and removing 'special characters' from the data. I am having issues with users pasting text from word docs etc. We only support ISO-8859-1 as of now and there are some characters that Word will replace such as ' and " with character that are outside the 8839-1 character set. I was thinking about an interceptor that would sanitize the request parameters before they are passed to the action. Is this a good approach? Can anyone suggest a better one? It does not matter if it uses Struts or not. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action within Action result
Hi You need to use a different result type: anotherAction On 8/21/07, Sawan <[EMAIL PROTECTED]> wrote: > > Hello Experts, > > I want to call an Action within the Action result and I am trying following > Struts XML. > > > /Action2.action > > > But its not working. > > How can I fulfill this requirement..? > > I am really looking forward to get any solution as soon as possible... > > Thanks > > Sawan > -- > View this message in context: > http://www.nabble.com/Action-within-Action-result-tf4303336.html#a12249191 > Sent from the Struts - User mailing list archive at Nabble.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: Tabbed Panel and Ajax
That worked perfect, thanks. On 8/17/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > you can specify a form to be sumitted when the div refreshes, using formId. > > musachy > > On 8/17/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > > I have my div refreshing when an 'editQuestion' topic is published. > > > > > > > > > > > > > href="%{loadQuestionDetails}" listenTopics="/editQuestion"> > > > > > > > > > > As you can see I have the parameter questionId hard coded. When ever > > the div reloads itself I would like to be able to change the > > questionId parameter. Id there an example in the showcase that does > > this? I have a javascript function called editQuestion(id) that > > publishes the topic. I know the URL is generated on the server side > > so I cant change it's parameter. Is there another way? > > > > Thank you > > > > > > > > On 8/17/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > > > If all you want to do is reload the div content, you can set it's href > > > to the url that returns the html, set it's listeninTopics to a topic > > > that you can publish, and the div will reload its content > > > automagically. (check showcase and documentation for examples) > > > > > > musachy > > > > > > On 8/16/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > > > > I seem to have it working now. There was a form wrapped around the > > > > tabbed panel. My Ajax function was setting the inner html of this > > > > form, effectively wiping out the rest of the tab contents. Now I am > > > > wondering if listening to the topics is nessessary? In fact how does > > > > it work? In my function I just set the innerHTML of the UDF tab and > > > > it works normally. I am new to Dojo and the only place I have seen > > > > the suscribe/publish was in a Struts example. > > > > > > > > How do I automatically return the inner html to the div? Is that what > > > > listening to the topics is suppose to do? Maybe I am misunderstanding > > > > its purpose. > > > > > > > > Here is the topic the gets published: > > > > > > > > dojo.event.topic.subscribe("/editUdfs", function() { > > > > > > > > > > > > var kw = { > > > >url:'', > > > >load:function(type, data, evt) { > > > > > > > >dojo.byId("udfAjaxDiv").innerHTML = data; > > > >}, > > > >method: "POST", > > > >formNode: dojo.byId("questionForm"), > > > >error: function(type, data, evt){ > > > > > > > > dojo.byId("udfAjaxDiv").innerHTML = data + > > > > "::"+data.value; > > > > > > > >} > > > > > > > >}; > > > > > > > >dojo.io.bind(kw); > > > > > > > > > > > >}); > > > > > > > > On 8/16/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > > > > > so you are saying that the tabs work fine before clicking on the link, > > > > > but they don't work after that? What are you doing in editUdf()? Is > > > > > there any error when you set debug="true" on head? (or any javascript > > > > > error in general?) > > > > > > > > > > musachy > > > > > > > > > > On 8/16/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > > > > > > I have a tabbed panel set up as follows > > > > > > > > > > > > > > > > > cssClass="questionTabPanelDesign"> > > > > > > > > > > > > > > > > > > Static Content... > > > > > > > > > > > > > > > > > > > > > > > listenTopics="/editUdfs"> > > >
Re: Tabbed Panel and Ajax
I have my div refreshing when an 'editQuestion' topic is published. As you can see I have the parameter questionId hard coded. When ever the div reloads itself I would like to be able to change the questionId parameter. Id there an example in the showcase that does this? I have a javascript function called editQuestion(id) that publishes the topic. I know the URL is generated on the server side so I cant change it's parameter. Is there another way? Thank you On 8/17/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > If all you want to do is reload the div content, you can set it's href > to the url that returns the html, set it's listeninTopics to a topic > that you can publish, and the div will reload its content > automagically. (check showcase and documentation for examples) > > musachy > > On 8/16/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > > I seem to have it working now. There was a form wrapped around the > > tabbed panel. My Ajax function was setting the inner html of this > > form, effectively wiping out the rest of the tab contents. Now I am > > wondering if listening to the topics is nessessary? In fact how does > > it work? In my function I just set the innerHTML of the UDF tab and > > it works normally. I am new to Dojo and the only place I have seen > > the suscribe/publish was in a Struts example. > > > > How do I automatically return the inner html to the div? Is that what > > listening to the topics is suppose to do? Maybe I am misunderstanding > > its purpose. > > > > Here is the topic the gets published: > > > > dojo.event.topic.subscribe("/editUdfs", function() { > > > > > > var kw = { > >url:'', > >load:function(type, data, evt) { > > > >dojo.byId("udfAjaxDiv").innerHTML = data; > >}, > >method: "POST", > >formNode: dojo.byId("questionForm"), > >error: function(type, data, evt){ > > > > dojo.byId("udfAjaxDiv").innerHTML = data + "::"+data.value; > > > >} > > > >}; > > > >dojo.io.bind(kw); > > > > > >}); > > > > On 8/16/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > > > so you are saying that the tabs work fine before clicking on the link, > > > but they don't work after that? What are you doing in editUdf()? Is > > > there any error when you set debug="true" on head? (or any javascript > > > error in general?) > > > > > > musachy > > > > > > On 8/16/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > > > > I have a tabbed panel set up as follows > > > > > > > > > > > cssClass="questionTabPanelDesign"> > > > > > > > > > > > > Static Content... > > > > > > > > > > > > > > > > Static link Edit UDF > > > > > > > > > > > > > > > > Static content > > > > > > > > > > > > > > > > > > > > When I click the link in the UDF tab, the /editUdfs gets published > > > > and the edit gui displays in the tab, the problem is if I click on > > > > another tab after this happens, the contents of that tab does not > > > > display and the UDF gui still shows. > > > > > > > > Do I have anything set up wrong? > > > > > > > > I have the tab panel inside a Split Container that calls the tabs from > > > > ajax (loadDetails) Im not sure if that makes any difference. Here is > > > > a code sample: > > > > > > > > > > > > > > > > > > > sizerWidth="3" style="width:100%;height:550px;"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
Re: Tabbed Panel and Ajax
I seem to have it working now. There was a form wrapped around the tabbed panel. My Ajax function was setting the inner html of this form, effectively wiping out the rest of the tab contents. Now I am wondering if listening to the topics is nessessary? In fact how does it work? In my function I just set the innerHTML of the UDF tab and it works normally. I am new to Dojo and the only place I have seen the suscribe/publish was in a Struts example. How do I automatically return the inner html to the div? Is that what listening to the topics is suppose to do? Maybe I am misunderstanding its purpose. Here is the topic the gets published: dojo.event.topic.subscribe("/editUdfs", function() { var kw = { url:'', load:function(type, data, evt) { dojo.byId("udfAjaxDiv").innerHTML = data; }, method: "POST", formNode: dojo.byId("questionForm"), error: function(type, data, evt){ dojo.byId("udfAjaxDiv").innerHTML = data + "::"+data.value; } }; dojo.io.bind(kw); }); On 8/16/07, Musachy Barroso <[EMAIL PROTECTED]> wrote: > so you are saying that the tabs work fine before clicking on the link, > but they don't work after that? What are you doing in editUdf()? Is > there any error when you set debug="true" on head? (or any javascript > error in general?) > > musachy > > On 8/16/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > > I have a tabbed panel set up as follows > > > > > cssClass="questionTabPanelDesign"> > > > > > > Static Content... > > > > > > > > Static link Edit UDF > > > > > > > > Static content > > > > > > > > > > When I click the link in the UDF tab, the /editUdfs gets published > > and the edit gui displays in the tab, the problem is if I click on > > another tab after this happens, the contents of that tab does not > > display and the UDF gui still shows. > > > > Do I have anything set up wrong? > > > > I have the tab panel inside a Split Container that calls the tabs from > > ajax (loadDetails) Im not sure if that makes any difference. Here is > > a code sample: > > > > > > > > > sizerWidth="3" style="width:100%;height:550px;"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Any suggestions would be great. > > > > Thank you, > > > > Rich > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > "Hey you! Would you help me to carry the stone?" Pink Floyd > > - > 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]
Tabbed Panel and Ajax
I have a tabbed panel set up as follows Static Content... Static link Edit UDF Static content When I click the link in the UDF tab, the /editUdfs gets published and the edit gui displays in the tab, the problem is if I click on another tab after this happens, the contents of that tab does not display and the UDF gui still shows. Do I have anything set up wrong? I have the tab panel inside a Split Container that calls the tabs from ajax (loadDetails) Im not sure if that makes any difference. Here is a code sample: Any suggestions would be great. Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
XSLT Result matching pattern
I am new to regular expressions and I am trying to have my XSLT result only show certain elements that are in the XML. here is some if the XML: ... ... ... I only want the result/questionTree node to be return to my page. I tried doing this: /result/questionTree But all the XML is still returned. Am I using that parameter properly? Does it filter what XML is returned? If so is my pattern wrong? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LookandFeel
I asked this same question and got this answer: There are several threads on this topic. You need to set the "templateCssPath" to the url of the css file. You will have to take a look at the current css to know what you have to overwrite: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/core/src/main/resources/org/apache/struts2/static/dojo/src/widget/templates/TabContainer.css?view=markup On 8/7/07, Manuel Correa <[EMAIL PROTECTED]> wrote: > I need to change the lookandfeel of the tabbedpane component, I found > the image that load is: > > > > /struts/dojo/src/widget/templates/images/tab_top_right.gif > > > > But, I want to know how make my own lookandfeel using this gadget. > > > > Manuel Correa. > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Defining a validate() method
I forgot to add that you can also use annotations or XML validation for simple validations. If you set the validate=true on your s:form and you are using the XML validators, it will generate the client side javascript nessessary to do the validations. After the form submits it will do those validation again on the server side and if you have any additional validation to do that is not covered by a validator you can add the validation cod to your action. I have tried to write my own validator recently but I got stuck and because of a time constraint I did my validations in my action with addFieldError. I would like to see more information on writing validators and how a include the javascript to generate for that validator On 8/6/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > addFieldError("fieldName","message"); will add a specific field > error. If you are using the XHTML theme, the error will appear above > the field. > > This should set and clear the validation message for you. If you are > using the simple theme you have to add the s:fielderror tag. > > > On 8/6/07, Session A Mwamufiya <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I want to set up my own validate method to validate fields in my own way, > > but I'm not sure how to set up the method. I don't know how to set or > > clear the validation error message. Is it ok just to use the action's > > error stack, like this: > > > > public void validate() { > > if (listOfExistingElement.contains(field1)) { > > addActionError("This element already exists"); > > } > > } > > > > Is there a better way to make use of the framework, or is this it? I > > searched for examples online but couldn't find any. > > > > Thanks for the push, > > Session > > > > > > - > > 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: Defining a validate() method
addFieldError("fieldName","message"); will add a specific field error. If you are using the XHTML theme, the error will appear above the field. This should set and clear the validation message for you. If you are using the simple theme you have to add the s:fielderror tag. On 8/6/07, Session A Mwamufiya <[EMAIL PROTECTED]> wrote: > Hi, > > I want to set up my own validate method to validate fields in my own way, but > I'm not sure how to set up the method. I don't know how to set or clear the > validation error message. Is it ok just to use the action's error stack, > like this: > > public void validate() { > if (listOfExistingElement.contains(field1)) { > addActionError("This element already exists"); > } > } > > Is there a better way to make use of the framework, or is this it? I > searched for examples online but couldn't find any. > > Thanks for the push, > Session > > > - > 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: Custom user roles and Action
An interceptor is exactly like a filter. I runs before and after an action executes. Check out the following: http://struts.apache.org/2.x/docs/interceptors.html http://struts.apache.org/2.x/docs/writing-interceptors.html Also the 'FAQ" section at the bottom of the first like has some useful information. Here is my intercrept method from the SystemAdmin check: public String intercept(ActionInvocation actionInvocation) throws Exception { //get my user object form the session Map session = ActionContext.getContext().getSession(); User user = (User)session.get(Constants.USER_SESSION_KEY); boolean allowAccess = (null != user) && (user.getSystemAdmin()); if(allowAccess) { return actionInvocation.invoke(); } else { return BaseAction.NO_ACCESS; } } Next I had to add the interceptor to my SysAdmin package: and change the default stack: Now every action in that package will call my access checker before it executes. If the check fails then the NO_ACCESS constant is returned (which is a constant in my BaseAction class whcih equals "noAccess"). Now that I think about it, Im not sure if I should have put that constant in that class..anyway... I defined a global result to handle the noAccess result: Home / This result returns the user to the Home screen. In my case the user should never see the link that takes them to restricted parts of the page. I wrote this in case a curious user started typing in URL's. I don't give them an error I just kick them back to the main page. On 8/6/07, Jim Theodoridis <[EMAIL PROTECTED]> wrote: > I wrote a "LoadApplication" action that executes after my user has > > logged in. It checks the database to see what roes they have and it > fills the session with a few variables such as... > > I am thinkng to do the same with filter is it possible? > I am using DispatchAction alot is it possible to allow a function action > like list and to deny create > > tnx but i have never work with interceptor > > Richard Sayre wrote: > > I wrote a "LoadApplication" action that executes after my user has > > logged in. It checks the database to see what roes they have and it > > fills the session with a few variables such as > > > > admin = true; > > designer = false; etc. > > > > > > by default they are all false. > > > > Then I wrote an interceptor that checked their access from the > > session. If they have access the Action they are requesting would > > execute. If they did not have access I would redirect them to the > > main page. You could also have the interceptor check the Database > > directly. I am not a security expert, but this should be more secure > > than storing those values in session. There will be more overhead in > > checking the database before every action. > > > > On 8/6/07, Jim Theodoridis <[EMAIL PROTECTED]> wrote: > > > >> Hello > >> > >> I am using my own security manager to login to a struts application. > >> I am looking for a way to fires an action only when a user logs in > >> have the rights permissions > >> > >> Any suggestions? > >> > >> > >> - > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom user roles and Action
I wrote a "LoadApplication" action that executes after my user has logged in. It checks the database to see what roes they have and it fills the session with a few variables such as admin = true; designer = false; etc. by default they are all false. Then I wrote an interceptor that checked their access from the session. If they have access the Action they are requesting would execute. If they did not have access I would redirect them to the main page. You could also have the interceptor check the Database directly. I am not a security expert, but this should be more secure than storing those values in session. There will be more overhead in checking the database before every action. On 8/6/07, Jim Theodoridis <[EMAIL PROTECTED]> wrote: > Hello > > I am using my own security manager to login to a struts application. > I am looking for a way to fires an action only when a user logs in > have the rights permissions > > Any suggestions? > > > - > 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: Exception Handling and Logging
In my interceptor stack i added this parameter: true I assume it is using either commons logging or log4j but I'm not sure where the log file is or how to manipulate what information goes into the log file. On 8/6/07, Dave Newton <[EMAIL PROTECTED]> wrote: > --- Richard Sayre <[EMAIL PROTECTED]> wrote: > > Do I open a file stream on the JSP page or is there > a > > better way to log this information? > > Use commons-logging and / or Log4J? > > d. > > > > > > Need a vacation? Get great deals > to amazing places on Yahoo! Travel. > http://travel.yahoo.com/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exception Handling and Logging
I set up my application to throw the Exceptions back and I am using Exception mapping to redirect the user to an error page. The error page displays the exception and stack trace. How do I log this to a file instead? Do I open a file stream on the JSP page or is there a better way to log this information? On 8/2/07, Paul Benedict <[EMAIL PROTECTED]> wrote: > My applications do not catch any errors. I let them bubble out of the > Action and into an ExceptionHandler object for logging. You can log > whatever you want -- including the user -- in the handler. > > Paul > > Richard Sayre wrote: > > After reading the Mail Reader walk through, it would seem the best > > practice for handling exceptions is throwing them back to your Action > > and having a result mapped to handle each specific exception. > > > > Is this the best way to do this? > > > > If I use this method how can I log the stack of each exception that > > was thrown? I know there is a logging interceptor but I have not > > found any docs on how to use it. I would like to make an error log of > > everything that happens in the application. Is it possible to log > > other information with the Exception such as the current user? > > > > Thank you, > > > > Rich > > > > - > > 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]
stopping the result it is called form
The following jsp is a Result in an action called 'listTypes'. <%@ include file="/includes/header.jsp"%> <%@ include file="/includes/footer.jsp"%> getTypeParamTree result is xslt and is configured as follows: /xsl/TypeListParam.xsl When the listTypes JSP called the getTypeParamTree it stopps the result from finishing. The XSL transform occurs then it stopps so the line <%@ include file="/includes/footer.jsp"%> does not get executed. Is there a way to get around this? Thank you , Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: display validation error to simple theme
Use the tag On 8/2/07, Pedro Herrera <[EMAIL PROTECTED]> wrote: > > Hi, >How I show the erros(validation) when using simple theme ? > > Herrera > > -- > View this message in context: > http://www.nabble.com/display-validation-error-to-simple-theme-tf4208443.html#a11971725 > Sent from the Struts - User mailing list archive at Nabble.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]
s:tree help
Is it possible to add a checkbox to each node of the Tree? Is it possible to add a different icon for each node of the tree? Perhaps something similar to the Display Tag table decorator? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Number Validator
I am using Struts 2 wich uses the com.opensymphony.xwork2.validator.validators. It does not seem to have a validator to test to see if a a value can be converted to an integer. Is there a way to write my own validator to do this work? On 7/31/07, Jorge Martín Cuervo <[EMAIL PROTECTED]> wrote: > Hi > > which version of commons validator are you using? > > http://struts.apache.org/1.2.9/userGuide/dev_validator.html > > i so, you can see: > > integer - validates that a field can be converted to an Integer. > > > > > > intRange - validates that an integer field is within a specified range. > Requires min and max variables to specify the range. This validator depends > on the integer validator which must also be in the field's depends attribute. > > > > > > min18 > max65 > > > > integer checks if the field value can be converted into an integer, i didn't > check the code but i supose something like that: > > Integer.parseInt(...) > > maybe you are using intRange instead > > > El lun, 30-07-2007 a las 14:30 -0330, Richard Sayre escribió: > > Is there a way to use the XML validation to check to see if a field is > > a number? I used integer to check for min and max but if I enter any > > text into the field it passes the validation. > > > > Thanks, > > > > Rich > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- > > Jorge Martin Cuervo > > Outsourcing Emarketplace > deFacto Powered by Standards > > email <[EMAIL PROTECTED]> > voice +34 985 129 820 > voice +34 660 026 384 > > > > DE FACTO STANDARDS, S.L., le informa que su dirección de correo > electrónico, así como el resto de los datos de carácter personal que > nos facilite, serán objeto de tratamiento automatizado en nuestros > ficheros, con la finalidad del envío de información comercial y/o > personal por vía electrónica. Vd. podrá en cualquier momento ejercer el > derecho de acceso, rectificación, cancelación y oposición en los > términos establecidos en la Ley Orgánica de Protección de Datos de > Carácter Personal (LOPD. 15/1999), dirigiendo un escrito a C/ > Gutiérrez Herrero (Centro De Empresas 'La Curtidora'), 52 - oficina 207 > - 33402 AVILES (Asturias), o a nuestra dirección de correo electrónico > ([EMAIL PROTECTED]). También informamos que la información incluida en > este e-mail es CONFIDENCIAL, siendo para uso exclusivo del destinatario > arriba mencionado. Si Usted lee este mensaje y no es el destinatario > indicado, le informamos que está totalmente prohibida cualquier > utilización, divulgación, distribución y/o reproducción de esta > comunicación sin autorización expresa en virtud de la legislación > vigente. Si ha recibido este mensaje por error, le rogamos nos lo > notifique inmediatamente por esta misma vía y proceda a su eliminación. > > This e-mail contains information that will be added to our computerised > guest data base and will be trated in the strict confidence. If you > wish to access, correct, oppose or cancel your details, as specified > the Law 15/99, December 13th, please send a certified letter to this > effect to DE FACTO STANDARDS, S.L.., (C/ Gutiérrez Herrero (Centro De > Empresas 'La Curtidora'), 52 - oficina 207 33402 AVILES (Asturias) > SPAIN). If you read this message, and is not the destinatary, we > informal you that is forbidden anything utility, distribution, > divulgation or reproduction of this communication without express > authorization, of the present law. If you received this message for > mistake, we proud in order to the present law, immediate communication > to us, and please erase this e-mail > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Number Validator
Is there a way to use the XML validation to check to see if a field is a number? I used integer to check for min and max but if I enter any text into the field it passes the validation. Thanks, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Exception Handling and Logging
After reading the Mail Reader walk through, it would seem the best practice for handling exceptions is throwing them back to your Action and having a result mapped to handle each specific exception. Is this the best way to do this? If I use this method how can I log the stack of each exception that was thrown? I know there is a logging interceptor but I have not found any docs on how to use it. I would like to make an error log of everything that happens in the application. Is it possible to log other information with the Exception such as the current user? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Submitting a variable amount of form data
I have a form that can have 1 to many 'Name' text fields. In struts 2 how do I set up the action so it can automatically grab the values that are in those fields? If I had 1 name field I would just put a name variable in the Action Class and create a setter and getter for it. How do I do this with multiple names? Thanks, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to format the actionerrors and actionmessages in the jsp page?
For clarification the following line: <#include "/${parameters.templateDir}/xhtml/validationarea.ftl" /> was added to the first line of form.ftl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to format the actionerrors and actionmessages in the jsp page?
Hi, I had the same problem. I did not like the way the error were being displayed (In a new row above the field that has the error) To do this I have to chenge the XHTML template First I removed the validation from the controlheader-core <#-- REMOVED We have our own Error area <#if hasFieldErrors> <#list fieldErrors[parameters.name] as error> <#if parameters.labelposition?default("") == 'top'> <#rt/> <#else> <#rt/> ${error?html}<#t/> <#lt/> --> I added this to the form.ftl <#include "/${parameters.templateDir}/xhtml/validationarea.ftl" /> In that file I wrote the following code: It output all of the error into a single div. 'Holder Div' is used so the client side validations will work too. <#assign hasErrors = fieldErrors?exists/> <#if hasErrors> <#if (fieldErrors?size > 0) > <#assign keys = fieldErrors?keys> <#list keys as key> <#list fieldErrors[key] as errorMessage> ${errorMessage?html} Next I had to change the validation.js file to use my div to display the errors: function addError(e, errorText) { try { var errorDiv; var error = document.createTextNode(errorText); var br = document.createElement("br"); //Create the errorDiv it it does not already exist if(!document.getElementById("errorDiv")) { errorDiv = document.createElement("div"); errorDiv.setAttribute("id", "errorDiv"); errorDiv.setAttribute("class", "errorMessage"); errorDiv.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute } else { errorDiv = document.getElementById("errorDiv"); } errorDiv.appendChild(error); errorDiv.appendChild(br); //Make sure all error moessage are display before showing the div if(!document.getElementById("errorDiv")) { document.getElementById("holderDiv").appendChild(errorDiv); } } catch (e) { alert(e); } } function clearErrorMessages(form) { var errorDiv; var errorDivChildren; if(document.getElementById("errorDiv")) { errorDiv = document.getElementById("errorDiv"); document.getElementById("holderDiv").removeChild(errorDiv); } } I commented out all of the logic in clearErrorLabels() since it does not apply to what I am doing. I think thats about everything. There might be one or 2 places you have to change some code in the template. The big thing here is you have to change the XHTML template. I'm not sure if the simple template has error handling, it might be easier to change. Rich On 7/27/07, M.Liang Liu <[EMAIL PROTECTED]> wrote: > Hi,all: > I would like to add header and footer to the actionerrors so as to it can > display in the way my client like. > In Struts1.2,i can just put the following code in the properties file: > > errors.header= > errors.prefix= > errors.suffix= > errors.footer= > > and it could work as I excepted. > Now i am trying to use struts2,but it can NOT work in the same way. > > Any help? > > > btw,I have put the code in the globalMessages.properties and put the file in > the classpath,as well as defined the struts.xml as: > > > Thanks for reading and looking forward to any reply. > > -- > --M.Liang Liu > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Multiple Submits with different actions in a Form
I'm not sure if this is what your are looking for, it is doing the control logic on the client side. Instead of using s:submit to submit the form you could make 3 input buttons: and the write the following javascript: function doAction1() { document.getElementById("formId").action = '; document.getElementById("formId").submit(); } function doAction2() { document.getElementById("formId").action = '; document.getElementById("formId").submit(); } function doAction3() { document.getElementById("formId").action = '; document.getElementById("formId").submit(); } then in your struts.xml: . . . . . . . . . You don't have to use the Ajax theme on your form, you can write the Javascript using the DOJO library your self. All the nessary files are included when you use the s:head tag On 7/25/07, Grish <[EMAIL PROTECTED]> wrote: I'm still in the process of learning S2 and I was curious on what's the best practice in implementing a form with multiple submit buttons I've read that there are multiple way to implement this. One way is here: http://struts.apache.org/2.0.8/docs/multiple-submit-buttons.html Although I was thinking I had to redo my setup of my action class and have all the actions point to one method - execute() and from there i would check a parameter to determine what my next step would be: public String execute() { if (method.equals(searchMethod)) { doSearch(); return SUCCESS; } if (method.equals(addMethod)) { doAdd(); return SUCCESS; } } something to that effect. But I also wanted to try having an action class with different methods and in my struts.xml the different actions would point to the different methods of my action class. My problem though is I have a form with multiple submit buttons. I tried specifying the action on each submit button but the action in my form overrides the action specified in the buttons. I tried removing the action parameter in my form but it would take the current action and still override the actions specified in the buttons. How do I have a form with multiple submit buttons with different actions? What would be the best practice in implementing this? Would implementation be any different if my submit buttons are ajax themed? Thanks -- View this message in context: http://www.nabble.com/-S2--Multiple-Submits-with-different-actions-in-a-Form-tf4140299.html#a11776889 Sent from the Struts - User mailing list archive at Nabble.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]
Tree Tag
I am using the tre tag to display a tree of items. I got a very basic tree showing. Is it possible to have the tree node do something when you click it? I tried onclick but it didnt seem to render that attribute into the HTML. Is it possible to add some extra html to each node (for example a check box)? Thank you, Rich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Change the Tabbed Panel look
How do you change the look of the tabbed panel? I assume you have to override some css or something similar but I can not find any information on it. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]