Struts 2.1.6 - Alternative Template Engines - JSP
Hi, I'm using Struts 2.1.6. I'm developing custom Struts 2.1.6 tags. I want to use org.apache.struts2.components.template.JspTemplateEngine. The framework supports three template engines, which can be controlled by the struts.ui.templateSuffix in struts.properties. If I set the above, does all the struts2 tags and the custom tags I'm developing will use the JSPTemplateEngine? I want to use JSPTemplateEngine only for some custom tags I'm developing and I will use FreemarkerTemplateEngine for some other custom tags. Is this possible? Thank you. Regards, Kishan.G - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
radio with two values
good moorning. I've this question: Can I send to an action two vakues using radion button? for example i want send the code and the name for each element of radio buttons. Is it possible? -- View this message in context: http://www.nabble.com/radio-with-two-values-tp23272838p23272838.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
RE: How to turn the struts textfield label from default italic to normal (struts 2.1.6)
Silly me. After I added “.label {font-style:normal; }” to my css file, no more italic present in the input form. Thank you again Dave. -Original Message- From: Qunhuan Mei [mailto:q...@qm18.wanadoo.co.uk] Sent: Monday, April 27, 2009 12:59 PM To: 'Struts Users Mailing List' Subject: RE: How to turn the struts textfield label from default italic to normal (struts 2.1.6) Dave, Thank you so much for your reply. It is a big relief when hope is shown for solving the problem. Could you confirm that by your stylesheet overriding approach do you mean to write some css code for the below tdLabel (or label, if applicable) class? Qunhuan ~~~ BTW, found a similar problem reporting link: http://markmail.org/message/hl6mic6scgxaj5lz#query:struts%20cssStyle%20cssCl ass%20green+page:1+mid:nm6ws7bq2wmbmnl3+state:results -Original Message- From: Dave Newton [mailto:newton.d...@yahoo.com] Sent: Monday, April 27, 2009 12:41 PM To: Struts Users Mailing List Subject: Re: How to turn the struts textfield label from default italic to normal (struts 2.1.6) While I haven't noticed this behavior, you can override the S2 stylesheet by including your own stylesheet with overriding definitions after the S2 head tag. Dave Qunhuan Mei wrote: Hi, I have a form which uses struts tag “textfield” and “text”. The default font style for label generated for textfield appears to be italic while the one for text is normal. e.g. for s:textfield key=username name=userAccount.username required=true / The html code generated by struts are (seen by the browser’s view source.): tr td class=tdLabellabel for=form_userAccount_username class=labelUsernamespan class=required*/span:/label/td tdinput type=text name=userAccount.username value= id=form_userAccount_username//td /tr The label name “Username” is displayed in Italic (I suppose this is controlled by either the tdLabel or label class). I want to change Username’s font style to normal (non-italic) and so have tried cssStyle and cssClass for the textfield but it seems they are only applied to the input field element rather than the label one. I have searched the internet but no luck in finding an answer. It would be much appreciated if anyone could help. Many thanks in advance, Qunhuan - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: radio with two values
i think u can use a trick u can set the value in this way: CODE_NAME. and map as a string in your action u can simply extract where is the _ char and split the string. NB: the code and name doesn't have _ inside On Tue, Apr 28, 2009 at 10:45, PEGASUS84 pegasu...@hotmail.it wrote: good moorning. I've this question: Can I send to an action two vakues using radion button? for example i want send the code and the name for each element of radio buttons. Is it possible? -- View this message in context: http://www.nabble.com/radio-with-two-values-tp23272838p23272838.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 -- Stefano
Re: struts 2 and tomcat 6 problem
Check 2 things: - is the jars inside WEB-INF/lib in the dist jar of the application? - is the only one jar for each library (maybe have one in web-inf and one in the root). i've a similar problem with netbeans and jboss (netbeans put all the jar in the root and nothing in web-inf) so i forced to put all the libraries in the web-inf and removing by a bat the jars from the root of the project. On Sun, Apr 26, 2009 at 16:37, Kortheo kort...@kwanta.net wrote: Niklas Johansson schrieb: Hello, I am kind of novice on this, but couldn't it be that you have the same class twice in the classpath? Regards, Niklas Date: Sun, 26 Apr 2009 13:06:32 +0200 Subject: Re: struts 2 and tomcat 6 problem From: lukasz.len...@googlemail.com To: user@struts.apache.org 2009/4/26 Kortheo : I've just created a new standard dynamic web project using eclipse , added the struts2 libs and configured a standard mapping in web.xml Did you add all needed dependency? Unable to load configuration. - bean - jar:file:/Users/kortheo/Projekte/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/kptool/WEB-INF/lib/struts2-convention-plugin-2.1.6.jar!/struts-plugin.xml:30:119 Caused by: Bean type interface com.opensymphony.xwork2.UnknownHandler with the name default has already been loaded by bean - jar:file:/Users/kortheo/Projekte/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/kptool/WEB-INF/lib/struts2-codebehind-plugin-2.1.6.jar!/struts-plugin.xml:29:122 You are mixing Convention with CodeBehind plugin, you have to chose either first or second approach. Convention overtook CodeBehind so follow this way and read documentation [1] [1] http://cwiki.apache.org/WW/convention-plugin.html Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org no thats not it, it's that the same class gets loaded twice, because as Lukasz said (thx again by the way) , I used the codebehind plugin and the conventions plugin. They both load the class. So, I tried to just remove codebehind. The error is gone now, but I got a new one. I'm tryin to solve this issue now, if I can't seem to move foreward I'll write again Thanks alot, everyone - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Stefano
Re: radio with two values
ok but i try to use an hidden tag but it set all values of name because it is into an iterator tag -- View this message in context: http://www.nabble.com/radio-with-two-values-tp23272838p23274112.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
Re: Autowired and PostConstruct with Struts + Spring
Wow. I really shouldn't try to help people when I am on a diet. My brain does not work. Get rid of the @PostExecute and change that method to execute. You should be able to set a break-point within your execute method and see that myService has been initialized. My struts action contains : @Autowired private MyService myService public String execute() { // use here myService } Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Shelton Consulting, LLC ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton From: Norris Shelton norrisshel...@yahoo.com To: Struts Users Mailing List user@struts.apache.org; e_sli...@yahoo.it Sent: Monday, April 27, 2009 4:09:27 PM Subject: Re: Autowired and PostConstruct with Struts + Spring I have a question. Why are you using PostConstruct anyway? AFAIK, a new action is created for each request. This is not going to work like a servlet where it is created, you perform some initialization. I think the problem is caused by the mixing of APIs. My guess is that whatever you are trying to do in the @PostConstruct annotated method should be in your annotate. Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Shelton Consulting, LLC ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton From: e_sli...@yahoo.it e_sli...@yahoo.it To: user@struts.apache.org Sent: Monday, April 27, 2009 3:29:38 PM Subject: Re: Autowired and PostConstruct with Struts + Spring Hi Norris and Dave! Thank you for your answers. Yes, I have get/set methods for myService. If you means declaring: constant name=struts.objectFactory value=spring / in my struts.xml for my object factory, yes. I don't have @Component for Spring injection, but I suppose Spring work well as far as the myService bean is available in my context for other beans in my app. I'm just wondering about @Autowired and @PostConstruct behaviour when passing by Struts + Spring. Probably @PostConstruct is executed just before the @Autowired? Using pure Spring without Struts works well: running a JUnit test with my @PostConstruct annotated method show myService is not null, but when this is in a Struts action does not work... Has anybody see this behaviour? Thank you for your help! Emanuele Norris Shelton wrote: Did you set Spring to be your object factory in your struts.xml. If you used Spring annotations, did you annotate your bean to be injected with @Component and designate a base package for Spring to scan for beans? Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Shelton Consulting, LLC ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton Is there a public myService setter? (I hardly even use annotations; maybe that's not necessary?) Dave From: e_sli...@yahoo.it e_sli...@yahoo.it To: user@struts.apache.org Sent: Monday, April 27, 2009 12:41:01 PM Subject: Autowired and PostConstruct with Struts + Spring Hello everybody! I'm trying to use my service into a Struts action but with no success. My struts action contains : @Autowired private MyService myService @PostConstruct public void init() { // use here myService } Unfortunately myService is always null and I cannot use myService in the init() method... The bean myService should correctly declared in my application-context.xml: bean id=myService class=com.mypackage.MyServiceImpl property name=... ref=... / ... /bean and my struts.xml contains: constant name=struts.objectFactory value=spring / Where I'm wrong? Many Thanks! Emanuele
Re: Struts and encoding ISO-8859-1
You shouldn't technically need Struts 2.1.7 to be able to use UTF-8. If you want to stick with 2.1.6, there are two options: either you use useBodyEncodingForURI=true in Tomcat's server.xml, or you explicitly set URIEncoding=UTF-8 in the connector. I'd advise you to use useBodyEncodingForURI, as this will still allow other webapps in the same Tomcat container to use their own, possibly different encodings. Because of the filter bug in Struts 2.1.6 though, you'll have to make the call to setCharacterEncoding yourself before the Struts filter kicks in. This is exactly what the filter you wrote in your original post does; you just have to make sure that it comes before the Struts 2 filter in your web.xml descriptor. Furthermore, you'll need to make sure that all your pages are sent as UTF-8. This is done in the same way I outlined earlier, ie. by setting the charset in your Content-type header. For JSPs this is done using the lt;%@ page contentType=text/html; charset=UTF-8 %gt; directive in your JSPs (I hope it won't garble the brackets now). You can easily verify the page encoding in Firefox by right-clicking anywhere on the page and selecting View Page Info. You're interested in the Encoding: line, not the stuff in the Meta box. Also, you'll want Hibernate to connect to your database using a UTF-8 connection. You can do this by setting the properties hibernate.connection.useUnicode=true and hibernate.connection.characterEncoding=UTF-8. That should be about it. If you can't get it working and/or you'd like to try with a Struts 2.1.7, I can upload a snapshot build for you somewhere so you can try it out. Cheers, Jeroen Hello, I did download Struts2 trunk and current but count't build any without BUILD FAILED. Will this be a problem (sorry for being a bit lazy, don't want to switch to 2.1.7 if it doesn't work...)? If I go back to UTF-8, do I need to upgrade to Struts 2.1.7 in order to get åäö working? Do you have any prescription for getting it to work with UTF-8, or is it the same as you already explained below?. I am not paranoid aout saving a few bytes :) Thanks again! Regards, Niklas Date: Sun, 26 Apr 2009 23:36:13 +0200 From: voetsjo...@gmail.com To: user@struts.apache.org Subject: Re: Struts and encoding ISO-8859-1 Well, ISO-8859-1 and UTF-8 differ in the fact that ISO-8859-1 is a single-byte encoding and can only encode 256 characters (albeit carefully chosen), while UTF-8 is a multi-byte encoding and can represent any character in the Unicode codespace (ie. any character you can think of). Both will use a single byte for code points 0-127; once you go past that, UTF-8 will start using two bytes, but ISO-8859-1 will run out after 256 characters. So unless you're absolutely paranoid about saving a few bytes of network traffic, UTF-8 is the way to go. If you're encoding text in the Latin-1 range, most of your characters are likely to be regular ASCII characters anyway (as well as all the HTML markup the user doesn't get to see). That, and you'll get the additional benefit of being able to handle anything your users throw at you which is, needless to say, a big plus on the interwebs. Hello, Thank you for you quick reply. Sorry if I was a bit unclear: I am posting via a form, in a JSP page, some information that at a later stage is stored in my DB. When I use åäöÅÄÖ it is messed up to ??-signs when extracting it on the server side before trying to save it in the db. I didn't try to use ISO-8859-1 at first, but when UTF-8 didn't work I changed. I assume that why it didn't work was because of the bug and the configurations you mentioned below (server.xml config). I'll try tomorrow. What is the purpose of using ISO-8859-1 when it seems like UTF-8 works for all languages then? Or am I mistaken there? I have myself in the past (way back) used Big5 and Gb1251 (think it was) coding Chinese applications using Java. Don't know what happened to my e-mail I sent out, it's totally corrupted I can see now, a lot of information is missing (at least in my web-client...). But I think your answer helps me so I skip completing that missing information now. Thanks again! Regards, Niklas Date: Sun, 26 Apr 2009 21:52:23 +0200 From: voetsjo...@gmail.com To: user@struts.apache.org Subject: Re: Struts and encoding ISO-8859-1 What exactly is giving you trouble? Are your HTTP parameters not properly received? Does your DB data get garbled when you output it? I've recently had problems with ISO-8859-1 and Struts 2 as well, and there are some things you need to be aware of. It turns out that by default Tomcat uses ISO-8859-1 exclusively for decoding URI parameters, but only for the URI parameters. This can lead to bizarre situations such as POST request parameters getting received perfectly in UTF-8, but GET request parameters getting garbled into ISO-8859-1. Now,
bull info in a disbled submit button
Hello, i wanna display a bull info once the user put the cursor on the button here is the button declaration nested:submit disabled=true alt=%=userName.toString() %valider/nested:submit any one has an idea? Thanks Regards
Re: Struts 2.1.6 - Alternative Template Engines - JSP
The template engines just process certain types of templates(ftl, vm, jsp, etc), but are not(directly) related to tags. The tags need to output something, what you use to generate the output is up to you, the struts tags use freemarker, but the javatemplates plugin uses plain java, for example. musachy On Tue, Apr 28, 2009 at 3:06 AM, Kishan G. Chellap Paandy kishanchellapaand...@spanservices.com wrote: Hi, I'm using Struts 2.1.6. I'm developing custom Struts 2.1.6 tags. I want to use org.apache.struts2.components.template.JspTemplateEngine. The framework supports three template engines, which can be controlled by the struts.ui.templateSuffix in struts.properties. If I set the above, does all the struts2 tags and the custom tags I'm developing will use the JSPTemplateEngine? I want to use JSPTemplateEngine only for some custom tags I'm developing and I will use FreemarkerTemplateEngine for some other custom tags. Is this possible? Thank you. Regards, Kishan.G - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: bull info in a disbled submit button
elyes sallem wrote: i wanna display a bull info once the user put the cursor on the button here is the button declaration nested:submit disabled=true alt=%=userName.toString() %valider/nested:submit any one has an idea? I'm not sure what bull info is, but there are any number of JavaScript-based tooltip-type libraries available that can be used with any framework. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: bull info in a disbled submit button
it is a ToolTip Regards Elyes 2009/4/28 Dave Newton newton.d...@yahoo.com elyes sallem wrote: i wanna display a bull info once the user put the cursor on the button here is the button declaration nested:submit disabled=true alt=%=userName.toString() %valider/nested:submit any one has an idea? I'm not sure what bull info is, but there are any number of JavaScript-based tooltip-type libraries available that can be used with any framework. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Elyes.
Any hint of JQuery on struts2 tutorial, thanks!
Because our team is using struts2 to develop the web application and I'm in charge of the UI part, I have to restrict the UI to struts2. I heard that JQuery is very popular and I love it. Also, I know some people are using it in struts2. However, I couldn't find any related tutorial. Any tutorial online or shall I buy some book about this issue? Thank you very much! -- View this message in context: http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23277517.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
RE: Any hint of JQuery on struts2 tutorial, thanks!
Struts2 in Practice book from manning http://www.manning.com/wannemacher feel free to Ping wes or myself offline for any questions/comments/tutorials Thanks, Martin Gainty __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Tue, 28 Apr 2009 06:47:54 -0700 From: taizhang1...@gmail.com To: user@struts.apache.org Subject: Any hint of JQuery on struts2 tutorial, thanks! Because our team is using struts2 to develop the web application and I'm in charge of the UI part, I have to restrict the UI to struts2. I heard that JQuery is very popular and I love it. Also, I know some people are using it in struts2. However, I couldn't find any related tutorial. Any tutorial online or shall I buy some book about this issue? Thank you very much! -- View this message in context: http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23277517.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 _ Windows Live™ Hotmail®:…more than just e-mail. http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_more_042009
Re: Any hint of JQuery on struts2 tutorial, thanks!
On Tue, Apr 28, 2009 at 9:52 AM, Martin Gainty mgai...@hotmail.com wrote: Struts2 in Practice book from manning http://www.manning.com/wannemacher feel free to Ping wes or myself offline for any questions/comments/tutorials Thanks, Martin Gainty Checking in! Did I hear my name? Yeah, I have quite a bit of JQuery coverage, but it's a moving target. It is likely that we'll have a fair amount of JQuery integration within Struts by the time the book is published (coincidence?) If you join the MEAP program and read it as I go, there is at least one chapter already with a decent JQuery + Spring + JPA example. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Any hint of JQuery on struts2 tutorial, thanks!
fireapple wrote: Because our team is using struts2 to develop the web application and I'm in charge of the UI part, I have to restrict the UI to struts2. I heard that JQuery is very popular and I love it. Also, I know some people are using it in struts2. However, I couldn't find any related tutorial. Any tutorial online or shall I buy some book about this issue? See my reply on JavaRanch. There's nothing particularly special about using jQuery with S2 if you're using plain old jQuery (no custom tags, etc.) although there's a plugin in the works that will handle simple use-cases. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: result type -- redirect-action vs dispatcher.
Hi Wes, Here is the configuration in struts.xml for displaying the result , where we determine what need to be displayed once validation failed. If validation fails while calculateParoleEligibilityDate , then framwork will look for input for the defined action which is determineInputForRedirect, which determine the corresponding view which need to be display. Again the problem is redirect-action which leads to create a new request , is there any way where i can redirect/forward to an action which contains the previous request. action name=calculateParoleEligibilityDate class=us.ga.state.pap.cons.clemency.presentation.action.activity.UpdateCaseAction method=calculateParoleEligibilityDate interceptor-ref name=redirectInput/ result name=newsentence type=tileseditNewSentence/result result name=additionalsentence type=tileseditAdditionalSentence/result result name=recomputation type=tileseditRecomputation/result result name=revocation type=tileseditRevocation/result result name=revocationnewconvict type=tileseditRevocationNewConvict/result result name=casedetail type=tilesupdateCaseDetail/result result name=combine type=tileseditProcessCombine/result result name=input type=redirect-action param name=actionNamedetermineInputForRedirect/param param name=caseNumber${caseNumber}/param param name=caseEditReason${caseEditReason}/param param name=showButton${showButton}/param param name=taskId${taskId}/param /result /action action name=determineInputForRedirect class=us.ga.state.pap.cons.clemency.presentation.action.activity.UpdateCaseAction method=determineInputForRedirect result name=newsentence type=tileseditNewSentence/result result name=additionalsentence type=tileseditAdditionalSentence/result result name=recomputation type=tileseditRecomputation/result result name=revocation type=tileseditRevocation/result result name=revocationnewconvict type=tileseditRevocationNewConvict/result result name=casedetail type=tilesupdateCaseDetail/result result name=combine type=tileseditProcessCombine/result /action Thanks in advance. I hope you got my problem. Regards, Siddiq --- On Sat, 4/25/09, Wes Wannemacher w...@wantii.com wrote: From: Wes Wannemacher w...@wantii.com Subject: Re: result type -- redirect-action vs dispatcher. To: Struts Users Mailing List user@struts.apache.org Date: Saturday, April 25, 2009, 12:00 AM On Friday 24 April 2009 19:47:04 Siddiq Syed wrote: Hi all, Problem statement. : When validation happens in struts 2 it will redirect to result type Input if type=tiles JSP will display the validation message and If result type=redirect-action , validation message will not get display.. In order to display validation messages , I am using interceptor where validation messages are will be stored in session and the same will be displayed in JSP. Problem is validation messages are getting displayed but the values are getting lost in the text boxs. The reason for this is because its the brand request object because of redirect-action. Is there any way where i can forward to action , but still can able to retrive the previous request. ? I know we can use dispacther , but dispacther uses only .jsp . I could be wrong, but i think redirectAction is the only result type that ends up with a new request... I don't really understand the use case where validation fails and you want to go to input for a different action... Can you post your struts.xml section pertinent to this problem. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Any hint of JQuery on struts2 tutorial, thanks!
Hi, Wes, on the table of content of the book, I didn't find anything related to JQuery and Struts2. Since JQuery is similar with JavaScript, can we say we can use JQuery in Struts2 as soon as we can use JavaScript in Struts2? Thank you. I'm a new programmer with stupid questions,:-) Wes Wannemacher wrote: On Tue, Apr 28, 2009 at 9:52 AM, Martin Gainty mgai...@hotmail.com wrote: Struts2 in Practice book from manning http://www.manning.com/wannemacher feel free to Ping wes or myself offline for any questions/comments/tutorials Thanks, Martin Gainty Checking in! Did I hear my name? Yeah, I have quite a bit of JQuery coverage, but it's a moving target. It is likely that we'll have a fair amount of JQuery integration within Struts by the time the book is published (coincidence?) If you join the MEAP program and read it as I go, there is at least one chapter already with a decent JQuery + Spring + JPA example. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23278445.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
RE: Any hint of JQuery on struts2 tutorial, thanks!
i worked in ohio once..some hard working folks there that need some training in current technologies I like the MEAP but i am still looking for the publication preview comprehensive examples are a good idea..makes it easy to teach from Martin Gainty __ Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de déni et de confidentialité This message is confidential. If you should not be the intended receiver, then we ask politely to report. Each unauthorized forwarding or manufacturing of a copy is inadmissible. This message serves only for the exchange of information and has no legal binding effect. Due to the easy manipulation of emails we cannot take responsibility over the the contents. Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Tue, 28 Apr 2009 10:05:09 -0400 Subject: Re: Any hint of JQuery on struts2 tutorial, thanks! From: w...@wantii.com To: user@struts.apache.org On Tue, Apr 28, 2009 at 9:52 AM, Martin Gainty mgai...@hotmail.com wrote: Struts2 in Practice book from manning http://www.manning.com/wannemacher feel free to Ping wes or myself offline for any questions/comments/tutorials Thanks, Martin Gainty Checking in! Did I hear my name? Yeah, I have quite a bit of JQuery coverage, but it's a moving target. It is likely that we'll have a fair amount of JQuery integration within Struts by the time the book is published (coincidence?) If you join the MEAP program and read it as I go, there is at least one chapter already with a decent JQuery + Spring + JPA example. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_skydrive_042009
Re: Any hint of JQuery on struts2 tutorial, thanks!
On Tue, Apr 28, 2009 at 10:39 AM, fireapple taizhang1...@gmail.com wrote: Hi, Wes, on the table of content of the book, I didn't find anything related to JQuery and Struts2. Since JQuery is similar with JavaScript, can we say we can use JQuery in Struts2 as soon as we can use JavaScript in Struts2? Thank you. I'm a new programmer with stupid questions,:-) JQuery is a JavaScript framework/library, so if you are using JQuery with Struts2, then you are using JavaScript with Struts2. Depending on how new you are to programming, there may be better places to start. JQuery isn't similar to JavaScript, it is JavaScript in the same way that Struts is Java. JQuery takes many of the things that are difficult in JavaScript and makes them easier. You are still using JavaScript, but rather than writing 20 lines of code, you write just a few. Looking back through the ToC, I guess I don't make it clear that there is JQuery coverage specifically, but as I mentioned before, the examples so far are already using JQuery. It may be hard to pick things up through the examples if you are not already experienced with the other topics. The example I mentioned to earlier incorporates Struts 2 with Spring, JPA, a generic DAO setup, JSON, Struts 2 Conventions and JQuery. If you've never used JPA or Spring, there would be quite a bit thrown at you in one example. Depending on your goal, there are a few other routes you might want to take before jumping into an advanced book. If you are looking to learn more about Struts 2, my book is a follow-up to another book called Struts 2 In Action that is a very well-written introduction and reference on Struts 2 core topics. If you are already familiar with Struts 2, but want to learn more about AJAX, then start by learning a bit about JavaScript core and AJAX... Manning has another book (http://manning.com/crane/) that has been a good seller for them. My book isn't meant to be a reference only on Struts 2 and AJAX. It is meant to give examples and best practices for integration with many of the popular topics that come up on this list. Plus, it will give examples on more advanced topics that haven't come up yet, but will (OSGi?) -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
'Parameter name == null' exception
I am receiving this exception in SystemOut.log from my struts portlet. Can anyone explain this to me? [4/28/09 11:15:54:459 EDT] 005d WpRequestProc E com.ibm.portal.struts.portlet.WpRequestProcessor processException Root cause: java.lang.IllegalArgumentException: Parameter name == null at com.ibm.ws.portletcontainer.core.impl.PortletRequestImpl.getParameterValues(PortletRequestImpl.java:546) at javax.portlet.filter.PortletRequestWrapper.getParameterValues(PortletRequestWrapper.java:134) at com.ibm.wps.struts.pluto.base.WpsStrutsPortletRequestWrapper.getParameterValues(WpsStrutsPortletRequestWrapper.java:224) [4/28/09 11:15:54:480 EDT] 005d ServletWrappe E SRVE0068E: Uncaught exception thrown in one of the service methods of the servlet: /welcomeForward.jsp. Exception throw n : javax.servlet.ServletException: Exception forwarding for name welcomeDispatch: javax.servlet.ServletException: Parameter name == null at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:660) at com.ibm._jsp._welcomeForward._jspService(_welcomeForward.java:99) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87) Here is my struts-config: ?xml version=1.0 encoding=UTF-8? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config !-- Data Sources -- data-sources /data-sources !-- Form Beans -- form-beans form-bean name=manageFormBean type=com.chase.adf.myreports.forms.ManageFormBean /form-bean form-bean name=viewFormBean type=com.chase.adf.myreports.forms.ViewFormBean /form-bean /form-beans !-- Global Exceptions -- global-exceptions /global-exceptions !-- Global Forwards -- global-forwards forward name=welcomeDispatch path=/welcomeDispatch.do / forward name=reports path=/reports.jsp / /global-forwards !-- Action Mappings -- action-mappings action path=/getReportsView type=com.chase.adf.myreports.actions.GetReportsViewAction name=viewFormBean scope=session forward contextRelative=false name=failure path=/failure.jsp /forward forward contextRelative=false name=success path=/reports.jsp /forward /action action path=/saveFavorites type=com.chase.adf.myreports.actions.SaveFavoritesAction name=manageFormBean scope=request forward contextRelative=false name=failure path=/failure.jsp /forward forward contextRelative=false name=success path=/messages.jsp /forward /action action path=/getReportsManage type=com.chase.adf.myreports.actions.GetReportsManageAction name=manageFormBean scope=request forward contextRelative=false name=success path=/manage.jsp /forward forward contextRelative=false name=failure path=/failure.jsp /forward /action action path=/welcomeDispatch type=com.chase.adf.myreports.actions.WelcomeDispatchAction forward contextRelative=false name=failure path=/failure.jsp /forward forward contextRelative=false name=manage path=/getReportsManage.do /forward forward contextRelative=false name=view path=/getReportsView.do /forward forward contextRelative=false name=public path=/getReportsView.do /forward /action /action-mappings !--Controller-- controller processorClass=com.ibm.portal.struts.portlet.WpRequestProcessor /controller !-- Message Resources -- message-resources parameter=ApplicationResources / /struts-config welcomeForward.jsp: %@ taglib uri=http://struts.apache.org/tags-logic; prefix=logic % %@ taglib uri=http://java.sun.com/portlet; prefix=portletAPI % %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% portletAPI:defineObjects / logic:forward name=welcomeDispatch/ This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. This transmission may contain
file upload
please helm me i must write a code for uploading file in a directory of the server. i just try some example but i'm failed. can someone give me the code to upluoad file when i try i received this message java.lang.RuntimeException: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location] -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23282289.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
Re: file upload
Do you have a jar with the org.apache.struts2.dispatcher.multipart.MultiPartRequest class anywhere in your classpath? Nils-H On Tue, Apr 28, 2009 at 7:25 PM, PEGASUS84 pegasu...@hotmail.it wrote: please helm me i must write a code for uploading file in a directory of the server. i just try some example but i'm failed. can someone give me the code to upluoad file when i try i received this message java.lang.RuntimeException: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location] -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23282289.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: file upload
no where is ths file Nils-Helge Garli wrote: Do you have a jar with the org.apache.struts2.dispatcher.multipart.MultiPartRequest class anywhere in your classpath? Nils-H On Tue, Apr 28, 2009 at 7:25 PM, PEGASUS84 pegasu...@hotmail.it wrote: please helm me i must write a code for uploading file in a directory of the server. i just try some example but i'm failed. can someone give me the code to upluoad file when i try i received this message java.lang.RuntimeException: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location] -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23282289.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 -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23282574.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
Re: file upload
PEGASUS84 wrote: no where is ths file S2 file uploading requires commons-io and commons-fileupload (by default). Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: file upload
Sorry, my copy paste mistake. That file is of course in the core. Take a look at this: http://struts.apache.org/2.1.6/docs/file-upload.html Nils-H On Tue, Apr 28, 2009 at 7:37 PM, PEGASUS84 pegasu...@hotmail.it wrote: no where is ths file Nils-Helge Garli wrote: Do you have a jar with the org.apache.struts2.dispatcher.multipart.MultiPartRequest class anywhere in your classpath? Nils-H On Tue, Apr 28, 2009 at 7:25 PM, PEGASUS84 pegasu...@hotmail.it wrote: please helm me i must write a code for uploading file in a directory of the server. i just try some example but i'm failed. can someone give me the code to upluoad file when i try i received this message java.lang.RuntimeException: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location] -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23282289.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 -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23282574.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: file upload
thanks now thw action works but please send me a right code to make the uploadfile in a specify directory of the server because the code wich i try doesn't work -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23282922.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
Re: file upload
PEGASUS84 wrote: thanks now thw action works but please send me a right code to make the uploadfile in a specify directory of the server because the code wich i try doesn't work Copy the file to the directory you want. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Struts and encoding ISO-8859-1
Wow, finally, it works... Thank you indeed, I wouldn't have solved this without your help. I did missunderstand something in your former instructions, the part where I should move the encoding in my web.xml to before the Struts2 filter. It wouldn't have worked anyway I guess since ISO-8859-1 had other problems. But now everything is fine with UTF-8. Wow, it really lifted some burden of me. Thank you so much Jeroen! Cheers :) Niklas Date: Tue, 28 Apr 2009 13:46:48 +0200 From: voetsjo...@gmail.com To: user@struts.apache.org Subject: Re: Struts and encoding ISO-8859-1 You shouldn't technically need Struts 2.1.7 to be able to use UTF-8. If you want to stick with 2.1.6, there are two options: either you use useBodyEncodingForURI=true in Tomcat's server.xml, or you explicitly set URIEncoding=UTF-8 in the connector. I'd advise you to use useBodyEncodingForURI, as this will still allow other webapps in the same Tomcat container to use their own, possibly different encodings. Because of the filter bug in Struts 2.1.6 though, you'll have to make the call to setCharacterEncoding yourself before the Struts filter kicks in. This is exactly what the filter you wrote in your original post does; you just have to make sure that it comes before the Struts 2 filter in your web.xml descriptor. Furthermore, you'll need to make sure that all your pages are sent as UTF-8. This is done in the same way I outlined earlier, ie. by setting the charset in your Content-type header. For JSPs this is done using the directive in your JSPs (I hope it won't garble the brackets now). You can easily verify the page encoding in Firefox by right-clicking anywhere on the page and selecting View Page Info. You're interested in the Encoding: line, not the stuff in the Meta box. Also, you'll want Hibernate to connect to your database using a UTF-8 connection. You can do this by setting the properties hibernate.connection.useUnicode=true and hibernate.connection.characterEncoding=UTF-8. That should be about it. If you can't get it working and/or you'd like to try with a Struts 2.1.7, I can upload a snapshot build for you somewhere so you can try it out. Cheers, Jeroen Hello, I did download Struts2 trunk and current but count't build any without BUILD FAILED. Will this be a problem (sorry for being a bit lazy, don't want to switch to 2.1.7 if it doesn't work...)? If I go back to UTF-8, do I need to upgrade to Struts 2.1.7 in order to get åäö working? Do you have any prescription for getting it to work with UTF-8, or is it the same as you already explained below?. I am not paranoid aout saving a few bytes :) Thanks again! Regards, Niklas Date: Sun, 26 Apr 2009 23:36:13 +0200 From: voetsjo...@gmail.com To: user@struts.apache.org Subject: Re: Struts and encoding ISO-8859-1 Well, ISO-8859-1 and UTF-8 differ in the fact that ISO-8859-1 is a single-byte encoding and can only encode 256 characters (albeit carefully chosen), while UTF-8 is a multi-byte encoding and can represent any character in the Unicode codespace (ie. any character you can think of). Both will use a single byte for code points 0-127; once you go past that, UTF-8 will start using two bytes, but ISO-8859-1 will run out after 256 characters. So unless you're absolutely paranoid about saving a few bytes of network traffic, UTF-8 is the way to go. If you're encoding text in the Latin-1 range, most of your characters are likely to be regular ASCII characters anyway (as well as all the HTML markup the user doesn't get to see). That, and you'll get the additional benefit of being able to handle anything your users throw at you which is, needless to say, a big plus on the interwebs. Hello, Thank you for you quick reply. Sorry if I was a bit unclear: I am posting via a form, in a JSP page, some information that at a later stage is stored in my DB. When I use åäöÅÄÖ it is messed up to ??-signs when extracting it on the server side before trying to save it in the db. I didn't try to use ISO-8859-1 at first, but when UTF-8 didn't work I changed. I assume that why it didn't work was because of the bug and the configurations you mentioned below (server.xml config). I'll try tomorrow. What is the purpose of using ISO-8859-1 when it seems like UTF-8 works for all languages then? Or am I mistaken there? I have myself in the past (way back) used Big5 and Gb1251 (think it was) coding Chinese applications using Java. Don't know what happened to my e-mail I sent out, it's totally corrupted I can see now, a lot of information is missing (at least in my web-client...). But I think your answer helps me so I skip completing that missing information now. Thanks again! Regards, Niklas Date: Sun, 26 Apr 2009 21:52:23 +0200 From: voetsjo...@gmail.com
Re: Struts and encoding ISO-8859-1
Glad to have been of help :) Wow, finally, it works... Thank you indeed, I wouldn't have solved this without your help. I did missunderstand something in your former instructions, the part where I should move the encoding in my web.xml to before the Struts2 filter. It wouldn't have worked anyway I guess since ISO-8859-1 had other problems. But now everything is fine with UTF-8. Wow, it really lifted some burden of me. Thank you so much Jeroen! Cheers :) Niklas Date: Tue, 28 Apr 2009 13:46:48 +0200 From: voetsjo...@gmail.com To: user@struts.apache.org Subject: Re: Struts and encoding ISO-8859-1 You shouldn't technically need Struts 2.1.7 to be able to use UTF-8. If you want to stick with 2.1.6, there are two options: either you use useBodyEncodingForURI=true in Tomcat's server.xml, or you explicitly set URIEncoding=UTF-8 in the connector. I'd advise you to use useBodyEncodingForURI, as this will still allow other webapps in the same Tomcat container to use their own, possibly different encodings. Because of the filter bug in Struts 2.1.6 though, you'll have to make the call to setCharacterEncoding yourself before the Struts filter kicks in. This is exactly what the filter you wrote in your original post does; you just have to make sure that it comes before the Struts 2 filter in your web.xml descriptor. Furthermore, you'll need to make sure that all your pages are sent as UTF-8. This is done in the same way I outlined earlier, ie. by setting the charset in your Content-type header. For JSPs this is done using the directive in your JSPs (I hope it won't garble the brackets now). You can easily verify the page encoding in Firefox by right-clicking anywhere on the page and selecting View Page Info. You're interested in the Encoding: line, not the stuff in the Meta box. Also, you'll want Hibernate to connect to your database using a UTF-8 connection. You can do this by setting the properties hibernate.connection.useUnicode=true and hibernate.connection.characterEncoding=UTF-8. That should be about it. If you can't get it working and/or you'd like to try with a Struts 2.1.7, I can upload a snapshot build for you somewhere so you can try it out. Cheers, Jeroen Hello, I did download Struts2 trunk and current but count't build any without BUILD FAILED. Will this be a problem (sorry for being a bit lazy, don't want to switch to 2.1.7 if it doesn't work...)? If I go back to UTF-8, do I need to upgrade to Struts 2.1.7 in order to get åäö working? Do you have any prescription for getting it to work with UTF-8, or is it the same as you already explained below?. I am not paranoid aout saving a few bytes :) Thanks again! Regards, Niklas Date: Sun, 26 Apr 2009 23:36:13 +0200 From: voetsjo...@gmail.com To: user@struts.apache.org Subject: Re: Struts and encoding ISO-8859-1 Well, ISO-8859-1 and UTF-8 differ in the fact that ISO-8859-1 is a single-byte encoding and can only encode 256 characters (albeit carefully chosen), while UTF-8 is a multi-byte encoding and can represent any character in the Unicode codespace (ie. any character you can think of). Both will use a single byte for code points 0-127; once you go past that, UTF-8 will start using two bytes, but ISO-8859-1 will run out after 256 characters. So unless you're absolutely paranoid about saving a few bytes of network traffic, UTF-8 is the way to go. If you're encoding text in the Latin-1 range, most of your characters are likely to be regular ASCII characters anyway (as well as all the HTML markup the user doesn't get to see). That, and you'll get the additional benefit of being able to handle anything your users throw at you which is, needless to say, a big plus on the interwebs. Hello, Thank you for you quick reply. Sorry if I was a bit unclear: I am posting via a form, in a JSP page, some information that at a later stage is stored in my DB. When I use åäöÅÄÖ it is messed up to ??-signs when extracting it on the server side before trying to save it in the db. I didn't try to use ISO-8859-1 at first, but when UTF-8 didn't work I changed. I assume that why it didn't work was because of the bug and the configurations you mentioned below (server.xml config). I'll try tomorrow. What is the purpose of using ISO-8859-1 when it seems like UTF-8 works for all languages then? Or am I mistaken there? I have myself in the past (way back) used Big5 and Gb1251 (think it was) coding Chinese applications using Java. Don't know what happened to my e-mail I sent out, it's totally corrupted I can see now, a lot of information is missing (at least in my web-client...). But I think your answer helps me so I skip completing that missing information now. Thanks again! Regards, Niklas Date: Sun, 26 Apr 2009 21:52:23 +0200 From: voetsjo...@gmail.com To:
Re: Any hint of JQuery on struts2 tutorial, thanks!
Thank you! It seems I have a lot to learn:-) Wes Wannemacher wrote: On Tue, Apr 28, 2009 at 10:39 AM, fireapple taizhang1...@gmail.com wrote: Hi, Wes, on the table of content of the book, I didn't find anything related to JQuery and Struts2. Since JQuery is similar with JavaScript, can we say we can use JQuery in Struts2 as soon as we can use JavaScript in Struts2? Thank you. I'm a new programmer with stupid questions,:-) JQuery is a JavaScript framework/library, so if you are using JQuery with Struts2, then you are using JavaScript with Struts2. Depending on how new you are to programming, there may be better places to start. JQuery isn't similar to JavaScript, it is JavaScript in the same way that Struts is Java. JQuery takes many of the things that are difficult in JavaScript and makes them easier. You are still using JavaScript, but rather than writing 20 lines of code, you write just a few. Looking back through the ToC, I guess I don't make it clear that there is JQuery coverage specifically, but as I mentioned before, the examples so far are already using JQuery. It may be hard to pick things up through the examples if you are not already experienced with the other topics. The example I mentioned to earlier incorporates Struts 2 with Spring, JPA, a generic DAO setup, JSON, Struts 2 Conventions and JQuery. If you've never used JPA or Spring, there would be quite a bit thrown at you in one example. Depending on your goal, there are a few other routes you might want to take before jumping into an advanced book. If you are looking to learn more about Struts 2, my book is a follow-up to another book called Struts 2 In Action that is a very well-written introduction and reference on Struts 2 core topics. If you are already familiar with Struts 2, but want to learn more about AJAX, then start by learning a bit about JavaScript core and AJAX... Manning has another book (http://manning.com/crane/) that has been a good seller for them. My book isn't meant to be a reference only on Struts 2 and AJAX. It is meant to give examples and best practices for integration with many of the popular topics that come up on this list. Plus, it will give examples on more advanced topics that haven't come up yet, but will (OSGi?) -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23284541.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
Re: file upload
excuse me has some one the code to save the upload file in a specific directory? -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23286968.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
Re: file upload
PEGASUS84 wrote: has some one the code to save the upload file in a specific directory? Copy the file to the directory you want. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: file upload
I think the File class in the Java API would be a good place to start. Just a guess though. On 4/28/09, PEGASUS84 pegasu...@hotmail.it wrote: excuse me has some one the code to save the upload file in a specific directory? -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23286968.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 -- Sent from my mobile device - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: file upload
In case you have not guessed, asking someone to just give me code is not the best policy on any forum/mailing list. You can either a) use Google to find someone who has posted code b) Learn to do it yourself. Either way its not really a Struts related question. All that said, try this although I fear it will only cause more problems than it will help you: private void saveFile(File file, String savePath, String fileName) throws CourseResourceException{ File dirPath = new File(savePath); if (!dirPath.exists()) { dirPath.mkdirs(); } try{ //retrieve the file data InputStream stream = new FileInputStream(file); //write the file to the file specified OutputStream bos = new FileOutputStream(savePath + File.separator + fileName); int bytesRead; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); stream.close(); }catch(Exception e){ throw new CourseResourceException(Could not save file to file system.,e); } } PEGASUS84 wrote: excuse me has some one the code to save the upload file in a specific directory? -- View this message in context: http://www.nabble.com/file-upload-tp23282289p23290304.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
Re: Any hint of JQuery on struts2 tutorial, thanks!
Perhaps you are looking for some basic tidbits you may commonly use: a) Calendar pop-up b) Ajax calls with JSON response from Struts c) Simple element hide/show Can you build a list like this of things you need to build your UI or are you looking more for skill building sources? fireapple wrote: Thank you! It seems I have a lot to learn:-) Wes Wannemacher wrote: On Tue, Apr 28, 2009 at 10:39 AM, fireapple taizhang1...@gmail.com wrote: Hi, Wes, on the table of content of the book, I didn't find anything related to JQuery and Struts2. Since JQuery is similar with JavaScript, can we say we can use JQuery in Struts2 as soon as we can use JavaScript in Struts2? Thank you. I'm a new programmer with stupid questions,:-) JQuery is a JavaScript framework/library, so if you are using JQuery with Struts2, then you are using JavaScript with Struts2. Depending on how new you are to programming, there may be better places to start. JQuery isn't similar to JavaScript, it is JavaScript in the same way that Struts is Java. JQuery takes many of the things that are difficult in JavaScript and makes them easier. You are still using JavaScript, but rather than writing 20 lines of code, you write just a few. Looking back through the ToC, I guess I don't make it clear that there is JQuery coverage specifically, but as I mentioned before, the examples so far are already using JQuery. It may be hard to pick things up through the examples if you are not already experienced with the other topics. The example I mentioned to earlier incorporates Struts 2 with Spring, JPA, a generic DAO setup, JSON, Struts 2 Conventions and JQuery. If you've never used JPA or Spring, there would be quite a bit thrown at you in one example. Depending on your goal, there are a few other routes you might want to take before jumping into an advanced book. If you are looking to learn more about Struts 2, my book is a follow-up to another book called Struts 2 In Action that is a very well-written introduction and reference on Struts 2 core topics. If you are already familiar with Struts 2, but want to learn more about AJAX, then start by learning a bit about JavaScript core and AJAX... Manning has another book (http://manning.com/crane/) that has been a good seller for them. My book isn't meant to be a reference only on Struts 2 and AJAX. It is meant to give examples and best practices for integration with many of the popular topics that come up on this list. Plus, it will give examples on more advanced topics that haven't come up yet, but will (OSGi?) -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/Any-hint-of-JQuery-on-struts2-tutorial%2C-thanks%21-tp23277517p23290342.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
Re: Validating Struts2 fields using JQuery
I can't think of anything with a quick breeze through of your message, but you should use the id parameter of the s:textfield tag so you know what the HTML id will be in your $(#...) call. Kiru-2 wrote: I am using JQuery for validating the fields in my jsp page, created using Struts 2.1.6. But the jquery validation is not firing and the form is getting submitted. In the same page I have created tabs, date picker using JQuery and they are all working fine. The same JQuery validtion is working fine with pure html (no struts tag) form. The fields that i am trying to validate are inside the jquery tab. Any idea what could be missing/wrong? Thanks. Here is portion of my .jsp %@ taglib prefix=s uri=/struts-tags% link type=text/css href=/abc/css/jquery-ui-1.7.1.custom.css rel=stylesheet / script type=text/javascript src=/abc/js/jquery-1.3.2.min.js/script script type=text/javascript src= http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js /script script type=text/javascript src=/abc/js/jquery-ui-1.7.1.custom.min.js/script link rel=stylesheet type=text/css href=../css/validate.css / script type=text/javascript $(document).ready(function() { // validate signup form $(#myForm).validate({ rules: { myForm_userId: required, }, messages: { myForm_userId: Enter user ID, }, // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { if ( element.is(:radio) ) error.appendTo( element.parent().next().next() ); else if ( element.is(:checkbox) ) error.appendTo ( element.next() ); else error.appendTo( element.parent().next() ); }, // specifying a submitHandler prevents the default submit, good for the demo /* submitHandler: function() { alert(submitted!); }, */ success: function(label) { // set nbsp; as text for IE label.html(nbsp;).addClass(checked); } }); }); /script s:form name=myForm id=myForm action=myResults namespace=/ method=post theme=xhtml table align=center border=0 table align=center tr td colspan=2 s:fielderror cssClass=error s:param value=userID / /s:fielderror /td /tr s:textfield name=userID label=%{getText('login.label.userID')} required=true requiredposition=left maxlength=10 s:param name=labelstyle value=%{'boldtext'} / /s:textfield /table /s:form -- View this message in context: http://www.nabble.com/Validating-Struts2-fields-using-JQuery-tp23278971p23290352.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
Re: result type -- redirect-action vs dispatcher.
The technical answer to your question is the chain result will copy the previous request. I think there could be some pattern issues here though. You have a central action where you post a variety of forms and you want to reuse that action and then figure out which form to go back to? I don't know the requirements behind the pattern so its hard to say if its better served some other way. Is it to type less? Siddiq Syed wrote: Hi Wes, Here is the configuration in struts.xml for displaying the result , where we determine what need to be displayed once validation failed. If validation fails while calculateParoleEligibilityDate , then framwork will look for input for the defined action which is determineInputForRedirect, which determine the corresponding view which need to be display. Again the problem is redirect-action which leads to create a new request , is there any way where i can redirect/forward to an action which contains the previous request. action name=calculateParoleEligibilityDate class=us.ga.state.pap.cons.clemency.presentation.action.activity.UpdateCaseAction method=calculateParoleEligibilityDate interceptor-ref name=redirectInput/ result name=newsentence type=tileseditNewSentence/result result name=additionalsentence type=tileseditAdditionalSentence/result result name=recomputation type=tileseditRecomputation/result result name=revocation type=tileseditRevocation/result result name=revocationnewconvict type=tileseditRevocationNewConvict/result result name=casedetail type=tilesupdateCaseDetail/result result name=combine type=tileseditProcessCombine/result result name=input type=redirect-action determineInputForRedirect ${caseNumber} ${caseEditReason} ${showButton} ${taskId} /result /action action name=determineInputForRedirect class=us.ga.state.pap.cons.clemency.presentation.action.activity.UpdateCaseAction method=determineInputForRedirect result name=newsentence type=tileseditNewSentence/result result name=additionalsentence type=tileseditAdditionalSentence/result result name=recomputation type=tileseditRecomputation/result result name=revocation type=tileseditRevocation/result result name=revocationnewconvict type=tileseditRevocationNewConvict/result result name=casedetail type=tilesupdateCaseDetail/result result name=combine type=tileseditProcessCombine/result /action Thanks in advance. I hope you got my problem. Regards, Siddiq --- On Sat, 4/25/09, Wes Wannemacher w...@wantii.com wrote: From: Wes Wannemacher w...@wantii.com Subject: Re: result type -- redirect-action vs dispatcher. To: Struts Users Mailing List user@struts.apache.org Date: Saturday, April 25, 2009, 12:00 AM On Friday 24 April 2009 19:47:04 Siddiq Syed wrote: Hi all, Problem statement. : When validation happens in struts 2 it will redirect to result type Input if type=tiles JSP will display the validation message and If result type=redirect-action , validation message will not get display.. In order to display validation messages , I am using interceptor where validation messages are will be stored in session and the same will be displayed in JSP. Problem is validation messages are getting displayed but the values are getting lost in the text boxs. The reason for this is because its the brand request object because of redirect-action. Is there any way where i can forward to action , but still can able to retrive the previous request. ? I know we can use dispacther , but dispacther uses only .jsp . I could be wrong, but i think redirectAction is the only result type that ends up with a new request... I don't really understand the use case where validation fails and you want to go to input for a different action... Can you post your struts.xml section pertinent to this problem. -Wes -- Wes Wannemacher Author - Struts 2 In Practice Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more http://www.manning.com/wannemacher - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://www.nabble.com/result-typeredirect-action-vs-dispatcher.-tp23226596p23290448.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
Re: Autowired and PostConstruct with Struts + Spring
How is your JUnit test setup? If your service is injected in your JUnit test and not in Struts then it could be that contextConfiguration in web.xml is messed up. I usually annotate the action with @Component and just put an @Autowired over the setter. I am not sure what @PostConstruct does. e_sli...@yahoo.it wrote: Hi Norris and Dave! Thank you for your answers. Yes, I have get/set methods for myService. If you means declaring: constant name=struts.objectFactory value=spring / in my struts.xml for my object factory, yes. I don't have @Component for Spring injection, but I suppose Spring work well as far as the myService bean is available in my context for other beans in my app. I'm just wondering about @Autowired and @PostConstruct behaviour when passing by Struts + Spring. Probably @PostConstruct is executed just before the @Autowired? Using pure Spring without Struts works well: running a JUnit test with my @PostConstruct annotated method show myService is not null, but when this is in a Struts action does not work... Has anybody see this behaviour? Thank you for your help! Emanuele Norris Shelton wrote: Did you set Spring to be your object factory in your struts.xml. If you used Spring annotations, did you annotate your bean to be injected with @Component and designate a base package for Spring to scan for beans? Norris Shelton Software Engineer Sun Certified Java 1.1 Programmer Shelton Consulting, LLC ICQ# 26487421 AIM NorrisEShelton YIM norrisshelton Is there a public myService setter? (I hardly even use annotations; maybe that's not necessary?) Dave From: e_sli...@yahoo.it e_sli...@yahoo.it To: user@struts.apache.org Sent: Monday, April 27, 2009 12:41:01 PM Subject: Autowired and PostConstruct with Struts + Spring Hello everybody! I'm trying to use my service into a Struts action but with no success. My struts action contains : @Autowired private MyService myService @PostConstruct public void init() { // use here myService } Unfortunately myService is always null and I cannot use myService in the init() method... The bean myService should correctly declared in my application-context.xml: bean id=myService class=com.mypackage.MyServiceImpl property name=... ref=... / ... /bean and my struts.xml contains: constant name=struts.objectFactory value=spring / Where I'm wrong? Many Thanks! Emanuele -- View this message in context: http://www.nabble.com/Autowired-and-PostConstruct-with-Struts-%2B-Spring-tp23260298p23290503.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
Re: radio with two values
That is just a brutal description dude. I can't even venture a guess at what you are describing but I would stick with the solution proposed before. PEGASUS84 wrote: ok but i try to use an hidden tag but it set all values of name because it is into an iterator tag -- View this message in context: http://www.nabble.com/radio-with-two-values-tp23272838p23290532.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
RE: Struts 2.1.6 - Alternative Template Engines - JSP
Hi Musachy, Thanks for your reply. I was wondering what is the significance of struts.ui.templateSuffix is? Please advice. Thank you. Regards, Kishan.G Senior Software Engineer. www.spansystems.com -Original Message- From: Musachy Barroso [mailto:musa...@gmail.com] Sent: Tuesday, April 28, 2009 6:37 PM To: Struts Users Mailing List Subject: Re: Struts 2.1.6 - Alternative Template Engines - JSP The template engines just process certain types of templates(ftl, vm, jsp, etc), but are not(directly) related to tags. The tags need to output something, what you use to generate the output is up to you, the struts tags use freemarker, but the javatemplates plugin uses plain java, for example. musachy On Tue, Apr 28, 2009 at 3:06 AM, Kishan G. Chellap Paandy kishanchellapaand...@spanservices.com wrote: Hi, I'm using Struts 2.1.6. I'm developing custom Struts 2.1.6 tags. I want to use org.apache.struts2.components.template.JspTemplateEngine. The framework supports three template engines, which can be controlled by the struts.ui.templateSuffix in struts.properties. If I set the above, does all the struts2 tags and the custom tags I'm developing will use the JSPTemplateEngine? I want to use JSPTemplateEngine only for some custom tags I'm developing and I will use FreemarkerTemplateEngine for some other custom tags. Is this possible? Thank you. Regards, Kishan.G - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Hey you! Would you help me to carry the stone? Pink Floyd - 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