Need Information on
Hi, In a page there is a textField as soon user enter value like 2,3 and soon.. Creating table with Html with that many rows and so on.. Know My question is there any way to create a table with ? If yes how can i do that? And how can i retreive the values in action(associated bean)?. Regards, Srikanth -- View this message in context: http://www.nabble.com/Need-Information-on-%3Cs%3Atable%3E-tp21991331p21991331.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: customize fielderror
Hi, Sorry, for mistype. it should be I try to add attribute theme="simple" but the tag ul and li are still exist. Thanks --- On Thu, 2/12/09, Sonny Gill wrote: > From: Sonny Gill > Subject: Re: customize fielderror > To: "Struts Users Mailing List" , semu...@yahoo.com > Date: Thursday, February 12, 2009, 9:54 PM > Not sure what is, but try adding > theme="simple" to it. > > On Fri, Feb 13, 2009 at 12:39 PM, Po Po > wrote: > > Hi, > > > > I use struts 2.1.6, > > When I used , it's generated html > with tag and . > > how to configure the component, so > the html result is only plain text message (without html > formating ul dan li) ? > > > > Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: customize fielderror
Not sure what is, but try adding theme="simple" to it. On Fri, Feb 13, 2009 at 12:39 PM, Po Po wrote: > Hi, > > I use struts 2.1.6, > When I used , it's generated html with tag and . > how to configure the component, so the html result is only plain > text message (without html formating ul dan li) ? > > Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem with MyEclipse+JDBC Driver
On Thursday 12 February 2009 23:37:05 aum strut wrote: > This Error generally comes when the compilation JRE and running JRE are > not same, have you developed the code used in the Struts application and in > java application on same enviornment?? > Specifically, you get this when you compile for a platform newer than you are running on... For instance, compile with jre 1.6 with 1.6 as the target, then try to run on 1.4. You'll get the bad version # exception. -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
customize fielderror
Hi, I use struts 2.1.6, When I used , it's generated html with tag and . how to configure the component, so the html result is only plain text message (without html formating ul dan li) ? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem with MyEclipse+JDBC Driver
This Error generally comes when the compilation JRE and running JRE are not same, have you developed the code used in the Struts application and in java application on same enviornment?? and which version of struts you are using?? On Fri, Feb 13, 2009 at 9:51 AM, Narasimha Raju Naidu wrote: > Hi to all, > > I am new to MyEclipse IDE and Struts. I am developing a Login > form. In that i need to test the user entered details from Databse. My > Database is PostgreSQL. I tested with a java program and i am sucessfully > retriving data from database. But when i am trying to access from > loginForm.java of struts i am getting the following errors. > > > SEVERE: Servlet.service() for servlet action threw exception > java.lang.UnsupportedClassVersionError: Bad version number in .class file >java.lang.ClassLoader.defineClass1(Native Method) >java.lang.ClassLoader.defineClass(Unknown Source) >java.security.SecureClassLoader.defineClass(Unknown Source) > > > org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817) > > > > org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) > > > > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325) > > > > org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) > >java.lang.ClassLoader.loadClassInternal(Unknown Source) >java.lang.Class.forName0(Native Method) >java.lang.Class.forName(Unknown Source) >com.yourcompany.struts.action.LoginAction.execute(LoginAction.java:43) > > > org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) > > > > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) > >org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) >org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) >javax.servlet.http.HttpServlet.service(HttpServlet.java:710) >javax.servlet.http.HttpServlet.service(HttpServlet.java:803) > > > Can any one tell what is the exact problem and how to resolve it. I am > waiting for your valuabel replies. > > > -- > Regards, > Narasimha Raju.Naidu > Hyderabad > India > uni... >
Problem with MyEclipse+JDBC Driver
Hi to all, I am new to MyEclipse IDE and Struts. I am developing a Login form. In that i need to test the user entered details from Databse. My Database is PostgreSQL. I tested with a java program and i am sucessfully retriving data from database. But when i am trying to access from loginForm.java of struts i am getting the following errors. SEVERE: Servlet.service() for servlet action threw exception java.lang.UnsupportedClassVersionError: Bad version number in .class file java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClass(Unknown Source) java.security.SecureClassLoader.defineClass(Unknown Source) org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1817) org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1325) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) java.lang.ClassLoader.loadClassInternal(Unknown Source) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Unknown Source) com.yourcompany.struts.action.LoginAction.execute(LoginAction.java:43) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) Can any one tell what is the exact problem and how to resolve it. I am waiting for your valuabel replies. -- Regards, Narasimha Raju.Naidu Hyderabad India uni...
assign struts to a String object in JSP
Hi all, I am new to Struts and I was trying to assign struts to a String object in JSP code example: --- <%! String s = new String() %> <% s= " %><% "; %> --- this code won't work, anyone can tell me what is correct way to assign the values from to the String object. Thanks in advance. hyp
Re: Passing parameters between Actions
ryangr wrote: Is it possible to pass a parameter from one Action to another Action? For example, I have FooAction and BarAction. From BarAction's "reload" action result I want to return to FooAction but pass it a relevant id for FooAction to set upon loading. http://struts.apache.org/2.x/docs/parameters-in-configuration-results.html Dave https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3212286 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Action mapping issue while Integrating S2 and S1
SanJ.SANJAY wrote: Anyone knows what is the right place top put the struts.xml file? I think the issue with my problem stated below is that context is not able to find struts.xml file and that is the reason it is not avle to map actions. I tried putting it in WEB-INF/classes also but didn't work. That's where it belongs; you're doing something else wrong. Have you gotten a standalone S2 application to work? Are there any errors on startup? Do you have devMode turned on? Have you increased the logging levels of XWork and S2? Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Error - S 2.1.6 - Validation with xml file
jb...@pop.com.br wrote: We´re trying to upgrade struts from 2.0.11 to 2.1.6, and in actions where validation with xml file, appears the following errors. In version 2.0.11 the errors doesn´t appear. ... That's not much to go on. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: validations with selected option
Srikanth Goud wrote: Hi, Still i don't have any idea for this. Could you pls provide a solution Complex validations are generally easier to handle in an action's validate() method--it's *possible* to do via XML or annotations, but personally I find it a little unwieldy. But in the form there are Two Tables with some fields. And at a time only one table will be on page depedning on the user selected option. Written validations for all fields in the first table and second table. so, if user selects his option than for only those fields validations should fire. But here the validations are firing for the first table and second table. How should i stop the validations? You'll have to have some mechanism for determining which form elements have been filled in. Depending on how you're switching between elements it may be easiest to do this via JavaScript, setting an additional hidden value indicating which group of elements the validation should pay attention to. If only one set of forms is actually *submitted* then it can be as simple as checking for the presence of a required form parameter. If there are shared form elements that require simplistic validation it's easy to use XML- or annotation-driven validation in addition to the custom validation by calling super.validate(). Dave https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3211397 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: WARNING: Could not find action or result There is no Action mapped for namespace / and action name . - [unknown location]
From my JavaRanch response: A couple of notes: * You're missing commons-io. * Java class names should start with a capital letter, i.e., TestAction. * You should use the ng filter in 2.1.6. * Namespaces should begin with a slash ("/"). Is there anything in the log regarding a filter startup failure? Dave Ratheesh Kumar K wrote: hi , thanks 4 ur reply. But as u can see my reply to the mail (third post in this thread.), I hav attached all the jsps and configuration file. In the jsp I have given the action. Can you be more clear on your statement, taking in consideration that I am a newbie to struts. Please help me. suhas kokal wrote: Hi, This is Suhas. I have read your mail. Most probably you have not defined the action which drives the jsp. Bcos if no action is mentioned in the , defaults to the driving action. If not defined warning comes out. Thanks Suhas. --- On Thu, 12/2/09, Ratheesh Kumar K wrote: From: Ratheesh Kumar K Subject: Re: WARNING: Could not find action or result There is no Action mapped for namespace / and action name . - [unknown location] To: user@struts.apache.org Date: Thursday, 12 February, 2009, 9:41 AM Sorry for the inconvenience. Thanks for your instant response. here is the directory structure http://www.nabble.com/file/p21969639/directoryStructure.gif Following are the major configuration files: web.xml http://www.w3.org/2001/XMLSchema-instance"; xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"; id="WebApp_ID" version="2.5"> test1 t1.jsp struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* struts.xml "http://struts.apache.org/dtds/struts-2.1.dtd";> index.jsp success.jsp testAction.java package org.amrita; import com.opensymphony.xwork2.ActionSupport; public class testAction extends ActionSupport { /** * */ private static final long serialVersionUID = 1L; public String execute() { return SUCCESS; } } index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> http://www.w3.org/TR/html4/loose.dtd";> <%@ taglib uri="/struts-tags" prefix="s" %> Insert title here haiii success.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> http://www.w3.org/TR/html4/loose.dtd";> Insert title here Success !!! newton.dave wrote: AFAIK the mailing list doesn't pass through attachments, although using one of the forums might. Asking people to "go through" your application probably isn't the most effective approach--why not just post the relevant configuration and deployment information? It's probably a simple configuration or deployment issue. Dave Ratheesh Kumar K wrote: Hello All, I am a newbie to the Struts 2 framework. I started with latest version of Struts 2, i.e. Struts 2.1.6 and is strucked with the following error. I have gone through the entire forums and many other mailing list, but was not able to get it corrected. The war file for the project is attached, please go theough it and send me some solutions. Any pointers and tricks are appreciated. Please execute the war file and then comment on it, because I experimented all the tricks explained in most of the user forums. You can download the war file from http://www.fileqube.com/file/GgjLtuIij172959 here or from http://www.adrive.com/public/74896d3331b8aae51eeb1bb90e63cde126bf3d709bc8e9c932956279a2bfa6c8.html here Following are the development environment configurations: IDE: Eclipse Platform Version: 3.4.1 Build id: M20080911-1700 [Ganymede] Servelt Engine: Tomcat 6.0.18 Struts version: 2.1.6 Operating System : Windows XP Following is the error report: Feb 10, 2009 9:04:25 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn WARNING: Could not find action or result There is no Action mapped for namespace / and action name . - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
Passing parameters between Actions
Is it possible to pass a parameter from one Action to another Action? For example, I have FooAction and BarAction. From BarAction's "reload" action result I want to return to FooAction but pass it a relevant id for FooAction to set upon loading. -- View this message in context: http://www.nabble.com/Passing-parameters-between-Actions-tp21986336p21986336.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: Action mapping issue while Integrating S2 and S1
Anyone knows what is the right place top put the struts.xml file? I think the issue with my problem stated below is that context is not able to find struts.xml file and that is the reason it is not avle to map actions. I tried putting it in WEB-INF/classes also but didn't work. SanJ.SANJAY wrote: > > Thanks for the advice. I already did. > > I do not see anything wrong in the implementation its not able to read > struts.xml for some reasons > > > > > Musachy Barroso wrote: >> >> Have your tried following the tutorial/reading the >> documentation/looking at the example apps? try to understand Struts 2 >> first and then try the integration. >> >> musachy >> >> On Thu, Feb 12, 2009 at 2:24 PM, SanJ.SANJAY wrote: >>> >>> Thanks Musachy trying this says: >>> >>> There is no Action mapped for action name struts2. - [unknown location] >>>at >>> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >>>at >>> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >>>at >>> org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >>>at >>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >>>at >>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >>>at >>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >>> >>> >>> >>> >>> >>> Musachy Barroso wrote: http://localhost:8080/appcontext/struts2/reportIndex.action On Thu, Feb 12, 2009 at 2:20 PM, SanJ.SANJAY wrote: > > Sorry the exact error is below: > > There is no Action mapped for action name com/cec. - [unknown > location] >at > com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >at > com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >at > org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >at > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >at > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > > > Also in > "http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action"; > , > appcontext is my root context as I have placed appcontext.war file at > the > deploy folder of JBoss. > > > > > > > SanJ.SANJAY wrote: >> >> Procedure I followed. >> >> 1. Added all the latest jars to WEB-INF/lib >> 2. Updated web.xml >> 3. Created struts.xml under WEB-INF folder. >> 4. Defined action class in >> Now If I put S2 tags in my existing S1 jsp pages they compile fine >> and >> produce results. >> The issue that I have now is with Action mappings. My folder >> structure >> is >> like that >> >> S1: >> src/com/cec/struts/x/y/z/... >> >> S2: >> src/com/cec/struts2/actions/... >> >> Now for S1 mapping is taken care in struts-config.xml file but for S2 >> I >> update struts.xml file. >> >> I am getting error like that : >> There is no Action mapped for action name xyz >> >> I have defined my action in src/com/cec/struts2/reportIndex.java >> JSP is in web/jsp/reportIndex.jsp >> >> struts.xml file looks like this >> >> >> > extends="struts-default"> >> >> /jsp/reportIndex.jsp >> >> >> >> >> >> In the browser , I invoke application as: >> http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action >> >> And it throws error that I mentioned above. >> >> 14:12:14,875 WARN [Dispatcher] Could not find action or result There >> is >> no Action mapped for action name struts2. - [unknown location] >> at >> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >> at >> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >> at >> org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >> at >> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >> at >> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >> at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >> > > -- > View
Re: How to render a JSP/Struts2 action to send it (mail, ...)
Yes, that would be template file name. musachy On Thu, Feb 12, 2009 at 3:24 PM, Ignacio de Córdoba wrote: > > OK. Thanks for the advice. I tried to use Tiles2 because my user interface is > used with Tiles2. If I get a Tile for the email, the email received has the > same look&feel as the web pages. And I can re-use JSP/JSTL/OGNL parts. > > I'll give FreeMarker a try... just a question... in the code you sent... the > "String template" argument is just the file name of the Freemarket content > (mail.ftl) file? > > Thanks, > Ignacio > > > Musachy Barroso wrote: >> >> The thing is that neither JSP nor Tiles are designed for what you want >> to do. BTW, FreeMarker is already in your application. >> >> musachy >> >> On Thu, Feb 12, 2009 at 2:19 PM, Ignacio de Córdoba >> wrote: >>> >>> hi again, >>> thanks for your reply. I've never used FreeMaker or Velocity. I use >>> Tiles2... can you figure out if your solution can be solved with Tiles2. >>> I >>> wouldn't like to get into those, I'm sure great, technologies only for >>> this. >>> >>> Thanks, >>> Ignacio >>> >>> >>> Musachy Barroso wrote: I don't know how to fix it, but i would never use JSP for this. I would suggest you use FreeMarker or Velocity which will be very easy to get working and won't break across different containers/versions. For example, for FreeMarker (which will be in the classpath already), I use this: public static void process(ServletContext context, String template, Map values, Writer writer) throws IOException, TemplateException { Configuration cfg = new Configuration(); cfg.setDirectoryForTemplateLoading(new File(context.getRealPath("/templates"))); cfg.setObjectWrapper(new DefaultObjectWrapper()); BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); TemplateHashModel staticModels = wrapper.getStaticModels(); Template temp = cfg.getTemplate(template); temp.process(values, writer); writer.flush(); } //also JSP has not way to deal with empty spaces and such musachy On Thu, Feb 12, 2009 at 1:49 PM, Ignacio de Córdoba wrote: > > Hi there, > I had a working solution that was fine for struts1 and doesn't work > with > struts2. > The scenario is evey time the application needs to send a mail from an > action (for example, when a user signs up, the system sends him a > welcome > mail) > > My solution got the JSP the following way: > >public String getResourceAsString(String path) throws > ServletException, > IOException >{ >HttpServletRequest request = > org.apache.struts2.ServletActionContext.getRequest(); >HttpServletResponse response = > ServletActionContext.getResponse(); >try >{ >ByteArrayOutputStream out = new > ByteArrayOutputStream(); >RequestDispatcher dispatcher = > request.getRequestDispatcher(path); >RedirectingServletResponse dummyResponse = new > RedirectingServletResponse(response, out); >dispatcher.include(request, dummyResponse); >return out.toString(); >} catch (NullPointerException e) >{ >return "No such template: " + path + ""; >} >} > > (RedirectingServletResponse class just extends > HttpServletResponseWrapper > and captures output to a ByteArrayOutputStream) > > > The JSP needs a small scriptlet at its end: > <% out.flush(); %> > > Without it, the mail is sent blank as the JSP is not rendered to > HTML/text > as the request has not ended (I use the current thread request because: > 1) I > don't know how to create a brand new request/response 2) This way I can > use > all request parameters, attributes... in the mail sent and so not use > just > plain HTML but real JSP. > > The problem now is that struts2 shows the following exception: > > java.io.IOException: Stream closed > > > org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204) > > org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115) > > org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:173) > > org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:956) > > org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609) > > org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:123) > > org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:
Re: How to render a JSP/Struts2 action to send it (mail, ...)
OK. Thanks for the advice. I tried to use Tiles2 because my user interface is used with Tiles2. If I get a Tile for the email, the email received has the same look&feel as the web pages. And I can re-use JSP/JSTL/OGNL parts. I'll give FreeMarker a try... just a question... in the code you sent... the "String template" argument is just the file name of the Freemarket content (mail.ftl) file? Thanks, Ignacio Musachy Barroso wrote: > > The thing is that neither JSP nor Tiles are designed for what you want > to do. BTW, FreeMarker is already in your application. > > musachy > > On Thu, Feb 12, 2009 at 2:19 PM, Ignacio de Córdoba > wrote: >> >> hi again, >> thanks for your reply. I've never used FreeMaker or Velocity. I use >> Tiles2... can you figure out if your solution can be solved with Tiles2. >> I >> wouldn't like to get into those, I'm sure great, technologies only for >> this. >> >> Thanks, >> Ignacio >> >> >> Musachy Barroso wrote: >>> >>> I don't know how to fix it, but i would never use JSP for this. I >>> would suggest you use FreeMarker or Velocity which will be very easy >>> to get working and won't break across different containers/versions. >>> For example, for FreeMarker (which will be in the classpath already), >>> I use this: >>> >>> public static void process(ServletContext context, String template, >>> Map values, Writer writer) throws IOException, >>> TemplateException { >>> Configuration cfg = new Configuration(); >>> cfg.setDirectoryForTemplateLoading(new >>> File(context.getRealPath("/templates"))); >>> cfg.setObjectWrapper(new DefaultObjectWrapper()); >>> >>> BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); >>> TemplateHashModel staticModels = wrapper.getStaticModels(); >>> Template temp = cfg.getTemplate(template); >>> temp.process(values, writer); >>> writer.flush(); >>> } >>> >>> //also JSP has not way to deal with empty spaces and such >>> >>> musachy >>> >>> On Thu, Feb 12, 2009 at 1:49 PM, Ignacio de Córdoba >>> wrote: Hi there, I had a working solution that was fine for struts1 and doesn't work with struts2. The scenario is evey time the application needs to send a mail from an action (for example, when a user signs up, the system sends him a welcome mail) My solution got the JSP the following way: public String getResourceAsString(String path) throws ServletException, IOException { HttpServletRequest request = org.apache.struts2.ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); RequestDispatcher dispatcher = request.getRequestDispatcher(path); RedirectingServletResponse dummyResponse = new RedirectingServletResponse(response, out); dispatcher.include(request, dummyResponse); return out.toString(); } catch (NullPointerException e) { return "No such template: " + path + ""; } } (RedirectingServletResponse class just extends HttpServletResponseWrapper and captures output to a ByteArrayOutputStream) The JSP needs a small scriptlet at its end: <% out.flush(); %> Without it, the mail is sent blank as the JSP is not rendered to HTML/text as the request has not ended (I use the current thread request because: 1) I don't know how to create a brand new request/response 2) This way I can use all request parameters, attributes... in the mail sent and so not use just plain HTML but real JSP. The problem now is that struts2 shows the following exception: java.io.IOException: Stream closed org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204) org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115) org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:173) org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:956) org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609) org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:123) org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265) com.servengine.struts2.Inje
Re: Action mapping issue while Integrating S2 and S1
Thanks for the advice. I already did. I do not see anything wrong in the implementation its not able to read struts.xml for some reasons Musachy Barroso wrote: > > Have your tried following the tutorial/reading the > documentation/looking at the example apps? try to understand Struts 2 > first and then try the integration. > > musachy > > On Thu, Feb 12, 2009 at 2:24 PM, SanJ.SANJAY wrote: >> >> Thanks Musachy trying this says: >> >> There is no Action mapped for action name struts2. - [unknown location] >>at >> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >>at >> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >>at >> org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >>at >> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >>at >> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >>at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >> >> >> >> >> >> Musachy Barroso wrote: >>> >>> http://localhost:8080/appcontext/struts2/reportIndex.action >>> >>> >>> On Thu, Feb 12, 2009 at 2:20 PM, SanJ.SANJAY >>> wrote: Sorry the exact error is below: There is no Action mapped for action name com/cec. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) at org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) Also in "http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action"; , appcontext is my root context as I have placed appcontext.war file at the deploy folder of JBoss. SanJ.SANJAY wrote: > > Procedure I followed. > > 1. Added all the latest jars to WEB-INF/lib > 2. Updated web.xml > 3. Created struts.xml under WEB-INF folder. > 4. Defined action class in > Now If I put S2 tags in my existing S1 jsp pages they compile fine and > produce results. > The issue that I have now is with Action mappings. My folder structure > is > like that > > S1: > src/com/cec/struts/x/y/z/... > > S2: > src/com/cec/struts2/actions/... > > Now for S1 mapping is taken care in struts-config.xml file but for S2 > I > update struts.xml file. > > I am getting error like that : > There is no Action mapped for action name xyz > > I have defined my action in src/com/cec/struts2/reportIndex.java > JSP is in web/jsp/reportIndex.jsp > > struts.xml file looks like this > > > extends="struts-default"> > > /jsp/reportIndex.jsp > > > > > > In the browser , I invoke application as: > http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action > > And it throws error that I mentioned above. > > 14:12:14,875 WARN [Dispatcher] Could not find action or result There > is > no Action mapped for action name struts2. - [unknown location] > at > com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) > at > com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) > at > org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) > at > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) > at > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) > -- View this message in context: http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-and-S1-tp21982941p21983003.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 >>> >>> >>> >>> -- >>> "Hey you! Would you help me to carry th
Re: Action mapping issue while Integrating S2 and S1
Have your tried following the tutorial/reading the documentation/looking at the example apps? try to understand Struts 2 first and then try the integration. musachy On Thu, Feb 12, 2009 at 2:24 PM, SanJ.SANJAY wrote: > > Thanks Musachy trying this says: > > There is no Action mapped for action name struts2. - [unknown location] >at > com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >at > com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >at > org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >at > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >at > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) > > > > > > Musachy Barroso wrote: >> >> http://localhost:8080/appcontext/struts2/reportIndex.action >> >> >> On Thu, Feb 12, 2009 at 2:20 PM, SanJ.SANJAY wrote: >>> >>> Sorry the exact error is below: >>> >>> There is no Action mapped for action name com/cec. - [unknown location] >>>at >>> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >>>at >>> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >>>at >>> org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >>>at >>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >>>at >>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >>>at >>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >>>at >>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) >>> >>> >>> Also in >>> "http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action"; , >>> appcontext is my root context as I have placed appcontext.war file at the >>> deploy folder of JBoss. >>> >>> >>> >>> >>> >>> >>> SanJ.SANJAY wrote: Procedure I followed. 1. Added all the latest jars to WEB-INF/lib 2. Updated web.xml 3. Created struts.xml under WEB-INF folder. 4. Defined action class in Now If I put S2 tags in my existing S1 jsp pages they compile fine and produce results. The issue that I have now is with Action mappings. My folder structure is like that S1: src/com/cec/struts/x/y/z/... S2: src/com/cec/struts2/actions/... Now for S1 mapping is taken care in struts-config.xml file but for S2 I update struts.xml file. I am getting error like that : There is no Action mapped for action name xyz I have defined my action in src/com/cec/struts2/reportIndex.java JSP is in web/jsp/reportIndex.jsp struts.xml file looks like this >>> extends="struts-default"> /jsp/reportIndex.jsp In the browser , I invoke application as: http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action And it throws error that I mentioned above. 14:12:14,875 WARN [Dispatcher] Could not find action or result There is no Action mapped for action name struts2. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) at org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-and-S1-tp21982941p21983003.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 >>> >>> >> >> >> >> -- >> "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 >> >> >> > > -- > View this message in context: > http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-an
Re: How to render a JSP/Struts2 action to send it (mail, ...)
The thing is that neither JSP nor Tiles are designed for what you want to do. BTW, FreeMarker is already in your application. musachy On Thu, Feb 12, 2009 at 2:19 PM, Ignacio de Córdoba wrote: > > hi again, > thanks for your reply. I've never used FreeMaker or Velocity. I use > Tiles2... can you figure out if your solution can be solved with Tiles2. I > wouldn't like to get into those, I'm sure great, technologies only for this. > > Thanks, > Ignacio > > > Musachy Barroso wrote: >> >> I don't know how to fix it, but i would never use JSP for this. I >> would suggest you use FreeMarker or Velocity which will be very easy >> to get working and won't break across different containers/versions. >> For example, for FreeMarker (which will be in the classpath already), >> I use this: >> >> public static void process(ServletContext context, String template, >> Map values, Writer writer) throws IOException, >> TemplateException { >> Configuration cfg = new Configuration(); >> cfg.setDirectoryForTemplateLoading(new >> File(context.getRealPath("/templates"))); >> cfg.setObjectWrapper(new DefaultObjectWrapper()); >> >> BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); >> TemplateHashModel staticModels = wrapper.getStaticModels(); >> Template temp = cfg.getTemplate(template); >> temp.process(values, writer); >> writer.flush(); >> } >> >> //also JSP has not way to deal with empty spaces and such >> >> musachy >> >> On Thu, Feb 12, 2009 at 1:49 PM, Ignacio de Córdoba >> wrote: >>> >>> Hi there, >>> I had a working solution that was fine for struts1 and doesn't work with >>> struts2. >>> The scenario is evey time the application needs to send a mail from an >>> action (for example, when a user signs up, the system sends him a welcome >>> mail) >>> >>> My solution got the JSP the following way: >>> >>>public String getResourceAsString(String path) throws >>> ServletException, >>> IOException >>>{ >>>HttpServletRequest request = >>> org.apache.struts2.ServletActionContext.getRequest(); >>>HttpServletResponse response = >>> ServletActionContext.getResponse(); >>>try >>>{ >>>ByteArrayOutputStream out = new >>> ByteArrayOutputStream(); >>>RequestDispatcher dispatcher = >>> request.getRequestDispatcher(path); >>>RedirectingServletResponse dummyResponse = new >>> RedirectingServletResponse(response, out); >>>dispatcher.include(request, dummyResponse); >>>return out.toString(); >>>} catch (NullPointerException e) >>>{ >>>return "No such template: " + path + ""; >>>} >>>} >>> >>> (RedirectingServletResponse class just extends HttpServletResponseWrapper >>> and captures output to a ByteArrayOutputStream) >>> >>> >>> The JSP needs a small scriptlet at its end: >>> <% out.flush(); %> >>> >>> Without it, the mail is sent blank as the JSP is not rendered to >>> HTML/text >>> as the request has not ended (I use the current thread request because: >>> 1) I >>> don't know how to create a brand new request/response 2) This way I can >>> use >>> all request parameters, attributes... in the mail sent and so not use >>> just >>> plain HTML but real JSP. >>> >>> The problem now is that struts2 shows the following exception: >>> >>> java.io.IOException: Stream closed >>> >>> >>> org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204) >>> >>> org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115) >>>org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:173) >>> >>> org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:956) >>> >>> org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609) >>> >>> org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:123) >>> >>> org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) >>> >>> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361) >>> >>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265) >>> >>> com.servengine.struts2.InjectEJBInterceptor.intercept(InjectEJBInterceptor.java:89) >>> >>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) >>> >>> org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) >>> >>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) >>> >>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >>> >>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) >>> >>> org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati
Re: Action mapping issue while Integrating S2 and S1
Thanks Musachy trying this says: There is no Action mapped for action name struts2. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) at org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) Musachy Barroso wrote: > > http://localhost:8080/appcontext/struts2/reportIndex.action > > > On Thu, Feb 12, 2009 at 2:20 PM, SanJ.SANJAY wrote: >> >> Sorry the exact error is below: >> >> There is no Action mapped for action name com/cec. - [unknown location] >>at >> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >>at >> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >>at >> org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >>at >> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >>at >> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >>at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >>at >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) >> >> >> Also in >> "http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action"; , >> appcontext is my root context as I have placed appcontext.war file at the >> deploy folder of JBoss. >> >> >> >> >> >> >> SanJ.SANJAY wrote: >>> >>> Procedure I followed. >>> >>> 1. Added all the latest jars to WEB-INF/lib >>> 2. Updated web.xml >>> 3. Created struts.xml under WEB-INF folder. >>> 4. Defined action class in >>> Now If I put S2 tags in my existing S1 jsp pages they compile fine and >>> produce results. >>> The issue that I have now is with Action mappings. My folder structure >>> is >>> like that >>> >>> S1: >>> src/com/cec/struts/x/y/z/... >>> >>> S2: >>> src/com/cec/struts2/actions/... >>> >>> Now for S1 mapping is taken care in struts-config.xml file but for S2 I >>> update struts.xml file. >>> >>> I am getting error like that : >>> There is no Action mapped for action name xyz >>> >>> I have defined my action in src/com/cec/struts2/reportIndex.java >>> JSP is in web/jsp/reportIndex.jsp >>> >>> struts.xml file looks like this >>> >>> >>> >> extends="struts-default"> >>> >>> /jsp/reportIndex.jsp >>> >>> >>> >>> >>> >>> In the browser , I invoke application as: >>> http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action >>> >>> And it throws error that I mentioned above. >>> >>> 14:12:14,875 WARN [Dispatcher] Could not find action or result There is >>> no Action mapped for action name struts2. - [unknown location] >>> at >>> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >>> at >>> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >>> at >>> org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >>> at >>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >>> at >>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >>> at >>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-and-S1-tp21982941p21983003.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 >> >> > > > > -- > "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 > > > -- View this message in context: http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-and-S1-tp21982941p21983088.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: Action mapping issue while Integrating S2 and S1
http://localhost:8080/appcontext/struts2/reportIndex.action On Thu, Feb 12, 2009 at 2:20 PM, SanJ.SANJAY wrote: > > Sorry the exact error is below: > > There is no Action mapped for action name com/cec. - [unknown location] >at > com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >at > com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >at > org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >at > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >at > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) > > > Also in > "http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action"; , > appcontext is my root context as I have placed appcontext.war file at the > deploy folder of JBoss. > > > > > > > SanJ.SANJAY wrote: >> >> Procedure I followed. >> >> 1. Added all the latest jars to WEB-INF/lib >> 2. Updated web.xml >> 3. Created struts.xml under WEB-INF folder. >> 4. Defined action class in >> Now If I put S2 tags in my existing S1 jsp pages they compile fine and >> produce results. >> The issue that I have now is with Action mappings. My folder structure is >> like that >> >> S1: >> src/com/cec/struts/x/y/z/... >> >> S2: >> src/com/cec/struts2/actions/... >> >> Now for S1 mapping is taken care in struts-config.xml file but for S2 I >> update struts.xml file. >> >> I am getting error like that : >> There is no Action mapped for action name xyz >> >> I have defined my action in src/com/cec/struts2/reportIndex.java >> JSP is in web/jsp/reportIndex.jsp >> >> struts.xml file looks like this >> >> >> >> >> /jsp/reportIndex.jsp >> >> >> >> >> >> In the browser , I invoke application as: >> http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action >> >> And it throws error that I mentioned above. >> >> 14:12:14,875 WARN [Dispatcher] Could not find action or result There is >> no Action mapped for action name struts2. - [unknown location] at >> com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) >> at >> com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) >> at >> org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) >> at >> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) >> at >> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >> at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) >> > > -- > View this message in context: > http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-and-S1-tp21982941p21983003.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 > > -- "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: Action mapping issue while Integrating S2 and S1
Sorry the exact error is below: There is no Action mapped for action name com/cec. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) at org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) Also in "http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action"; , appcontext is my root context as I have placed appcontext.war file at the deploy folder of JBoss. SanJ.SANJAY wrote: > > Procedure I followed. > > 1. Added all the latest jars to WEB-INF/lib > 2. Updated web.xml > 3. Created struts.xml under WEB-INF folder. > 4. Defined action class in > Now If I put S2 tags in my existing S1 jsp pages they compile fine and > produce results. > The issue that I have now is with Action mappings. My folder structure is > like that > > S1: > src/com/cec/struts/x/y/z/... > > S2: > src/com/cec/struts2/actions/... > > Now for S1 mapping is taken care in struts-config.xml file but for S2 I > update struts.xml file. > > I am getting error like that : > There is no Action mapped for action name xyz > > I have defined my action in src/com/cec/struts2/reportIndex.java > JSP is in web/jsp/reportIndex.jsp > > struts.xml file looks like this > > > > > /jsp/reportIndex.jsp > > > > > > In the browser , I invoke application as: > http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action > > And it throws error that I mentioned above. > > 14:12:14,875 WARN [Dispatcher] Could not find action or result There is > no Action mapped for action name struts2. - [unknown location] at > com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) > > at > com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) > > at > org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) > > at > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) > > at > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) > -- View this message in context: http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-and-S1-tp21982941p21983003.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 render a JSP/Struts2 action to send it (mail, ...)
hi again, thanks for your reply. I've never used FreeMaker or Velocity. I use Tiles2... can you figure out if your solution can be solved with Tiles2. I wouldn't like to get into those, I'm sure great, technologies only for this. Thanks, Ignacio Musachy Barroso wrote: > > I don't know how to fix it, but i would never use JSP for this. I > would suggest you use FreeMarker or Velocity which will be very easy > to get working and won't break across different containers/versions. > For example, for FreeMarker (which will be in the classpath already), > I use this: > > public static void process(ServletContext context, String template, > Map values, Writer writer) throws IOException, > TemplateException { > Configuration cfg = new Configuration(); > cfg.setDirectoryForTemplateLoading(new > File(context.getRealPath("/templates"))); > cfg.setObjectWrapper(new DefaultObjectWrapper()); > > BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); > TemplateHashModel staticModels = wrapper.getStaticModels(); > Template temp = cfg.getTemplate(template); > temp.process(values, writer); > writer.flush(); > } > > //also JSP has not way to deal with empty spaces and such > > musachy > > On Thu, Feb 12, 2009 at 1:49 PM, Ignacio de Córdoba > wrote: >> >> Hi there, >> I had a working solution that was fine for struts1 and doesn't work with >> struts2. >> The scenario is evey time the application needs to send a mail from an >> action (for example, when a user signs up, the system sends him a welcome >> mail) >> >> My solution got the JSP the following way: >> >>public String getResourceAsString(String path) throws >> ServletException, >> IOException >>{ >>HttpServletRequest request = >> org.apache.struts2.ServletActionContext.getRequest(); >>HttpServletResponse response = >> ServletActionContext.getResponse(); >>try >>{ >>ByteArrayOutputStream out = new >> ByteArrayOutputStream(); >>RequestDispatcher dispatcher = >> request.getRequestDispatcher(path); >>RedirectingServletResponse dummyResponse = new >> RedirectingServletResponse(response, out); >>dispatcher.include(request, dummyResponse); >>return out.toString(); >>} catch (NullPointerException e) >>{ >>return "No such template: " + path + ""; >>} >>} >> >> (RedirectingServletResponse class just extends HttpServletResponseWrapper >> and captures output to a ByteArrayOutputStream) >> >> >> The JSP needs a small scriptlet at its end: >> <% out.flush(); %> >> >> Without it, the mail is sent blank as the JSP is not rendered to >> HTML/text >> as the request has not ended (I use the current thread request because: >> 1) I >> don't know how to create a brand new request/response 2) This way I can >> use >> all request parameters, attributes... in the mail sent and so not use >> just >> plain HTML but real JSP. >> >> The problem now is that struts2 shows the following exception: >> >> java.io.IOException: Stream closed >> >> >> org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204) >> >> org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115) >>org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:173) >> >> org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:956) >> >> org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609) >> >> org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:123) >> >> org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) >> >> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361) >> >> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265) >> >> com.servengine.struts2.InjectEJBInterceptor.intercept(InjectEJBInterceptor.java:89) >> >> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) >> >> org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) >> >> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) >> >> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) >> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) >> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206 >> >> Any ideas on this... or better... any directions on how can I instanciate >> a >> "fake" response not based on current struts2 Action ServletResponse >> object >> (and so flush() or close() will not affect it). >> >> Thanks, >> Ignacio >> -- >> View this message in context: >> http://www.nabb
Action mapping issue while Integrating S2 and S1
Procedure I followed. 1. Added all the latest jars to WEB-INF/lib 2. Updated web.xml 3. Created struts.xml under WEB-INF folder. 4. Defined action class in Now If I put S2 tags in my existing S1 jsp pages they compile fine and produce results. The issue that I have now is with Action mappings. My folder structure is like that S1: src/com/cec/struts/x/y/z/... S2: src/com/cec/struts2/actions/... Now for S1 mapping is taken care in struts-config.xml file but for S2 I update struts.xml file. I am getting error like that : There is no Action mapped for action name xyz I have defined my action in src/com/cec/struts2/reportIndex.java JSP is in web/jsp/reportIndex.jsp struts.xml file looks like this /jsp/reportIndex.jsp In the browser , I invoke application as: http://localhost:8080/appcontext/com/cec/struts2/reportIndex.action And it throws error that I mentioned above. 14:12:14,875 WARN [Dispatcher] Could not find action or result There is no Action mapped for action name struts2. - [unknown location] at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:177) at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:59) at org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:40) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:458) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) -- View this message in context: http://www.nabble.com/Action-mapping-issue-while-Integrating-S2-and-S1-tp21982941p21982941.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 render a JSP/Struts2 action to send it (mail, ...)
I don't know how to fix it, but i would never use JSP for this. I would suggest you use FreeMarker or Velocity which will be very easy to get working and won't break across different containers/versions. For example, for FreeMarker (which will be in the classpath already), I use this: public static void process(ServletContext context, String template, Map values, Writer writer) throws IOException, TemplateException { Configuration cfg = new Configuration(); cfg.setDirectoryForTemplateLoading(new File(context.getRealPath("/templates"))); cfg.setObjectWrapper(new DefaultObjectWrapper()); BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); TemplateHashModel staticModels = wrapper.getStaticModels(); Template temp = cfg.getTemplate(template); temp.process(values, writer); writer.flush(); } //also JSP has not way to deal with empty spaces and such musachy On Thu, Feb 12, 2009 at 1:49 PM, Ignacio de Córdoba wrote: > > Hi there, > I had a working solution that was fine for struts1 and doesn't work with > struts2. > The scenario is evey time the application needs to send a mail from an > action (for example, when a user signs up, the system sends him a welcome > mail) > > My solution got the JSP the following way: > >public String getResourceAsString(String path) throws ServletException, > IOException >{ >HttpServletRequest request = > org.apache.struts2.ServletActionContext.getRequest(); >HttpServletResponse response = > ServletActionContext.getResponse(); >try >{ >ByteArrayOutputStream out = new > ByteArrayOutputStream(); >RequestDispatcher dispatcher = > request.getRequestDispatcher(path); >RedirectingServletResponse dummyResponse = new > RedirectingServletResponse(response, out); >dispatcher.include(request, dummyResponse); >return out.toString(); >} catch (NullPointerException e) >{ >return "No such template: " + path + ""; >} >} > > (RedirectingServletResponse class just extends HttpServletResponseWrapper > and captures output to a ByteArrayOutputStream) > > > The JSP needs a small scriptlet at its end: > <% out.flush(); %> > > Without it, the mail is sent blank as the JSP is not rendered to HTML/text > as the request has not ended (I use the current thread request because: 1) I > don't know how to create a brand new request/response 2) This way I can use > all request parameters, attributes... in the mail sent and so not use just > plain HTML but real JSP. > > The problem now is that struts2 shows the following exception: > > java.io.IOException: Stream closed > > > org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204) > > org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115) >org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:173) > > org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:956) > > org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609) > > org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:123) > > org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) > > com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361) > > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265) > > com.servengine.struts2.InjectEJBInterceptor.intercept(InjectEJBInterceptor.java:89) > > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) > > org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) > > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) > > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) > > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) > > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206 > > Any ideas on this... or better... any directions on how can I instanciate a > "fake" response not based on current struts2 Action ServletResponse object > (and so flush() or close() will not affect it). > > Thanks, > Ignacio > -- > View this message in context: > http://www.nabble.com/How-to-render-a-JSP-Struts2-action-to-send-it-%28mail%2C-...%29-tp21982445p21982445.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 > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd
How to render a JSP/Struts2 action to send it (mail, ...)
Hi there, I had a working solution that was fine for struts1 and doesn't work with struts2. The scenario is evey time the application needs to send a mail from an action (for example, when a user signs up, the system sends him a welcome mail) My solution got the JSP the following way: public String getResourceAsString(String path) throws ServletException, IOException { HttpServletRequest request = org.apache.struts2.ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); RequestDispatcher dispatcher = request.getRequestDispatcher(path); RedirectingServletResponse dummyResponse = new RedirectingServletResponse(response, out); dispatcher.include(request, dummyResponse); return out.toString(); } catch (NullPointerException e) { return "No such template: " + path + ""; } } (RedirectingServletResponse class just extends HttpServletResponseWrapper and captures output to a ByteArrayOutputStream) The JSP needs a small scriptlet at its end: <% out.flush(); %> Without it, the mail is sent blank as the JSP is not rendered to HTML/text as the request has not ended (I use the current thread request because: 1) I don't know how to create a brand new request/response 2) This way I can use all request parameters, attributes... in the mail sent and so not use just plain HTML but real JSP. The problem now is that struts2 shows the following exception: java.io.IOException: Stream closed org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204) org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115) org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:173) org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:956) org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:609) org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:123) org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:361) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:265) com.servengine.struts2.InjectEJBInterceptor.intercept(InjectEJBInterceptor.java:89) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206 Any ideas on this... or better... any directions on how can I instanciate a "fake" response not based on current struts2 Action ServletResponse object (and so flush() or close() will not affect it). Thanks, Ignacio -- View this message in context: http://www.nabble.com/How-to-render-a-JSP-Struts2-action-to-send-it-%28mail%2C-...%29-tp21982445p21982445.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: Convention Plugin problem
I added a new constant "struts.convention.action.fileProtocols" so we can cover these weird app server cases. You can now set: let me know if it works for you. (committed to trunk) musachy On Tue, Jan 27, 2009 at 3:08 PM, Pennel,Paul T wrote: > Love the hack idea, well for a hack anyway. Unfortunately it didn't > work, at least not by itself. However we did find an even bigger 2 part > hack that does work. > > Apparently weblogic's classloader uses jar:file:/ for everything in the > classpath and zip: for everything in WEB-INF/lib. Based on this when you > ask it for every jar with META-INF it doesn't even look at our jar. So > our two part hack was > > 1. Add the META-INF directory to our classes directory to make it look > like a .jar file > 2. Change com.opensymphony.xwork2.util.finder.Url set to look for both > jarfile:/ and zip: To do this the getUrl method was changed to replace > zip: to jar:file:/ as you can see in the bolded lines below. > > Apparently tomcat treats items in WEB-INF/lib as jar:file:/ while > weblogic treats them as zip:. > > private static List getUrls(ClassLoader classLoader) throws > IOException { >List list = new ArrayList(); >ArrayList urls = > Collections.list(classLoader.getResources("META-INF")); >for (URL url : urls) { >String externalForm = url.toExternalForm(); >int i = externalForm.lastIndexOf("META-INF"); >externalForm = externalForm.substring(0, i); >if (externalForm.startsWith("zip:")) { >externalForm = externalForm.replace("zip:", > "jar:file:/"); >} >url = new URL(externalForm); >list.add(url); >} >list.addAll(Collections.list(classLoader.getResources(""))); >return list; >} > > > > If you are not the intended recipient of this message (including > attachments), or if you have received this message in error, immediately > notify us and delete it and any attachments. If you no longer wish to > receive e-mail from Edward Jones, please send this request to > messa...@edwardjones.com. You must include the e-mail address that you wish > not to receive e-mail communications. For important additional information > related to this e-mail, visit www.edwardjones.com/US_email_disclosure > > -Original Message- > > > From: Musachy Barroso [mailto:musa...@gmail.com] > Sent: Tuesday, January 27, 2009 12:32 PM > To: Struts Users Mailing List > Subject: Re: Convention Plugin problem > > Hack ahead. If you add a "META-INF" dir to your classes dir, maybe > weblogic will (be dumb enough and) package it with the .class files > inside the magic jar. > > musachy > > On Tue, Jan 27, 2009 at 1:26 PM, Pennel,Paul T > wrote: >> We've looked around and haven't found away to stop it from >> interfering, doesn't mean there isn't a way, we just don't know of > any. >> >> >> >> If you are not the intended recipient of this message (including >> attachments), or if you have received this message in error, >> immediately notify us and delete it and any attachments. If you no >> longer wish to receive e-mail from Edward Jones, please send this >> request to messa...@edwardjones.com. You must include the e-mail >> address that you wish not to receive e-mail communications. For >> important additional information related to this e-mail, visit >> www.edwardjones.com/US_email_disclosure >> >> -Original Message- >> >> >> From: Musachy Barroso [mailto:musa...@gmail.com] >> Sent: Tuesday, January 27, 2009 12:21 PM >> To: Struts Users Mailing List >> Subject: Re: Convention Plugin problem >> >> Is there any way to tell weblogic not to mess with your class files >> and just leave them where they are inside the war? Why do app servers >> need to do everything so complicated? >> >> musachy >> >> On Tue, Jan 27, 2009 at 1:11 PM, Pennel,Paul T >> wrote: >>> It appears we have learned a little more. Convention calls the xworks > >>> file com.opensymphony.xwork2.util.finder.UrlSet which does a >>> ClassLoader.getResource("META-INF") in the getURLs method. However >>> when weblogic creates the _wl_cls_gen.jar it does not add a META-INF >>> directory so that jar file is passed over by Convention. So in >>> debugging we saw it find our jar but pass it over because of the lack > >>> of META-INF directory. >>> >>> We are using xwork 2.1.2 >>> >>> It seems like struts 2's convention/xwork2 and weblogic 10 are not >>> playing nice together. Any ideas on solving this? >>> >>> >>> >>> >>> If you are not the intended recipient of this message (including >>> attachments), or if you have received this message in error, >>> immediately notify us and delete it and any attachments. If you no >>> longer wish to receive e-mail from Edward Jones, please send this >>> request to messa...@edwardjones.com. You must include the e-mail >>> address that you wish not to receive e-mail communications. For >>> important additional information rela
Error - S 2.1.6 - Validation with xml file
We´re trying to upgrade struts from 2.0.11 to 2.1.6, and in actions where validation with xml file, appears the following errors. In version 2.0.11 the errors doesn´t appear. java.lang.NoSuchMethodException: gov.pr.cohapar.admin.licitacao.action.TipoHistoricoAction.crud() java.lang.Class.getMethod(Class.java:1605) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:148) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:76) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:65) gov.pr.celepar.sentinela.client.SegurancaFilter.doFilter(SegurancaFilter.java:459) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Re: Using Struts 2 native dependency injection
> There are warnings from time to time that we don't expose the details > of the internal DI because we want to reserve the right to change the > inner workings. If you are familiar with Spring, go ahead and use it, > despite all of the available features, it will only bring in what you > want to use... If you like the @Inject annotation, there is also a > GUICE plugin that works pretty well. Guice is easy to learn and quick > to implement. Of course. I guess I was just scratching an itch :) I wouldn't use the Struts internal stuff on a substantial project. But, it is good to know that this option exists. I was just putting together a simple Configuration UI for an application, where most of the actions needed one service to be injected, which is done in a single parent class. If the internal DI is ever changed, it will be quick enough to fix it in that one place. Thanks for the warning. I should make sure that I don't suggest doing this to anyone else. Cheers, Sonny - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Returning request parameters in action class... How?
Sonny, Great. Thanks for the reply. - Peter -- View this message in context: http://www.nabble.com/Returning-request-parameters-in-action-class...-How--tp21977049p21978514.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: Returning request parameters in action class... How?
Unless you are using a redirect, the JSP already has access to that parameter since it is still the same request. If you are using JSTL, you can access it as ${param.mode}. Some people prefer not to access request parameters directly in JSPs, which is a good thing IMO. In that case, you can create the same field in the Action class, Struts will set it from the request parameter, then you can access it using Struts tags, for examle . HTH Sonny On Thu, Feb 12, 2009 at 10:23 PM, plen wrote: > > Hello, > > I have an action class which might get a request parameter when called (ex. > request.getParameter("mode")). When the action class returns SUCCESS which > ends up calling a JSP, I need to be able to send that request parameter on > to the JSP. I believe I could just use the request.setAttribute("mode", > mode) in the action class and then have the JSP do a getAttribute, but it > seems that Struts must already have a way of doing this. So, the question > is "how do you pass parameters from the action class to the JSP"? > > Any thoughts? > > Thanks - Peter Len > -- > View this message in context: > http://www.nabble.com/Returning-request-parameters-in-action-class...-How--tp21977049p21977049.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: submitting a form without a submit button ajax-style
Musachy Barroso wrote: > 2.1.6 is GA :) > DOH! hadn't checked in a while, obviously... - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Returning request parameters in action class... How?
Hello, I have an action class which might get a request parameter when called (ex. request.getParameter("mode")). When the action class returns SUCCESS which ends up calling a JSP, I need to be able to send that request parameter on to the JSP. I believe I could just use the request.setAttribute("mode", mode) in the action class and then have the JSP do a getAttribute, but it seems that Struts must already have a way of doing this. So, the question is "how do you pass parameters from the action class to the JSP"? Any thoughts? Thanks - Peter Len -- View this message in context: http://www.nabble.com/Returning-request-parameters-in-action-class...-How--tp21977049p21977049.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
struts.i18n.reload problem
I am looking to learn struts and just downloaded the latest copy (2.1.6). I installed the example blank application in a copy of tomcat I already had running (6.0.14) and its runs successfully. However I have been "playing" with it including changing the properties files, but I can't get them to automatically reload (I reinsatlled a fresh copy of the example in trying to solve this). In looking through the docs it seems like setting either struts.devMode or struts.i18n.reload to true should accomplish this. I have tried numerous combinations of these along with struts.configuration.xml.reload, both in the WEB-INF/classes/struts.xml file: I also tried creating a struts.properties file in the same directory with struts.devMode = true struts.i18n.reload = true but when I attempt to change one of the entries in WEB-INF/classes/example/package.properties (or the _es file) it doesn't seem to be picked up (unless the web-app/server is restarted). Not sure if there is some other configuration I am missing, or if it is getting overridden by another property/ configuration file. Any ideas would be appreciated. -- View this message in context: http://www.nabble.com/struts.i18n.reload-problem-tp21976933p21976933.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: Using Struts 2 native dependency injection
On Thu, Feb 12, 2009 at 7:47 AM, Sonny Gill wrote: > That's partly the reason I was trying to do this. > With Guice already included in Struts, it somehow feels wrong to add > Spring just for very basic DI. > > Sonny There are warnings from time to time that we don't expose the details of the internal DI because we want to reserve the right to change the inner workings. If you are familiar with Spring, go ahead and use it, despite all of the available features, it will only bring in what you want to use... If you like the @Inject annotation, there is also a GUICE plugin that works pretty well. Guice is easy to learn and quick to implement. -- 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: validations with selected option
Hi, Still i don't have any idea for this. Could you pls provide a solution Srikanth Srikanth Goud wrote: > > Hi Friends, > >Iam writing validations in className-validation.xml file it is working > fine. > >But in the form there are Two Tables with some fields. And at a time > only one table will be on page depedning on the user selected option. > Written validations for all fields in the first table and second table. > > so, if user selects his option than for only those fields validations > should fire. > But here the validations are firing for the first table and second table. > How should i stop the validations? > > > > > Srikanth > -- View this message in context: http://www.nabble.com/validations-with-selected-option-tp21885572p21976047.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: Using Struts 2 native dependency injection
That's partly the reason I was trying to do this. With Guice already included in Struts, it somehow feels wrong to add Spring just for very basic DI. Sonny On Thu, Feb 12, 2009 at 8:18 PM, Wes Wannemacher wrote: > It's part of Struts, we're using a custom/hacked/forked version of Guice > within XWork. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Using Struts 2 native dependency injection
On Thursday 12 February 2009 06:08:59 Ddlc wrote: > Is that @Inject annotation part of Struts 2? > > Or are you using something like, for example, Guice? It's part of Struts, we're using a custom/hacked/forked version of Guice within XWork. -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
Load a struts.xml that is not on the classpath
Hi, My app is using the Java Plugin Framework (JPF) to provide plugin functionality. The plugins for my app are not on the classpath as the JPF manages that itself. My plugins have a struts.xml file in them and I would like to be able to load the struts.xml from the plugin into my main app. This of course needs to be done at runtime as I don't know which plugin exist in my app until my PluginManager starts up. I have been trying this but can't really piece things together: Dispatcher dispatcher = new Dispatcher(servletContext , new java.util.HashMap()); ConfigurationManager configurationManager = new ConfigurationManager("pluginManager"); StrutsXmlConfigurationProvider strutsXmlConfigurationProvider = new StrutsXmlConfigurationProvider(pluginDescriptor.getLocation().getPath() + File.separator + "struts.xml" , false , servletContext); dispatcher.setConfigurationManager(configurationManager); dispatcher.init(); This seems to load the includes files that I specify in the plugins struts.xml file but oddly, the Struts framework does not seem to know about them and I get an error: No result defined for action If anyone can provide a pointer then it would be appreciated. -- View this message in context: http://www.nabble.com/Load-a-struts.xml-that-is-not-on-the-classpath-tp21974673p21974673.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: Using Struts 2 native dependency injection
Is that @Inject annotation part of Struts 2? Or are you using something like, for example, Guice? -- View this message in context: http://www.nabble.com/Using-Struts-2-native-dependency-injection-tp21970139p21973978.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