struts action related query
Hi all I have a jsp that opens up as a pop up. I want to call a form submit from this jsp so that it calls some method in action. But I want that the jsp remains static as pop up and do not redirect or forward to some other jsp. In struts.xml we have to specify some result for some action. Can you help me out how to deal with such scenario... thanks in advance.. Upasana Sharma
Re: struts action related query
its better to use AJAX Jay On Wed, Apr 21, 2010 at 12:15 PM, Upasana Sharma sharma...@gmail.comwrote: Hi all I have a jsp that opens up as a pop up. I want to call a form submit from this jsp so that it calls some method in action. But I want that the jsp remains static as pop up and do not redirect or forward to some other jsp. In struts.xml we have to specify some result for some action. Can you help me out how to deal with such scenario... thanks in advance.. Upasana Sharma
Re: struts action related query
Sounds like you want the browser to submit a request without attempting to replace the current page with the results. The way the browser does that is by using javascript and specifically a javascript object called XMLHttpRequest. Use of that has become called AJAX, and there are lots of libraries that'll help you do so in a (more) browser independent manner. The Request object in prototype is pretty simple, but if you're getting started with a library that you'll be using for a while I've heard good things about and would suggest looking at jquery. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Partial Validation
Hi, Is there any way I can do a partial validation in Struts 2? I have a page with two fieldsets, where I can either submit the entire page or submit only the fieldset (through Ajax). In the latter case, I wish to validate only the fieldset's properties, but in the former case I want the entire page to be validated. I am using annotation for validation. Regards, Rahul =-=-= Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
RE: Convention Plugin not being picked up.
NOT PROTECTIVELY MARKED Thanks, It is also worth noting that I have tested just deploying the WAR and everything works fine. Just when that WAR is deployed within an EAR nothing gets picked up. Chris -Original Message- From: jonathan doklovic [mailto:list-rea...@sysbliss.com] Sent: 20 April 2010 16:38 To: Struts Users Mailing List Subject: Re: Convention Plugin not being picked up. Also, you can add: log4j.category.org.apache.struts2.convention=TRACE to your log4j.properties to get exhaustive logging about convention wiring up actions. - Jonathan Miles, Chris wrote: NOT PROTECTIVELY MARKED Hi, Thanks. My config only contains ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd; struts package name=checkout extends=struts-default namespace=/actions/ /struts My actions are contained within the WAR file within the EAR. No JARs in place. There is nothing in the setup documentation about setting the package property? Chris -Original Message- From: jonathan doklovic [mailto:list-rea...@sysbliss.com] Sent: 20 April 2010 15:48 To: Struts Users Mailing List Subject: Re: Convention Plugin not being picked up. I would also look at your struts config for the following: struts.convention.default.parent.package - should be the name of your default package declared in the config struts.convention.action.includeJars - if your actions are in separate jars, you may need to add a pattern here so convention will scan them - Jonathan Miles, Chris wrote: Hi, I am using the convention plugin, not the older codebehind plugin. The convention plugin exists in my lib directory. I am calling actions by /namespace/actionName.action Thanks Chris Good Afternoon Chris best to look at the usage of the code behind plugin http://struts.apache.org/2.1.6/docs/codebehind-plugin.html a few fundamentals: did you copy the codebehind jar to WEB-INF/lib? is your Action mapping adhering to the convention of /NAMESPACE/ACTION.(jsp|vm|ftl) I am using Glassfish 2.1 and deploying my application with the convention plugin, but none of my annotations are being processed which leads me to believe that the plugin is not being loaded. There is nothing in the server logs mentioning any messages or errors. The config browser plugin tells me anything I define in a config file, but not through annotations. - 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 NOT PROTECTIVELY MARKED - 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 NOT PROTECTIVELY MARKED - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 annotations and superclass
Greetings, We are converting from using Struts1 and XDoclet to Struts2 and Struts2 annotations. We have a base action class which handles requests which displays grid style information. The super class is a template pattern which does a lot of the common heavy lifting and exposes a method display which is invoked by a name specified in the action configuration for the url. Subclasses simply implement a method to retrieve a collection of objects. What we have been doing is placing the XDoclet annotations in the subclasses which specified the url and the method to invoke. With Struts2, I don't see that this is possible using just the annotations. It appears subclasses will have to override the superclass method just to bind a url. I don't see that the @Action annotation supports a method parameter or it may be possible. The same problem will occur for our CRUD action super classes. The subclasses will have to override the super class methods just to bind the method name to the url. So, am I missing something? Is it possible to use Struts2 annotations such that subclasses don't have to override super class methods simply to bind the method name to the url? /robert
RE: Convention Plugin not being picked up.
this sounds suspiciously like a permissions problem assuming you started $GF with startserv.bat the com.sun.aas.installRoot attribute is set as $AS_INSTALL set D01=-Dcom.sun.aas.installRoot=$AS_INSTALL $GF_HOME/domains/domain1/config/server.policy contents would contain the necessary permissions for deployment-javaee-core.jar to create,get and set the ContextLoader grant codebase file:${com.sun.aas.installRoot}/lib/deployment-javaee-core.jar { permission java.lang.RuntimePermission createClassLoader; permission java.lang.RuntimePermissiongetClassLoader; permission java.lang.RuntimePermissionsetContextClassLoader; } as our time is not compensated ..you would be well advised to enroll with paid support scenario from anyone on this list Martin __ Verzicht und Vertraulichkeitanmerkung 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. Subject: RE: Convention Plugin not being picked up. Date: Wed, 21 Apr 2010 12:39:10 +0100 From: chris.mi...@spsa.pnn.police.uk To: user@struts.apache.org; list-rea...@sysbliss.com NOT PROTECTIVELY MARKED Thanks, It is also worth noting that I have tested just deploying the WAR and everything works fine. Just when that WAR is deployed within an EAR nothing gets picked up. Chris -Original Message- From: jonathan doklovic [mailto:list-rea...@sysbliss.com] Sent: 20 April 2010 16:38 To: Struts Users Mailing List Subject: Re: Convention Plugin not being picked up. Also, you can add: log4j.category.org.apache.struts2.convention=TRACE to your log4j.properties to get exhaustive logging about convention wiring up actions. - Jonathan Miles, Chris wrote: NOT PROTECTIVELY MARKED Hi, Thanks. My config only contains ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts Configuration 2.0//EN http://struts.apache.org/dtds/struts-2.0.dtd; struts package name=checkout extends=struts-default namespace=/actions/ /struts My actions are contained within the WAR file within the EAR. No JARs in place. There is nothing in the setup documentation about setting the package property? Chris -Original Message- From: jonathan doklovic [mailto:list-rea...@sysbliss.com] Sent: 20 April 2010 15:48 To: Struts Users Mailing List Subject: Re: Convention Plugin not being picked up. I would also look at your struts config for the following: struts.convention.default.parent.package - should be the name of your default package declared in the config struts.convention.action.includeJars - if your actions are in separate jars, you may need to add a pattern here so convention will scan them - Jonathan Miles, Chris wrote: Hi, I am using the convention plugin, not the older codebehind plugin. The convention plugin exists in my lib directory. I am calling actions by /namespace/actionName.action Thanks Chris Good Afternoon Chris best to look at the usage of the code behind plugin http://struts.apache.org/2.1.6/docs/codebehind-plugin.html a few fundamentals: did you copy the codebehind jar to WEB-INF/lib? is your Action mapping adhering to the convention of /NAMESPACE/ACTION.(jsp|vm|ftl) I am using Glassfish 2.1 and deploying my application with the convention plugin, but none of my annotations are being processed which leads me to believe that the plugin is not being loaded. There is nothing in the server logs mentioning any messages or errors. The config browser plugin tells me anything I define in a config file, but not through annotations. - 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 NOT PROTECTIVELY MARKED - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail:
Custom TextProvider Help
So I have been working on a practical solution that allows me to source my localization texts from a database table. I am using Spring 3.0.2 and Hibernate 3.5.1 along with Struts 2.1.8.1 for the implementation. I have my base action being wired with my TextService via Spring and then I have overwritten each of the getText() methods to make calls to getMyTextProvider().getText(...) methods as shown below. // MyBaseAction.java // abstract public class MyBaseAction extends ActionSupport implements Preparable, SessionAware, ServletContextAware, ServletRequestAware { protected TextService textService; public void setTextService(TextService textService) { this.textService = textService; } public MyTextProvider getMyTextProvider() { return new MyTextProvider(textService, this); } // Overwrote all getText methods to use // return(getMyTextProvider().getText(..) methods } The text provider itself simply extends TextProviderSupport and when the object is being created, I am actually referencing a special ResourceBundle class called MyDatabaseBundle and passing that to the TextProvider framework as shown here. // MyTextProvider.java // public class MyTextProvider extends TextProviderSupport { public MyTextProvider(TextService textService, LocaleProvider localeProvider) { super(new MyDatabaseBundle(textService), localeProvider); } } The MyDatabaseBundle resource bundle object will read the database table and store the values. // MyDatabaseBundle.java // public class MyDatabaseBundle extends ResourceBundle { // overwritten implement here } From what I have gathered, this looks pretty straight forward but is it the right and practical way? What about multiple languages? Will that resource bundle object handle it appropriately? What will I need to do to support that? If there is a better approach, please inform me. It is probably worth noting that in my struts.xml file I have the following configurations: constant name=seek.xworkTextProvider value=myTextProvider/ bean name=myTextProvider class=com.struts2.localization.MyTextProvider scope=default type=com.opensymphony.xwork2.TextProvider/ Thanks Chris
Issue with localization: Messages not picked up from properties file
Hi All, In my package structure, I have package.properties file with the following key value pair: username=User Name password=Password In my simple login page: the form elements are defined with a key look up.. s:form action=login.action method=POST validate=true s:textfield name=username key=username / s:password name=password key=password/s:password s:submit value=Login name=login / /s:form My action xml mappings are given below. The first action is a forward action to the login page. action name = login_input result/login.jsp/result /action action name = login class=LoginAction method=authenticate result name=input/login.jsp/result result name=success/login_success.jsp/result result name=error/login.jsp/result /action When I try to load the login page like this: http://localhost:8080/myApp/login_input.action, I don't see the messages picked up from the package.properties. I see the localized messages if I submit the application and when the validation fails. What can I do to resolve the issue? Thanks, Kartik http
Re: struts action related query
i am also agree with Dale you have two option either to develop your own solution using AJAX or can use third party solution i myself using YUI for the development but lately we are trying jquery and its really good to work with it. Choice is all urs... On Wed, Apr 21, 2010 at 12:23 PM, Dale Newfield d...@newfield.org wrote: Sounds like you want the browser to submit a request without attempting to replace the current page with the results. The way the browser does that is by using javascript and specifically a javascript object called XMLHttpRequest. Use of that has become called AJAX, and there are lots of libraries that'll help you do so in a (more) browser independent manner. The Request object in prototype is pretty simple, but if you're getting started with a library that you'll be using for a while I've heard good things about and would suggest looking at jquery. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org