Announcement Announcement Module
Collapse
No announcement yet.
spring and dojo + tiles Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • spring and dojo + tiles

    Hello,
    I am having some problems using spring-js and tiles. I don't think that this is a problem because of tiles, i have tried using spring-js without tiles with the same result. So, i am receiving an javascript error when my bage is loade :

    Code:
    Webpage error details
    
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB0.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
    Timestamp: Mon, 10 May 2010 18:01:16 UTC
    
    
    Message: Could not load 'dijit.MultiSelect'; last tried '../dijit/MultiSelect.js'
    Line: 16
    Char: 5948
    Code: 0
    URI: http://localhost:8080/fm/resources/dojo/dojo.js
    This is what i have done :

    tiles main template :

    Code:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
    
    <html>
    <head>
        <title><tiles:getAsString name="title" /></title>
    
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    	<title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
    
        <script type="text/javascript" src="<c:url value="/resources/dojo/dojo.js" />"></script>
        <script type="text/javascript" src="<c:url value="/resources/dijit/form/MultiSelect.js" />"></script>
    
    
        <script type="text/javascript" src="<c:url value="/resources/spring/Spring.js" />"></script>
        <script type="text/javascript" src="<c:url value="/resources/spring/Spring-Dojo.js" />"></script>
    
    	<link type="text/css" rel="stylesheet" href="<c:url value="/resources/dijit/themes/tundra/tundra.css" />" />
    	<style type="text/css" media="screen">
            @import url("<c:url value="/resources/css-framework/css/tools.css" />");
            @import url("<c:url value="/resources/css-framework/css/typo.css" />");
            @import url("<c:url value="/resources/css-framework/css/forms.css" />");
            @import url("<c:url value="/resources/css-framework/css/layout-navtop-localleft.css" />");
            @import url("<c:url value="/resources/css-framework/css/layout.css" />");
            @import url("<c:url value="/resources/styles/booking.css" />");
        </style>
    
    
    
    </head>
    <body>
        <div id="header">
           <div id="headerTitle"><tiles:insertAttribute name="header" /></div>
        </div>
        <div id="menu">
           <tiles:insertAttribute name="menu" />
        </div>
        <div id="content">
           <td><tiles:insertAttribute name="body" />
        </div>
        <div id="footer">
           <tiles:insertAttribute name="footer" />
        </div>
    </body>
    </html>
    my jsp file :

    Code:
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    <%--<%@ include file="/taglibs.jsp" %>
    <head>            <!-- extra -->
    <%@ include file="/extra_head.jsp" %>
    </head>--%>
    <script type="text/javascript">dojo.require("dijit.TitlePane");
    dojo.require("dijit.MultiSelect");</script>
    <div dojoType="dijit.TitlePane" style="width: 100%" title="Abonare newsletter">
        <form:form action="/${ctx}/newsletter/add" method="POST" modelAttribute="newsletter">
            <form:errors path="*" cssClass="errors"/><br/>
    
            <div>
                <label for="nume">First Name:</label>
                <form:input id="nume" cssStyle="width:250px" maxlength="30" path="nume" size="30"/>
                <form:errors path="nume" cssClass="errors"/>
                <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration(
                {elementId : "nume", widgetType : "dijit.form.ValidationTextBox",
                    widgetAttrs : {promptMessage: "First name is mandatory",
                        required : true}})); </script>
            </div>
            <div>
                <label for="prenume">Last Name:</label>
                <form:input id="prenume" cssStyle="width:250px" maxlength="30" path="nume" size="30"/>
                <form:errors path="prenume" cssClass="errors"/>
                <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration(
                {elementId : "prenume", widgetType : "dijit.form.ValidationTextBox",
                    widgetAttrs : {promptMessage: "Last name is mandatory",
                        required : true}})); </script>
            </div>
        </form:form>
    </div>
    I see a small boxe on the right of my textbox saying that they are mandatory, but widget seems to be unformated.

    You can see the message in the screenshot.

    Anyone can provide any solution. Thx.

  • #2
    This isn't my area of expertise, but did you apply the tundra CSS class to the decorated elements?

    Comment


    • #3
      I have imported the css with this line :

      Code:
      <link type="text/css" rel="stylesheet" href="<c:url value="/resources/dijit/themes/tundra/tundra.css" />" />
      I haven't done anything else.

      Comment


      • #4
        Ok, so the CSS is available, but I don't think decorating the element APPLIES the tundra class automatically. You're going to have to do this yourself.

        As an alternative, I think you can specify the tundra class in any parent class without any ill effects. For example, I'm setting the tundra class on the body element in my layout xhtml. You'll need to apply this class, or you won't get some of the widgets to render properly.

        Comment


        • #5
          Thx, that was the problem. I've added to my body tag :

          <body class="tundra spring">

          Comment

          Working...
          X