localhost:8080/ returns status 404 - Spring -


this code:

@controller @requestmapping("/") public class merchantscontroller {      @autowired     merchantsservice merchantsservice;      @autowired     productsservice productsservice;      @autowired     ordersservice ordersservice;      @requestmapping(value = "/merchants", method = requestmethod.get)     public modelandview showmerchantslist() {         modelandview modelandview = new modelandview("merchantslist");         list<merchant> merchants = merchantsservice.getmerchantslist();         (merchant merchant : merchants) {             if(merchant.getorder_type() == ordertype.no_ordering){                 merchant.setorderuntil(time.valueof("00:00:00"));             }         }         modelandview.addobject("merchants", merchants);         return modelandview;     } 

as understand when send request localhost:8080/ should open localhost:8080/merchants, not working. has suggestions?

your showmerchantslist method called when send request localhost:8080/merchants. , method redirect again localhost:8080/merchants. if want send request localhost:8080/ , direct localhost:8080/merchants, should create method this:

@requestmapping(value = "/", method = requestmethod.get) public modelandview showmerchantslistwithoutrequestmapping() {     modelandview modelandview = new modelandview("merchantslist");     list<merchant> merchants = merchantsservice.getmerchantslist();     (merchant merchant : merchants) {         if(merchant.getorder_type() == ordertype.no_ordering){             merchant.setorderuntil(time.valueof("00:00:00"));         }     }     modelandview.addobject("merchants", merchants);     return modelandview; } 

this method redirect localhost:8080/merchants, when called localhost:8080/


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -