Re: passing form parameters to a custom validator
Did it this way. Passed field names via the tag, then obtained values inside the validator class using getFieldValue(fieldName, object). Thank you for suggestions. stanlick wrote: > > Rather than pass this, that and the other parameter(s) to your validator, > why not just retrieve what you need from inside the validator? You have > the > ActionInvocation passed to your doIntercept(...), which contains the > ValueStack containing your objects. > > Peace, > Scott > > > > On Tue, May 19, 2009 at 7:59 AM, manub wrote: > >> >> Hi all, >> >> I'm trying to write a custom field validator which needs other fields to >> validate the field I need to validate. How can I pass field values (and >> not >> static params) to a field validator in the validation xml? I'm using >> Struts >> 2.1.6. >> >> Thank you. >> -- >> View this message in context: >> http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23615918.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 >> >> > > -- View this message in context: http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23651619.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: passing form parameters to a custom validator
I think that this may work for the expression validator because you are supplying an expression. Maybe I need to use an expression too, but I don't know how to evaluate it within my Java class for Validator. Lukasz Lenart wrote: > > 2009/5/20 manub : >> I've written a custom field validator, which needs other field values to >> validate his field. I need a way to pass that values to that field >> validator. > > Did you try to use param tag as below? > > > > $...@pl.org.lenart.ems.model.employeetype@.value() > != 'dd'} > error.employee.type.required > > > > > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23649333.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: passing form parameters to a custom validator
Lukasz Lenart wrote: > > Frankly, I don't understand, are you trying to pass data from > validator xml configuration to action? > I've written a custom field validator, which needs other field values to validate his field. I need a way to pass that values to that field validator. -- View this message in context: http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23630526.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: passing form parameters to a custom validator
Yes, I did. But in the action the string takes the value "${field}" and not the field value. Lukasz Lenart wrote: > > 2009/5/19 manub : >> I'm trying to write a custom field validator which needs other fields to >> validate the field I need to validate. How can I pass field values (and >> not >> static params) to a field validator in the validation xml? I'm using >> Struts >> 2.1.6. > > Did you try ${fieldFromAction} ? > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > -- View this message in context: http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23630243.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
Yes. renders also and tag, and I don't need them. I'm in need of a way to showing only the errors for a specific field without having any HTML tag (I need only the plain text). newton.dave wrote: > > manub wrote: >> I used the iterator trick described before and it works, showing me all >> field >> errors. Nested into the 2 iterators tag, there's a tag which I could use >> to >> print only the errors for a specific field using ? > > Are you asking about the tag? > > Dave > > - > 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/customize-fielderror-tp21990061p23630112.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
I used the iterator trick described before and it works, showing me all field errors. Nested into the 2 iterators tag, there's a tag which I could use to print only the errors for a specific field using ? Thanks. manub wrote: > > Isn't it possible to reference directly the single field errors without > modifying the FTL and without having and tags? > > > > Sonny Gill wrote: >> >> Ahh...right. >> Assuming that you are using simple theme as default, You will need to >> extract fielderror.ftl from the struts2 jar, modify it to suit the way >> you want it, and then add it to your applicaiton. >> >> Instructions here - >> http://struts.apache.org/2.0.14/docs/template-loading.html >> >> The other option is to forgo the use of and manually >> iterate through them like so - >> >> >> >> >> >> >> >> Cheers, >> Sonny >> >> On Fri, Feb 13, 2009 at 2:23 PM, Po Po wrote: >>> Hi, >>> Sorry, for mistype. it should be >>> I try to add attribute theme="simple" but the tag ul and li are still >>> exist. >>> >>> >>> Thanks >> >> - >> 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/customize-fielderror-tp21990061p23619249.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
Isn't it possible to reference directly the single field errors without modifying the FTL and without having and tags? Sonny Gill wrote: > > Ahh...right. > Assuming that you are using simple theme as default, You will need to > extract fielderror.ftl from the struts2 jar, modify it to suit the way > you want it, and then add it to your applicaiton. > > Instructions here - > http://struts.apache.org/2.0.14/docs/template-loading.html > > The other option is to forgo the use of and manually > iterate through them like so - > > > > > > > > Cheers, > Sonny > > On Fri, Feb 13, 2009 at 2:23 PM, Po Po wrote: >> Hi, >> Sorry, for mistype. it should be >> I try to add attribute theme="simple" but the tag ul and li are still >> exist. >> >> >> Thanks > > - > 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/customize-fielderror-tp21990061p23617485.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
passing form parameters to a custom validator
Hi all, I'm trying to write a custom field validator which needs other fields to validate the field I need to validate. How can I pass field values (and not static params) to a field validator in the validation xml? I'm using Struts 2.1.6. Thank you. -- View this message in context: http://www.nabble.com/passing-form-parameters-to-a-custom-validator-tp23615918p23615918.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: xml validation
newton.dave wrote: > > > Include the complete field validation configuration, the interceptor > stack you're using, and the action configuration. > > Dave > > Hi Dave, I solved it. Thanks. Now I've got another question, still about validation. I'm trying to write a custom field validator that validates a code. For validating that code, I need other params that are in the form I submitted. I'm extending FieldValidatorSupport, but it seems I cannot pass other params to that validator. Example: a form with a, b, and c textfield. for validating c, I need a and b values. It is possible to write a field validator for c and specifying in the Action validator to pass that params? I hope I have been clear. Thank you. -- View this message in context: http://www.nabble.com/xml-validation-tp23537908p23556953.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
xml validation
Hi, I've got two problems with XML validation :( - I'm not able to perform an equality check on two parameters. I've got password and confirmPassword which I try to validate using something like: confirmPassword.equals(password) ... What am I getting wrong? - Even if I'm putting input that should be validated, I'm never going to the execute method of the action. It seems that validation always fails. DEBUG [http-8080-1] (CommonsLogger.java:57) - Bypassing //EseguiRegistrazione DEBUG [http-8080-1] (CommonsLogger.java:57) - Validating //EseguiRegistrazione with method execute. DEBUG [http-8080-1] (CommonsLogger.java:57) - Forwarding to location /pages/account/registrazione.jsp (EseguiRegistrazione is the action I forward my submit to, the one that is validated, and the location is the one associated to input result) Using Struts 2.1.6. Thanks. -- View this message in context: http://www.nabble.com/xml-validation-tp23537908p23537908.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: problems using tiles with struts 2
Wes Wannemacher wrote: > > On Tuesday 12 May 2009 11:54:35 am Lukasz Lenart wrote: >> 2009/5/12 manub : >> > Yes, I'm behind a proxy. How to disable that functionality? Thanks in >> > advance. >> >> Sorry, no idea. It's related to Digester itself, try to look in that >> direction. >> >> > > If I remember correctly, this problem is related to the XML parser that > Tomcat > uses (or whatever app server). I think the server will look for whichever > jar > is available. Check your server/lib and directory for xml parsing > libraries. I > wish I could remember the exact details, but there is a parser that is > sometimes distributed, or included in certain installations (windows?) > that > tries to go out to http://blahblahblah to find dtds. The dtds are there so > the > problem doesn't always present itself, but hopefully this is enough > direction > to send you down the right track. > > -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 > > > Using Struts 2.1.6 and the tiles version included with the struts 2.1.6 .zip Will look to that parser. Thanks -- View this message in context: http://www.nabble.com/problems-using-tiles-with-struts-2-tp23499528p23537821.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: problems using tiles with struts 2
Lukasz Lenart wrote: > > 2009/5/12 manub : >> Anyone can suggest me how to handle this? > > XML parser is trying to connect over the Internet to validate XML base > on DTD, do you have proxy in use? It was possible to disable such > function and to use local DTD copy instead. > > > Regards > -- > Lukasz > http://www.lenart.org.pl/ > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > Yes, I'm behind a proxy. How to disable that functionality? Thanks in advance. -- View this message in context: http://www.nabble.com/problems-using-tiles-with-struts-2-tp23499528p23500811.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
problems using tiles with struts 2
Hello there, I got a strange error when I try to develop a simple blank Struts2 Application with Tiles support. The strangest thing is that this application, without any modify, works on another PC. Here's my stacktrace: 12-mag-2009 11.36.06 org.apache.catalina.core.StandardContext listenerStart GRAVE: Exception sending context initialized event to listener instance of class org.apache.struts2.tiles.StrutsTilesListener java.lang.IllegalStateException: Unable to instantiate container. at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:60) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:830) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:719) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.tiles.definition.DefinitionsFactoryException: I/O Error reading definitions. at org.apache.tiles.definition.digester.DigesterDefinitionsReader.read(DigesterDefinitionsReader.java:273) at org.apache.tiles.definition.UrlDefinitionsFactory.readDefinitions(UrlDefinitionsFactory.java:286) at org.apache.tiles.definition.UrlDefinitionsFactory.init(UrlDefinitionsFactory.java:130) at org.apache.tiles.impl.BasicTilesContainer.initializeDefinitionsFactory(BasicTilesContainer.java:406) at org.apache.tiles.impl.BasicTilesContainer.init(BasicTilesContainer.java:130) at org.apache.tiles.factory.TilesContainerFactory.initializeContainer(TilesContainerFactory.java:232) at org.apache.tiles.factory.TilesContainerFactory.createTilesContainer(TilesContainerFactory.java:198) at org.apache.tiles.factory.TilesContainerFactory.createContainer(TilesContainerFactory.java:163) at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:90) at org.apache.struts2.tiles.StrutsTilesListener.createContainer(StrutsTilesListener.java:68) at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57) ... 16 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at sun.net.NetworkClient.doConnect(NetworkClient.java:163) at sun.net.www.http.HttpClient.openServer(HttpClient.java:394) at sun.net.www.http.HttpClient.openServer(HttpClient.java:529) at sun.net.www.http.HttpClient.(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:323) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:852) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:793) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:718) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1041) at org.apache.commons.digester.Digester.createInputSourceFromURL(Digester.java:1938) at org.apache.commons.digester.Digester.resolveEntity(Digester.java:1615) at com.sun.org.apache.xerces.internal.util.EntityResolverWrapper.resolveEntity(EntityResolverWrapper.java:107) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:
file upload problems
Hi there, I'm a newbie in Struts 2 and in Java EE programming... I tried to search about this but i didn't found any succesfull answer. So I'm trying to ask to this ML :) I need to make a form that permits an user to upload a file. I had the "so-well-known" MultiWrapper problem, and I managed it by adding the commons-fileupload jar. But... it didn't work!!! I got a and a . In my struts.xml file, I've got a package who extends struts-jsf-default (we're planning to use JSF) and defined the uploadData action who calls a InsertDataAction class, and in particular a specific method of that class (let's call it insert() ). Of course, this class has got the needed private attributes (File file, String filename, String contentType) and the appropriate getters/setters (afaik, they need to have the name set[filename][attribute], like setUploadFile in my case and so on). I got no exception at runtime, but I can't get that file to be uploaded. In my insert() I try to s.o.p. the attributes, I got everything null. I also watched my server.log (I'm using JBoss as AS), and nothing useful is written out. I wondered if using the struts-jsf-default may corrupt the file upload interceptor, but I'm really not able to answer myself this question. Any help will be kindly appreciated :) Thanks a lot. -- View this message in context: http://www.nabble.com/file-upload-problems-tp15309005p15309005.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]