Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:37:05+00:00 2026-05-28T06:37:05+00:00

I have a webapp which is built using spring 3 and tiles 2 (not

  • 0

I have a webapp which is built using spring 3 and tiles 2 (not RESTful). I am using UrlBasedViewResolver to display views

my application-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd 
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context-3.0.xsd
                        http://www.springframework.org/schema/beans 
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <mvc:annotation-driven />
    <mvc:resources mapping="/resources/**" location="/resources/" />

    <context:component-scan base-package="com.xxx.xxxx.xxxxx.web.controller" />

    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles.xml</value>
            </list>
        </property>
    </bean>


    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />

    <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView" />
    </bean>

</beans>

my tiles.xml

<tiles-definitions>
    <definition name="base.definition" template="/WEB-INF/views/layout.jsp">
        <put-attribute name="header" value="/WEB-INF/views/header.jsp" />
        <put-attribute name="body" value="" />
        <put-attribute name="footer" value="/WEB-INF/views/footer.jsp" />
    </definition>

    <definition name="welcome" extends="base.definition">
        <put-attribute name="body" value="/WEB-INF/views/welcome.jsp" />
    </definition>
</tiles-definition>

Now my problem is – I have a dynamic form on client side that is generated on fly (using javascript) based on users options like, if a option is chosen from 1st drop down box, then I load rest of the form and so on. For my first drop down menu I have no issues, because those options are constants. but for my second drop down menu choice I need to load info that is specific and is only available on server, so I thought of making a AJAX call (RESTful call), so I created a Controller like this

my RESTful controller:

@Controller
public class UtilsController {

    private WebAdministration admin;

    public UtilsController() throws WebAdministrationException {
        this.admin = WebAdministration.getInstance();
    }

    @RequestMapping(value="/aaaa/${site}/${type}", method=RequestMethod.GET, headers="Accept=text/xml, application/json")
    public @ResponseBody List<String> getRemoteSites(@PathVariable("site") String site, @PathVariable("type") String type) {
        List<String> remoteSites = null;
        Config config = (Config) admin.getImplemantationData().get(Implementations.IMPL);
        if (type.equals(Config.PERSISTENCE)) {
            remoteSites = config.getRemoteSites().get(site).getNewRemoteSites();
        }
        else if (type.equals(Config.OLD)) {
            remoteSites = config.getRemoteSites().get(site).getOldRemoteSites();
        }
        return remoteSites;
    }
}

my ajax call:

<script type="text/javascript">
function getRemoteSites(site, type) {
    $.getJSON('/aaaa/'+site+'/'+type, {
        ajax : 'true'
    }, function(data) {
        var len = data.length;
        for ( var i = 0; i < len; i++) {
            document.write('<form:checkbox path="remoteSites" value="' + valueArray[i] + '" />');
        }
    });
};
</script>

and my Ajax request fails with 404 – no mapping found.

How can I make my REST url work. I know that I need a new view resolver, but I tried so many things and searching for right solution for past 2 days.

any help ?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:37:07+00:00Added an answer on May 28, 2026 at 6:37 am

    May be totally off here – I see that the url that you are requesting to – $.getJSON(‘/aaa…), does not have the context url added to it, that could be the reason why you are getting a 404, unless you are using the root context. Either way I would recommend you to use spring:url or c:url to get the url to a variable and use that instead.

    <spring:url value="/aaaa/" var="myurl" />
    

    Update 1: Looking at your RequestMapping once more –

    @RequestMapping(value="/aaaa/${site}/${type}"
    

    That is not correct, you have to specify it this way – without the $ sign:

    @RequestMapping(value="/aaaa/{site}/{type}"
    

    Also, can you run it in trace mode and see what Dispatcher servlet spews out with this change in place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a spring based web application MyWebapp built using maven and deployed on
I had the following idea: Say we have a webapp written using django which
I have a Struts2 webapp, in which I compiled using the Tomcat 5.5 libraries.
I have a Sinatra webapp I've built using enable :sessions where I access my
I have a webapp which resizes its window to exactly fit its contents: window.resizeTo(200,300)
I have a webapp from which I'd like to insert diagrams and images quickly
I have a java webapp which needs to upload files via http and then
I have a web app which connects to a server using a TCP connection
I have built a few custom applications that run on WSS 3 using the
I am using hsqldb standalone as my database. i have a hsqldb.jar(hsqldb-2.0.0) which i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.