Re: Re: S2 + REST urls
> > I do not understand well. Do you mean to create new package in sruts.xmland > add an action which serves static content ? > Exactly, Best, Aram Aram Mkhitaryan 52, 25 Lvovyan, Yerevan 375000, Armenia Mobile: +374 91 518456 E-mail: [EMAIL PROTECTED]
how to handle unchecking a check box
I am running into a situation where once a user has checked a box and has submitted the form, there is now no way to uncheck the box. What is the proper way to handle this situation? Thanks, Joe
[S2] AJAX with Sitemesh
I tried taking a modified version of the Struts 2 + Spring 2 + JPA + AJAX tutorial that I've done and integrated it with Sitemesh. I realized that if i have div tags with the ajax theme, Sitemesh will decorate that area so I will end up with and embedded decorator in the main page. I need to exclude my AJAX calls from being decorated. I understand that Sitemesh has a decorators.xml where you can specify which urls are not to be decorated: /styles/* /scripts/* /images/* /ajax/* /dojo/* /struts/* /nodecorate/* I first thought I simply had to move my jsps to a folder that was part of the sitemesh excludes, like the ajax folder or the nodecorate folder. I have a page called person.jsp and when I list the results of my search using ajax I use the personList.jsp. I moved the personList.jsp to an excluded folder but Sitemesh still decorated my personList.jsp. I tried adding the namepspace to the excludes and it turned out that any actions in that namesspace wasn't decorated, includeing person.jsp. I don't want to seperate all my actions that are ajax calls into one namespace, so is there a better way in implementing this? I have a feeling i'm approaching this all wrong. -- View this message in context: http://www.nabble.com/-S2--AJAX-with-Sitemesh-tf4168148.html#a11858517 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to format the actionerrors and actionmessages in the jsp page?
Hi, Richard Sayre Thanks for ur reply. I have been looking for a solution by myself but to find that there was none to resolve it just change the configuration-file. I have no experience in taking use of FreeMarker. However,ur way may be just the only one. I will just try and thanks for ur comment. Good luck! M.Liang On 7/29/07, Richard Sayre <[EMAIL PROTECTED]> wrote: > > 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] > > -- --M.Liang Liu
RE: [S2] Passing URL as parameter between JSP pages
I need to pass the URL from the including page to the included page within the same http request and not across requests (hence the form, hidden variables are not needed). Let me illustrate with an example. Lets say I have searchResults.jsp that lists a page of results and at the bottom, I include a pagination bar that lists the various page numbers. searchResults.jsp looks some like: paginationInclude.jsp needs to do the following: Hope that clarifies the problem further. Thanks Srinivas Himanshu Ranavat wrote: > > Hey Srinivas > > Maybe u cud create a form and create a hidden variable to pass the URL > around between different pages. Retrieve the URL from the form, process > it if u need, add it again as a hidden variable in a form in the next > page. try to submit the form by post. > > Also see if this helps: > > http://struts.apache.org/2.x/docs/how-can-we-access-request-parameters-p > assed-into-an-action.html > Himanshu > > > -Original Message- > From: Srinivas.N. [mailto:[EMAIL PROTECTED] > Sent: Sunday, July 29, 2007 6:43 PM > To: user@struts.apache.org > Subject: [S2] Passing URL as parameter between JSP pages > > > I am developing an app for which there is a common pagination bar (call > it > "paginationInclude.jsp") that is included at the bottom of several > different > pages. > > The pagination include needs to get a "base url" from the including page > and > then append a "pagenum" param to that URL to generate the final URL for > the > numbers in the pagination bar. > > How do I pass the "base url" from the including page - if I use > tag > to generate the "base url" in the including page how do I retrieve that > in > paginationInclude.jsp and how do I just attach an extra param to the > base > url in "paginationInclude.jsp" to generate the new url? > > Thanks > Srinivas > -- > View this message in context: > http://www.nabble.com/-S2--Passing-URL-as-parameter-between-JSP-pages-tf > 4167563.html#a11856984 > 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] > > > -- View this message in context: http://www.nabble.com/-S2--Passing-URL-as-parameter-between-JSP-pages-tf4167563.html#a11858362 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts buttons to invoke actions
Your approach seems fine. See if you can access "CategoryEditor.action" directly using the browser. If not, the action name is incorrect. Have you confirmed that its actually posting a request? Also the logging and debugging interceptor for more insight. Session A Mwamufiya wrote: Hi, I use the following code to display a list of buttons that are supposed to call their associated actions when pressed: None of the actions seem to be called (I use log4j logging to determine whether the execute() method in each of them is ever called; but it never is). I am trying to understand what could be wrong in the way I wrote this. I read online that there is a s:button tag, but when I tried using it, I get a warning that the tag doesn't exist. Any ideas? Thanks, 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: struts buttons to invoke actions
I tried that, but it doesn't change a thing, I still never get the actions called. I'm sure that someone must have already used a button to call a struts 2 action; could you please send me a jsp example of that so that I could do the same in my case. Thanks, Session > > hey to get things moving u cud try to add the method attribute in the > submit tags. u can try to fill in "execute" in that or just create a new > method which does what execute does. this is more like bruteforce i think > and i havent tried it either. > > Himanshu > > -Original Message- From: Session A Mwamufiya > [mailto:[EMAIL PROTECTED] Sent: Fri 7/27/2007 9:54 PM To: > user@struts.apache.org Cc: Subject: struts buttons to invoke actions > > Hi, > > I use the following code to display a list of buttons that are supposed > to call their associated actions when pressed: > > action="CategoryEditor" cssClass="actionButton"/> value="Add Answer" action="AnswerEditor" cssClass="actionButton"/> > > cssClass="actionButton"/> > > None of the actions seem to be called (I use log4j logging to determine > whether the execute() method in each of them is ever called; but it never > is). I am trying to understand what could be wrong in the way I wrote > this. > > I read online that there is a s:button tag, but when I tried using it, I > get a warning that the tag doesn't exist. > > Any ideas? > > Thanks, 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [S2] Passing URL as parameter between JSP pages
Hey Srinivas Maybe u cud create a form and create a hidden variable to pass the URL around between different pages. Retrieve the URL from the form, process it if u need, add it again as a hidden variable in a form in the next page. try to submit the form by post. Also see if this helps: http://struts.apache.org/2.x/docs/how-can-we-access-request-parameters-p assed-into-an-action.html Himanshu -Original Message- From: Srinivas.N. [mailto:[EMAIL PROTECTED] Sent: Sunday, July 29, 2007 6:43 PM To: user@struts.apache.org Subject: [S2] Passing URL as parameter between JSP pages I am developing an app for which there is a common pagination bar (call it "paginationInclude.jsp") that is included at the bottom of several different pages. The pagination include needs to get a "base url" from the including page and then append a "pagenum" param to that URL to generate the final URL for the numbers in the pagination bar. How do I pass the "base url" from the including page - if I use tag to generate the "base url" in the including page how do I retrieve that in paginationInclude.jsp and how do I just attach an extra param to the base url in "paginationInclude.jsp" to generate the new url? Thanks Srinivas -- View this message in context: http://www.nabble.com/-S2--Passing-URL-as-parameter-between-JSP-pages-tf 4167563.html#a11856984 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]
Using JAAS with Struts and MySQL
Hi to everyone. I'm new to Struts and I'm trying to use JAAS Authentication using mysql database to store usernames and passwords. I've found tutorials in google but they show how to configure JAAS with struts using a file to store the authentication data of the users. The tutorial is http://www.mooreds.com/jaas.html Does anybody know how to do this? Thanks for the answers. Diego Ezquerro Asturias, Spain __ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! Regístrate ya - http://correo.espanol.yahoo.com/
[S2] Passing URL as parameter between JSP pages
I am developing an app for which there is a common pagination bar (call it "paginationInclude.jsp") that is included at the bottom of several different pages. The pagination include needs to get a "base url" from the including page and then append a "pagenum" param to that URL to generate the final URL for the numbers in the pagination bar. How do I pass the "base url" from the including page - if I use tag to generate the "base url" in the including page how do I retrieve that in paginationInclude.jsp and how do I just attach an extra param to the base url in "paginationInclude.jsp" to generate the new url? Thanks Srinivas -- View this message in context: http://www.nabble.com/-S2--Passing-URL-as-parameter-between-JSP-pages-tf4167563.html#a11856984 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IoC and Guice 1.0 Struts 2.0.8
Lukasz, It was a few months ago, but I recall encountering the same problem when trying to define a Guice module. As you described, it worked fine without a Module but failed when one was specified. I tracked it down to a bug (in the plugin I think?) and it was solved by building the current version of Guice from source. Building it was extremely easy. I currently use revision 328 from http://google-guice.googlecode.com/svn/trunk (which is many months old) My configuration is as Oleg described, with the addition of the module specification in struts.xml Extract from struts.xml Extract from struts.properties: struts.objectFactory = guice ie. No need to use the Guice filter in web.xml. hope that helps, Jeromy Evans Łukasz Łapiński wrote: On Fri, 27 Jul 2007 13:13:15 +0200, Oleg Mikheev <[EMAIL PROTECTED]> wrote: Łukasz Łapiński wrote: I would really love to use IoC in my struts project. Has anyone any experiences with integration Struts and Guice. I'm using Guice, but I'm not defining any modules (what do you need them for?) I just added 3 libs (guice-1.0.jar, guice-servlet-1.0.jar, guice-struts2-plugin-1.0.1.jar) to WEB-INF/lib, and put this line to struts.xml: That's all I had to do to be able to use @Inject in actions. Oleg Hi Oleg, thx for the answer. How do you inject into your web applications JNDI resources, such as data sources if you dont use any modules ? I think this is where one could use // Bind to DataSource from JNDI. bind(DataSource.class) .toProvider(fromJndi(DataSource.class, "...")); which comes from Guice user guide. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Is Struts still a better choice over JSF as on today ?
Hi Frank, Thanks again for the detailed response. I think I've got your points. Yes I'm aware of Swing/VB technology and that analogy helped me a lot to understand the perspective. However, I'm still not very sure whether the design approach of Swing/VB is a right fit for a scenario where the underlying technology is http. They are good for a thick client scenario where most of the event handlings happen in client machine (except the events which has to communicate with server). So though design/development wise the component framework may help a lot (after the initial learning curve), efficiency wise how the things will perform (and of course lost of it will depend on the vendors implementation of JSF specification) is a big question to me. Regards, Sourav -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Thursday, July 26, 2007 9:25 PM To: Struts Users Mailing List Subject: Re: Is Struts still a better choice over JSF as on today ? souravm wrote: > Regarding going for JSF due to componentization, I'm again not sure what > additional componentizations JSF does compared to struts. JSF is inherently a component-based framework, meaning you aren't really thinking in terms of pages, your thinking in terms of components of a "view". Struts doesn't really offer this, although S2 gets closer to it in many ways (and yes, there's some JSF support in S2 is you want it, although I'm not too familiar with it myself). > Apart from the fact that JSF does not need a layer like Action Classes, all other components (validator, managed bean, html tag libs etc.) are already there in Struts. May be I'm missing something here. I think your looking at the pieces and comparing them rather than looking at the overarching paradigm of one framework vs. the other. The distinction has been diminished a bit with S2, but it's still there. A component-based approach means your looking at individual elements that make up a a particular view and thinking in terms of the interactions the user can have with each. You don't think in terms of state transitions, you think in terms of events. With Struts, it's about state transitions. The user submits a form and transitions to a new application state entirely. I'm throwing AJAX out of this for the moment of course :) > Also, I'm yet to appreciate the real value add event handling mechanism of > JSF can bring in a web application scenario. It's the ease, in theory, that it provides, and the fact that your inherently thinking along those lines, rather than shoe-horning it in. That's the value-add IML (in theory!) > Especially given the fact that all those events (associated with a single http request) would be fired only in a sequential way at server side. I'm not quite sure what you mean by that... > I really cannot think a usage scenario of multiple event handler feature of JSF. Even in case of RIAs, I believe what is more required feature is dynamic loading of part of a html page (which is currently the space where AJAX is becoming popular). So any further explanation/example on how you have found this feature of JSF to be useful for RIAs would be helpful for me to understand your point. It's not just about partial page loads, although that's clearly a big part of it. As I was describing before, it's more about the approach to developing the application. Are you familiar at all with Visual Basic? If so, let me try and make this analogy... working with JSF is more akin to developing in VB than in Struts because your creating a given view that is a collection of components, and then determining what events each component can trigger, and coding for them. When you write a VB app, you aren't typically thinking in terms of this form leads to that form which leads to another form (unless your talking a wizard flow, but that's a specialized case). With Struts, it's always about a transition from one view to another, from one form to another in VB, triggered by some user input (again, putting AJAX aside for the moment). The VB paradigm, is frankly more logical to most developers. It's more like Swing too if you think about it. Now *with* AJAX in the mix, and with client-side component libraries coming fast and furious, a lot of what made JSF potentially attractive has, again IMO, been significantly diminished. People have realized that you don't need the full JSF stack, so to speak, and you can do components without JSF too, so maybe it's not as valuable. Now, JSF still provides value there because it gives you a standardized component model, something that is sorely lacking in client-side component libraries these days (i.e., Dojo widgets and YUI widgets and APT widgets aren't generally compatible, and certainly aren't designed to some common pattern). That's kind of what's happened in Struts land too... there's been a bit of a melding of the component paradigm and the non-component paradigm, largely with AJAX as the cata
Re: [s2] Developing Portlets with Eclipse tutorial available
Very cool! That has been one of those things I keep meaning to work on. If nothing else, add the lines (commented out, of course) to our portlet archetype. Don On 7/29/07, Nils-Helge Garli <[EMAIL PROTECTED]> wrote: > Good tutorial, and a nice way to get started with portlet development! > > Maybe not entirely on topic, but inspired by your tutorial and some > information I found earlier in the pluto FAQ about embedding pluto, I > started playing around with making the maven-jetty-plugin work with a > portlet project. The goal was to be able to start up and test my > portlet just by typing "mvn jetty:run". After collecting information > from various sources, and looking through the pluto-portal-driver and > the pluto-portal sources, I have finally managed to run my portlet > with pluto embedded in jetty, as a real portlet, avoiding the need to > run it emulated as a servlet. It wasn't really that hard (just had to > add a filter and a listener to the web.xml), and the overhead is > hardly noticeable. > > I'll try to write a tutorial and/or package it as a maven plugin, but > until then, if anybody is interested in the details, just let me know. > > Nils-H > > On 7/27/07, Don Brown <[EMAIL PROTECTED]> wrote: > > I wrote up a simple tutorial showing how to start developing portlets > > using Struts 2 and Eclipse. It takes advantage of the fact that > > Struts 2 portlets can be deployed as normal web applications, the > > tutorial is more how to use a Maven 2 archetype with Eclipse, but with > > portlet-specific bits. > > > > I'm a newbie with Eclipse, so I'd appreciate any corrections, > > suggestions, etc. Or better yet, submit a CLA and get write access to > > fix it yourself ;) > > > > http://struts.apache.org/2.x/docs/developing-a-portlet-using-eclipse.html > > > > Don > > > > - > > 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: Submitting a variable amount of form data
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Richard, Richard Sayre wrote: > 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? You do the same thing, but use an array of String objects as the data type: private String[] _name; public void setName(String[] name) { _name = name } public String[] getName() { return _name; } - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGrJKP9CaO5/Lv0PARAvTnAJ4mWls7/Ms5RbKcBo1OIz0RXUWvkQCbBz69 Mfp7JuBYAwLCmLNNK+NTtR0= =JmcI -END PGP SIGNATURE- - 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] Developing Portlets with Eclipse tutorial available
Good tutorial, and a nice way to get started with portlet development! Maybe not entirely on topic, but inspired by your tutorial and some information I found earlier in the pluto FAQ about embedding pluto, I started playing around with making the maven-jetty-plugin work with a portlet project. The goal was to be able to start up and test my portlet just by typing "mvn jetty:run". After collecting information from various sources, and looking through the pluto-portal-driver and the pluto-portal sources, I have finally managed to run my portlet with pluto embedded in jetty, as a real portlet, avoiding the need to run it emulated as a servlet. It wasn't really that hard (just had to add a filter and a listener to the web.xml), and the overhead is hardly noticeable. I'll try to write a tutorial and/or package it as a maven plugin, but until then, if anybody is interested in the details, just let me know. Nils-H On 7/27/07, Don Brown <[EMAIL PROTECTED]> wrote: > I wrote up a simple tutorial showing how to start developing portlets > using Struts 2 and Eclipse. It takes advantage of the fact that > Struts 2 portlets can be deployed as normal web applications, the > tutorial is more how to use a Maven 2 archetype with Eclipse, but with > portlet-specific bits. > > I'm a newbie with Eclipse, so I'd appreciate any corrections, > suggestions, etc. Or better yet, submit a CLA and get write access to > fix it yourself ;) > > http://struts.apache.org/2.x/docs/developing-a-portlet-using-eclipse.html > > Don > > - > 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]