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 6015753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:52:53+00:00 2026-05-23T02:52:53+00:00

I have a Spring MVC Controller class (bean): @Controller @RequestMapping(/index.jsp) public class EjbCaller {

  • 0

I have a Spring MVC Controller class (bean):

@Controller
@RequestMapping("/index.jsp")
public class EjbCaller {

    @Autowired
    private InfoBean infoBean;

    public EjbCaller() {
        System.out.println("creating !!!!!!!!!!!!!!!!!!!!!!!!!!");
    }

    @ModelAttribute("textFromService")
    public String call() {
       System.out.println("!!!!!!!!!!!!!!!!!!!1 gogogogog");
       return infoBean.getRefSampleService().doService();
    }    
}

How to know that @RequestMapping(“/index.jsp”) fires well when I go to the index.jsp? Because i do not know if I’m putting right value to the @RequestMapping annotation, or maybe something wrong with @ModelAttribute because it does not fire as well..

In my index.jsp i have code like this:

<p>
    <span>from SampleService: ${textFromService} </span>
</p>

About my usage/settgins:

I have DispatcherServlet in web.xml, i have , bit it does not work. I guess ModelAndView this is old approach to use MVC, @ModelAttribute this is a new approach as i understand. So that’s why i use @ModelAtrribute.

I have output in the jbossConsole from EJBCaller from constructor but not when call()-method is calling that’s why i do not know if this method runs or not.

  • 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-23T02:52:54+00:00Added an answer on May 23, 2026 at 2:52 am

    Controllers are just one part of the MVC equation, you should have:

    Controllers with @RequestMapping annotations noting which URLs they handle, they (essentially) return views. In Spring MVC, these are done with ViewResolvers, the simplest is:

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
    

    So then you can do something like

    @RequestMapping(value="/test/{myParam}", method=RequestMethod.GET)
    public ModelAndView myMethod(@PathVariable("myParam") String param) { 
         ModelAndView mv = new ModelAndView();
         mv.setViewName("index"); // now put index.jsp in /WEB-INF/views
         // try passing the input back to the view so you can play around
         // with the view/parameter handling
         mv.addObject("variableName", param); 
    }
    

    In your Spring config file, there are a bunch of options, I often do:

    <mvc:annotation-driven />
    <bean name="someController" class="..."/>
    

    This will then get picked up.

    Don’t forget your org.springframework.web.servlet.DispatcherServlet in web.xml

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

Sidebar

Related Questions

I basically have the following flow: XML -> JSON -> Spring MVC -> jsp
I have two Spring proxies set up: <bean id=simpleBean class=org.springframework.aop.framework.ProxyFactoryBean> <property name=target> <ref local=simpleBeanTarget/>
We have a Hibernate/Spring application that have the following Spring beans: <bean id=transactionManager class=org.springframework.orm.hibernate3.HibernateTransactionManager
I'm working on a Spring MVC project, and I have unit tests for all
I am using Spring MVC to build my web application, and I have a
Just wondering if there is a way in Spring to have a parent controller:
We are using JPA entity beans as our model for Spring MVC controller on
In my asp.net-mvc website I have a field that usually has a string (from
I have a Spring Interceptor which attempts to add an HTTP header in the
Does Java and/or Spring have the concept of properties? I have bunch of domain

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.