Search Results

Search found 4868 results on 195 pages for 'grails validation'.

Page 2/195 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Grails beginner problem "Failed to invoke Servlet 2.5"

    - by A Lion
    I'm trying to get Groovy on Grails set up on a Snow Leopard machine. I followed all the grails.com install directions and am trying to start the application from Grails: A Quick-Start Guide by Dave Klein. I ran grails create-app TekDays with no apparent problems and was able to cd to the TekDays folder, but when I try to run grails run-app I get the following: Welcome to Grails 1.3.1 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /grails Base Directory: /apps/TekDays Resolving dependencies... Dependencies resolved in 4469ms. Running script /grails/scripts/RunApp.groovy Environment set to development [delete] Deleting directory /Users/name/.grails/1.3.1/projects/TekDays/tomcat Running Grails application.. 2010-05-24 21:42:39,559 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: Failed to invoke Servlet 2.5 getContextPath method java.lang.IllegalStateException: Failed to invoke Servlet 2.5 getContextPath method at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:164) at grails.web.container.EmbeddableServer$start.call(Unknown Source) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:159) at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:282) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:150) at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy) at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116) at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy) at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59) at RunApp$_run_closure1.doCall(RunApp.groovy:33) at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415) at gant.Gant$_dispatch_closure7.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:427) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:415) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.executeTargets(Gant.groovy:590) at gant.Gant.executeTargets(Gant.groovy:589) Caused by: java.lang.NoSuchMethodException: javax.servlet.ServletContext.getContextPath() at java.lang.Class.getMethod(Class.java:1605) ... 23 more I've googled every derivative of "Failed to invoke Servlet 2.5" that I can think of, but have thus far been unable to find anything that helps me understand, yet alone resolve, the error. Any advice to help me resolve this would be very much appreciated!

    Read the article

  • Grails Liferay portlet not invoking action

    - by RJ Regenold
    I am trying to create a simple portlet for Liferay 5.2.2 using Grails 1.2.1 with the grails-portlets 0.7 and grails-portlets-liferay 0.2 plugins. I created and deployed a stock portlet (just updated title, description, etc...). It deploys correctly and the view renders correctly. However, when I submit the default form that is in view.gsp it never hits the actionView function. Here are the relevant code bits: SearchPortlet.groovy class SearchPortlet { def title = 'Search' def description = ''' A simple search portlet. ''' def displayName = 'Search' def supports = ['text/html':['view', 'edit', 'help']] // Liferay server specific configurations def liferay_display_category = 'Category' def actionView = { println "In action view" } def renderView = { println "In render view" //TODO Define render phase. Return the map of the variables bound to the view ['mykey':'myvalue'] } ... } view.gsp <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %> <div> <h1>View Page</h1> The map returned by renderView is passed in. Value of mykey: ${mykey} <form action="${portletResponse.createActionURL()}"> <input type="submit" value="Submit"/> </form> </div> The tomcat terminal prints In render view whenever I view the portlet, and after I press the submit button. It never prints the In action view statement. Any ideas? Update I turned on logging and this is what I see whenever I click the submit button in the portlet: [localhost].[/gportlet] - servletPath=/Search, pathInfo=/invoke, queryString=null, name=null [localhost].[/gportlet] - Path Based Include portlets.GrailsDispatcherPortlet - DispatcherPortlet with name 'Search' received render request portlets.GrailsDispatcherPortlet - Bound render request context to thread: com.liferay.portlet.RenderRequestImpl@7a158e portlets.GrailsDispatcherPortlet - Testing handler map [org.codehaus.grails.portlets.GrailsPortletHandlerMapping@1f06283] in DispatcherPortlet with name 'Search' portlets.GrailsDispatcherPortlet - Testing handler adapter [org.codehaus.grails.portlets.GrailsPortletHandlerAdapter@74f72b] portlets.GrailsPortletHandlerAdapter - portlet.handleMinimised not set, proceeding with normal render portlet.SearchPortlet - In render view portlets.GrailsPortletHandlerAdapter - Couldn't resolve action view /search/null.gsp portlets.GrailsPortletHandlerAdapter - Trying to render mode view /search/view.gsp portlets.GrailsDispatcherPortlet - Setting portlet response content type to view-determined type [text/html;charset=ISO-8859-1] [localhost].[/gportlet] - servletPath=/WEB-INF/servlet/view, pathInfo=null, queryString=null, name=null [localhost].[/gportlet] - Path Based Include portlets.GrailsDispatcherPortlet - Cleared thread-bound render request context: com.liferay.portlet.RenderRequestImpl@7a158e portlets.GrailsDispatcherPortlet - Successfully completed request The fourth line in that log snippet says Bound render request..., which I don't understand because the action in the form that is in the portlet is to the action url. I would've thought that should be an action request.

    Read the article

  • Pros and cons of using Grails compared to pure Groovy

    - by shabunc
    Say, you (by you I mean an abstract guy, any guy in your team) have experience of writing and building java web apps, know about filters, servlet mappings and so on, and so on. Also, let us assume you know pretty well any sql db, no matter which one exactly, whether it mysql, oracle or psql. At last, let pretend we know Groovy and its standard libraries, for example all that JsonBuilder and XmlSlurper stuff, so we don't need grails converters. The question is - what are benefits of using grails in this case. I'm not trying to start flame war, I'm just asking to compare - what are ups and downs of grails development compared to pure groovy one. For instance, off the top of my head I can name two pluses - automatic DB mapping and custom gsp tags. But when I want to write a modest app which provides small API for handling some well defined set of data, I'm totally OK with groovy's awesome SQL support. As for gsp, we does not use it at all, so we are not interested in custom tags as well.

    Read the article

  • Client Side Form Validation vs. Server Side Form Validation

    In my opinion, it is mandatory to validate data using client side and server side validation as a fail over process. The client side validation allows users to correct any error before they are sent to the web server for processing, and this allows for an immediate response back to the user regarding data that is not correct or in the proper format that is desired. In addition, this prevents unnecessary interaction between the user and the web server and will free up the server over time compared to doing only server side validation. Server validation is the last line of defense when it comes to validation because you can check to ensure the user’s data is correct before it is used in a business process or stored to a database. Honestly, I cannot foresee a scenario where I would only want to use one form of validation over another especially with the current cost of creating and maintaining data. In my opinion, the redundant validation is well worth the overhead.

    Read the article

  • Error releasing Grails plugin

    - by Don
    Hi, I checked out the trunk of my plugin from the Grails svn repo, made some changes, incremented the version number to 0.2.1, then ran release-plugin. It failed with the error shown below: Checking in plugin zip... Updating from SVN... Updated to revision 61343. Committing local, please wait... Enter a SVN commit message: Fixed bug with controller dependency version and upgraded to grails 1.2.2 Committing code. Please wait... Failed to stat working directory: svn: Commit failed (details follow): svn: Authentication required for '<https://svn.codehaus.org:443> grails-plugins primary Subversion repository' Application context shutting down... Application context shutdown. It's possible that my password is not correct, but I'm pretty sure it is. Does anyone know what the problem could be, and is there some way I can verify that the password I'm using is correct?

    Read the article

  • Grails domain class event listner in service level

    - by BlackPanther
    Hi , I want to interrupt some specific grails domain class events(read,write,delete,update).Is there any hibernate eventlistner available for grails domain classes.So that all the calls will go through that eventslistner.I tried following def beforeLoad={}, def beforeInsert={} ,etc ..Other than that is there any other way something can be done in service level? Thanks

    Read the article

  • Grails 1.3.3: controller.redirectArgs.action not populated

    - by Matthias Hryniszak
    Does anyone knows what happened to controller.redirectArgs.action in the latest version of Grails (1.3.3)? It used to work properly but now I get NPE when I use it. class FooController { def someRedirect = { redirect(action:"bar") } } class FooControllerTests extends grails.test.ControllerUnitTestCase { void testSomeRedirect() { controller.someRedirect() assertEquals "bar", controller.redirectArgs.action } } In this case controller.redirectArgs is already null...

    Read the article

  • Grails Domain.get() returns null for mongo's ObjectId

    - by Shashank Agrawal
    I'm using grails 2.3.5 with mongodb 3.0.1 and no hibernate installed. I've a domain class which uses mongo's ObjectId. import org.bson.types.ObjectId class Category { ObjectId id String name } And has a record in mongo database: { "_id": ObjectId("53f6c34c33a429240e2ab471"), "name": "art", "version": NumberLong("41") } When I do, Category.get(new ObjectId("53f6c34c33a429240e2ab471")) somewhere in grails app, it returns null but when I do Category.get("53f6c34c33a429240e2ab471") it then actually returns the result. Why, get() method does not process ObjectId type?

    Read the article

  • Installing Grails with Apache Camel plugin

    - by Abdullah Jibaly
    I'm having trouble getting the Apache Camel plugin to run in grails-1.1.1. Here's the steps I took: $ grails create-app camelapp Welcome to Grails 1.1.1 - http://grails.org/ ... $ cd camelapp $ grails run-app ... Running Grails application.. Server running. Browse to http://localhost:8080/camelapp $ grails install-plugin camel ... Camel Route directory was created. Plugin camel-0.2 installed Plug-in provides the following new scripts: ------------------------------------------ grails create-route $ grails run-app ... [groovyc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Compile error during compilation with javac. [groovyc] /Users/abdullah/.grails/1.1.1/projects/camelapp/plugins/camel-0.2/src/java/org/ix/grails/plugins/camel/ClosureProcessor.java:22: method does not override a method from its superclass [groovyc] @Override [groovyc] ^ ... : Compilation Failed at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:807) at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:540) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) at org.apache.tools.ant.Task.perform(Task.java:348) at _GrailsCompile_groovy$_run_closure3_closure7.doCall(_GrailsCompile_groovy:102) at _GrailsCompile_groovy$_run_closure3_closure7.doCall(_GrailsCompile_groovy) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at _GrailsCompile_groovy$_run_closure3.doCall(_GrailsCompile_groovy:89) at _GrailsCompile_groovy$_run_closure2.doCall(_GrailsCompile_groovy:55) at _GrailsPackage_groovy$_run_closure2_closure9.doCall(_GrailsPackage_groovy:79) at _GrailsPackage_groovy$_run_closure2_closure9.doCall(_GrailsPackage_groovy) at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274) at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) at _GrailsPackage_groovy$_run_closure2.doCall(_GrailsPackage_groovy:78) at RunApp$_run_closure1.doCall(RunApp.groovy:28) at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334) at gant.Gant$_dispatch_closure6.doCall(Gant.groovy) at gant.Gant.withBuildListeners(Gant.groovy:344) at gant.Gant.this$2$withBuildListeners(Gant.groovy) at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source) at gant.Gant.dispatch(Gant.groovy:334) at gant.Gant.this$2$dispatch(Gant.groovy) at gant.Gant.invokeMethod(Gant.groovy) at gant.Gant.processTargets(Gant.groovy:495) at gant.Gant.processTargets(Gant.groovy:480) Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Compile error during compilation with javac. /Users/abdullah/.grails/1.1.1/projects/camelapp/plugins/camel-0.2/src/java/org/ix/grails/plugins/camel/ClosureProcessor.java:22: method does not override a method from its superclass @Override ^ ... Compilation error: Compilation Failed $ java -version java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)

    Read the article

  • Clear validation on textInput when validation is not enabled

    - by Jon
    Hi, I've created a custom textInput componenet that handles it's own validation using a private validator. The validation is enabled depending on the state of the component i.e. validation is enable when the components state is "edit". However, when the state changes from edit the internal validator is set to not enabled but the validation errors on the textbox do not clear - the textInput still has the red border and on mouseover the validation errors come up. What I want to happen is that when a validator is disabled the error formatting and error messages clear from the text input control. Does anyone have any idea how to do this I tried setting the internal validator instance to enabled = false and dispatching a new focusOutEvent as below but the validation error formatting is still applied to the textInput contrl. _validatorInstance.enabled = false; //clear the validation errors if any dispatchEvent(new FocusEvent(FocusEvent.FOCUS_OUT)); Any ideas? Thanks Jon

    Read the article

  • Asp.Net MVC 2 Client validation implementation for Enterprise Library Validation Block

    - by er-v
    Hello to everybody. I've found a very good article about how to use EntLib Validation Block for server validation in MVC 2. But as there pointed out The current design of EntLib’s Validation Application Block uses the Composite pattern; that is, when we ask for validation for an object, it returns back a single validator object that contains a list of all the validation work to be done. While this is very convenient from a normal usage scenario, the unfortunate side-effect is that we can’t “peek inside” to see what the individual validations are that it’s doing, and therefore can’t generate the appropriate client-side validation hints. So how is it possible to implement client side validation for EntLib? Is there work around?

    Read the article

  • Grails: enterprise level Grails

    - by javanes
    Hello; I am trying to persuade my boss about using Grails. I tell him it is the most productive way to implement our shopping web site. But he has doubts about its scalability when traffic gets higher and higher. So can you give examples of enterprise level web sites with notable traffic implemented in grails. Also is there anything that I have to take into account when building such an enterprise level web site that will probably have high traffic. Note: We may expect 10K daily hit.

    Read the article

  • grails clean having issues

    - by hvgotcodes
    Im running grails 1.2 on win7. when i try to do grails clean it fails to remove some jars in my acegi plugin. after that failure, it complains about not finding the plugin descriptor. I am forced to remove all plugins from the disk manually and then run the app again to download them again. the particular jar in acegi is ant-contrib-xx.jar. has anyone seen this? as a further note, if i just delete the acegi directory after the initial failure it fails on a jar in another plugin. I dont know if Im having some sort of windows filesystem issue (I am coming from linux, forced to use win7 because intellij sucks on linux), or intellij is doing something, or what...

    Read the article

  • Adding Unobtrusive Validation To MVCContrib Fluent Html

    - by srkirkland
    ASP.NET MVC 3 includes a new unobtrusive validation strategy that utilizes HTML5 data-* attributes to decorate form elements.  Using a combination of jQuery validation and an unobtrusive validation adapter script that comes with MVC 3, those attributes are then turned into client side validation rules. A Quick Introduction to Unobtrusive Validation To quickly show how this works in practice, assume you have the following Order.cs class (think Northwind) [If you are familiar with unobtrusive validation in MVC 3 you can skip to the next section]: public class Order : DomainObject { [DataType(DataType.Date)] public virtual DateTime OrderDate { get; set; }   [Required] [StringLength(12)] public virtual string ShipAddress { get; set; }   [Required] public virtual Customer OrderedBy { get; set; } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Note the System.ComponentModel.DataAnnotations attributes, which provide the validation and metadata information used by ASP.NET MVC 3 to determine how to render out these properties.  Now let’s assume we have a form which can edit this Order class, specifically let’s look at the ShipAddress property: @Html.LabelFor(x => x.Order.ShipAddress) @Html.EditorFor(x => x.Order.ShipAddress) @Html.ValidationMessageFor(x => x.Order.ShipAddress) .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Now the Html.EditorFor() method is smart enough to look at the ShipAddress attributes and write out the necessary unobtrusive validation html attributes.  Note we could have used Html.TextBoxFor() or even Html.TextBox() and still retained the same results. If we view source on the input box generated by the Html.EditorFor() call, we get the following: <input type="text" value="Rua do Paço, 67" name="Order.ShipAddress" id="Order_ShipAddress" data-val-required="The ShipAddress field is required." data-val-length-max="12" data-val-length="The field ShipAddress must be a string with a maximum length of 12." data-val="true" class="text-box single-line input-validation-error"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } As you can see, we have data-val-* attributes for both required and length, along with the proper error messages and additional data as necessary (in this case, we have the length-max=”12”). And of course, if we try to submit the form with an invalid value, we get an error on the client: Working with MvcContrib’s Fluent Html The MvcContrib project offers a fluent interface for creating Html elements which I find very expressive and useful, especially when it comes to creating select lists.  Let’s look at a few quick examples: @this.TextBox(x => x.FirstName).Class("required").Label("First Name:") @this.MultiSelect(x => x.UserId).Options(ViewModel.Users) @this.CheckBox("enabled").LabelAfter("Enabled").Title("Click to enable.").Styles(vertical_align => "middle")   @(this.Select("Order.OrderedBy").Options(Model.Customers, x => x.Id, x => x.CompanyName) .Selected(Model.Order.OrderedBy != null ? Model.Order.OrderedBy.Id : "") .FirstOption(null, "--Select A Company--") .HideFirstOptionWhen(Model.Order.OrderedBy != null) .Label("Ordered By:")) .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } These fluent html helpers create the normal html you would expect, and I think they make life a lot easier and more readable when dealing with complex markup or select list data models (look ma: no anonymous objects for creating class names!). Of course, the problem we have now is that MvcContrib’s fluent html helpers don’t know about ASP.NET MVC 3’s unobtrusive validation attributes and thus don’t take part in client validation on your page.  This is not ideal, so I wrote a quick helper method to extend fluent html with the knowledge of what unobtrusive validation attributes to include when they are rendered. Extending MvcContrib’s Fluent Html Before posting the code, there are just a few things you need to know.  The first is that all Fluent Html elements implement the IElement interface (MvcContrib.FluentHtml.Elements.IElement), and the second is that the base System.Web.Mvc.HtmlHelper has been extended with a method called GetUnobtrusiveValidationAttributes which we can use to determine the necessary attributes to include.  With this knowledge we can make quick work of extending fluent html: public static class FluentHtmlExtensions { public static T IncludeUnobtrusiveValidationAttributes<T>(this T element, HtmlHelper htmlHelper) where T : MvcContrib.FluentHtml.Elements.IElement { IDictionary<string, object> validationAttributes = htmlHelper .GetUnobtrusiveValidationAttributes(element.GetAttr("name"));   foreach (var validationAttribute in validationAttributes) { element.SetAttr(validationAttribute.Key, validationAttribute.Value); }   return element; } } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } The code is pretty straight forward – basically we use a passed HtmlHelper to get a list of validation attributes for the current element and then add each of the returned attributes to the element to be rendered. The Extension In Action Now let’s get back to the earlier ShipAddress example and see what we’ve accomplished.  First we will use a fluent html helper to render out the ship address text input (this is the ‘before’ case): @this.TextBox("Order.ShipAddress").Label("Ship Address:").Class("class-name") .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } And the resulting HTML: <label id="Order_ShipAddress_Label" for="Order_ShipAddress">Ship Address:</label> <input type="text" value="Rua do Paço, 67" name="Order.ShipAddress" id="Order_ShipAddress" class="class-name"> Now let’s do the same thing except here we’ll use the newly written extension method: @this.TextBox("Order.ShipAddress").Label("Ship Address:") .Class("class-name").IncludeUnobtrusiveValidationAttributes(Html) .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } And the resulting HTML: <label id="Order_ShipAddress_Label" for="Order_ShipAddress">Ship Address:</label> <input type="text" value="Rua do Paço, 67" name="Order.ShipAddress" id="Order_ShipAddress" data-val-required="The ShipAddress field is required." data-val-length-max="12" data-val-length="The field ShipAddress must be a string with a maximum length of 12." data-val="true" class="class-name"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Excellent!  Now we can continue to use unobtrusive validation and have the flexibility to use ASP.NET MVC’s Html helpers or MvcContrib’s fluent html helpers interchangeably, and every element will participate in client side validation. Wrap Up Overall I’m happy with this solution, although in the best case scenario MvcContrib would know about unobtrusive validation attributes and include them automatically (of course if it is enabled in the web.config file).  I know that MvcContrib allows you to author global behaviors, but that requires changing the base class of your views, which I am not willing to do. Enjoy!

    Read the article

  • grails question (sample 1 of Grails To Action book) problem with Controller and Service

    - by fegloff
    Hi, I'm doing Grails To Action sample for chapter one. Every was just fine until I started to work with Services. When I run the app I have the following error: groovy.lang.MissingPropertyException: No such property: quoteService for class: qotd.QuoteController at qotd.QuoteController$_closure3.doCall(QuoteController.groovy:14) at qotd.QuoteController$_closure3.doCall(QuoteController.groovy) at java.lang.Thread.run(Thread.java:619) Here is my groovie QuoteService class, which has an error within the definition of GetStaticQuote (ERROR: Groovy:unable to resolve class Quote) package qotd class QuoteService { boolean transactional = false def getRandomQuote() { def allQuotes = Quote.list() def randomQuote = null if (allQuotes.size() > 0) { def randomIdx = new Random().nextInt(allQuotes.size()) randomQuote = allQuotes[randomIdx] } else { randomQuote = getStaticQuote() } return randomQuote } def getStaticQuote() { return new Quote(author: "Anonymous",content: "Real Programmers Don't eat quiche") } } Controller groovie class package qotd class QuoteController { def index = { redirect(action: random) } def home = { render "<h1>Real Programmers do not each quiche!</h1>" } def random = { def randomQuote = quoteService.getRandomQuote() [ quote : randomQuote ] } def ajaxRandom = { def randomQuote = quoteService.getRandomQuote() render "<q>${randomQuote.content}</q>" + "<p>${randomQuote.author}</p>" } } Quote Class: package qotd class Quote { String content String author Date created = new Date() static constraints = { author(blank:false) content(maxSize:1000, blank:false) } } I'm doing the samples using Eclipse with grails addin. Any advice? Regards, Francisco

    Read the article

  • How best to implement HTML5 support for my validation library

    - by Vivin Paliath
    I have created an annotation-based validation library called regula. There seems to be some amount of interest around the framework and the next thing I'd like to do is to support HTML5 validation. Originally I figured that I would check to see if the browser supported the HTML5 validation that has been specified and to either emulate or delegate to built-in regula equivalents. This is trivial for things like required, but once you start getting into the date-validation, it gets tricky (date widgets, localization, etc.). So I have a few options in front of me: Full HTML5 Shim along with widgets (for date stuff etc.): I feel like this is overkill and essentially reinventing the wheel since this is already covered by things like modernizr. Use HTML5 validation if available (either native, or provided by shim; otherwise ignore): What this means is that if HTML5 validation is available (natively or through a shim) I will use it, otherwise I will ignore it. I'm leaning towards the latter since currently if someone wants to use HTML5 validation, they will most probably require a shim since not all browsers support HTML5. Which option do you think is better?

    Read the article

  • Grails bean-fields plugin

    - by Don
    Hi, I'm having problems using the Grails bean-fields plugin with a class this is annotated Validateable, but is not a domain/command class. The root cause of the problem appears to be in this method of BeanTagLib.groovy private def getBeanConstraints(bean) { if (bean?.metaClass?.hasProperty(bean, 'constraints')) { def cons = bean.constraints if (cons != null) { if (log.debugEnabled) { log.debug "Bean is of type ${bean.class} - the constraints property was a [${cons.class}]" } // Safety check for the case where bean is no a proper domain/command object // This avoids confusing errors where constraints comes back as a Closure if (!(cons instanceof Map)) { if (log.warnEnabled) { log.warn "Bean of type ${bean.class} is not a domain class, command object or other validateable object - the constraints property was a [${cons.class}]" } } } else { if (log.warnEnabled) { log.warn "Bean of type ${bean.class} has no constraints" } } return cons } else return null } I tested out this method above in the grails console and when I pass an instance of MyBean into this method, it logs: Bean of type ${bean.class} is not a domain class, command object or other validateable object - the constraints property was a [${cons.class}] Because the constraints are returned as an instance of Closure instead of a Map. If I could figue out how to get a Map reference to the constraints of a @Validateable class (that is not a domain/command class), I guess I could resolve the problem. Thanks, Don

    Read the article

  • Grails: Services VS Groovy classes

    - by Olexandr
    Documentation says: The Grails team discourages the embedding of core application logic inside controllers, as it does not promote re-use and a clean separation of concerns. I have one API controller and a few Groovy classes in src/groovy folder. Those classes just implements my application logic so actions in API controller works in this way: //index page def index = { render new IndexApi().index(params) as JSON } I'm curious - is there any reason to move my application logic from plain groovy classes into services ?

    Read the article

  • Grails Detect if a Plugin is Installed

    - by Scott Warren
    Is there a way in Grails to Detect that a plugin is installed. For example I need to know if the "Acegi" plugin is installed. If it is then I can run different Code. If the plugin is not installed (which is a viable option) then I can run different code. Thanks in Advance.

    Read the article

  • Grails Runtime Exception with Audit Logging Plugin

    - by Paul
    I've deployed my app to tomcat running on EC2 via Cloud Foundry. The application uses the Grails Audit Logging Plugin I'm getting the following runtime error: Error 500: Executing action [save] of controller [com.questern.aoms.CompanyController] caused exception: groovy.lang.MissingPropertyException: No such property: errors for class: org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEvent Servlet: grails URI: /aoms/grails/company/save.dispatch Exception Message: No such property: errors for class: org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEvent Caused by: No such property: errors for class: org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEvent Class: CompanyController At Line: [30] The exception is: groovy.lang.MissingPropertyException: No such property: errors for class: org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEvent at $Proxy10.saveOrUpdate(Unknown Source) at com.questern.aoms.CompanyController$_closure4.doCall(CompanyController.groovy:30) at com.questern.aoms.CompanyController$_closure4.doCall(CompanyController.groovy) I have added the import statement to the controller CompanyController, but to no avail. import org.codehaus.groovy.grails.plugins.orm.auditable.AuditLogEvent I checked the war file and the AuditLogEvent is include in: aoms-0.1.war\WEB-INF\classes\org\codehaus\groovy\grails\plugins\orm\auditable\ Any suggestions as to what the problem could be?

    Read the article

  • Setter Validation can affect performance?

    - by TiagoBrenck
    Whitin a scenario where you use an ORM to map your entities to the DB, and you have setter validations (nullable, date lower than today validation, etc) every time the ORM get a result, it will pass into the setter to instance the object. If I have a grid that usually returns 500 records, I assume that for each record it passes on all validations. If my entity has 5 setter validations, than I have passed in 2.500 validations. Does those 2.500 validations will affect the performance? If was 15.000 validation, it will be different? In my opinion, and according to this answer (http://stackoverflow.com/questions/4893558/calling-setters-from-a-constructor/4893604#4893604), setter validation is usefull than constructors validation. Is there a way to avoid unecessary validation, since I am safe that the values I send to DB when saving the entity wont change until I edit it on my system?

    Read the article

  • Grails easygrid plugin, Datatable implementation

    - by Robert Morning
    I'm playing with the datatable implementation in the Easygrid plugin and I have to say i love it but I have a question . If i use datatable directly (ie outside of Easygrid) to decorate a table i get a global search box defined above my table . If i use the Easygrid implementation and define my grid in a controller I get filters added for each column but no search box - it is added but then removed somehow either by easygrid itself or some parameter passed to datatable . How can I restore the search box and is this a bug as i would have thought the default implementation of datatable supplied via easygrid should match the default implementation supplied by the vanilla datatable itself? I'm using Grails 2.3.7 and Easygrid 1.6.2 .. Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >