Search Results

Search found 11138 results on 446 pages for 'spring mvc'.

Page 19/446 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • ASP.NET MVC Case Studies

    - by shiju
     The below are the some of the case studies of ASP.NET MVC Jwaala - Online Banking Solution Benefits after ASP.NET MVC Replaces Ruby on Rails, Linux http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?casestudyid=4000006675 Stack Overflow - Developers See Faster Web Coding, Better Performance with Model-View-Controller http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?casestudyid=4000006676 Kelley Blue Book - Pioneer Provider of Vehicle-Pricing Information Uses Technology to Expand Reach http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?casestudyid=4000006272 

    Read the article

  • ASP.NET MVC 4: Short syntax for script and style bundling

    - by DigiMortal
    ASP.NET MVC 4 introduces new methods for style and scripts bundling. I found something brilliant there I want to introduce you. In this posting I will show you how easy it is to include whole folder with stylesheets or JavaScripts to your page. I’m using ASP.NET MVC 4 Internet Site template for this example. When we open layout pages located in shared views folder we can see something like this in layout file header: <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/css")" rel="stylesheet" type="text/css" />    <link href="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Content/themes/base/css")" rel="stylesheet" type="text/css" />    <script src="@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js")"></script> Let’s take the last line and modify it so it looks like this: <script src="/Scripts/js"></script> After saving the layout page let’s run browser and see what is coming in over network. As you can see the request to folder ended up with result code 200 which means that request was successful. 327.2KB was received and it is not mark-up size for error page or directory index. Here is the body of response: I scrolled down to point where one script ends and another one starts when I made the screenshot above. All scripts delivered with ASP.NET MVC project templates start with this green note. So now we can be sure that the request to scripts folder ended up with bundled script and not with something else. Conclusion Script and styles bundling uses currently by default long syntax where bundling is done through Bundling class. We can still avoid those long lines and use extremely short syntax for script and styles bundling – we just write usual script or link tag and give folder URL as source. ASP.NET MVC 4 is smart enough to combine styles or scripts when request like this comes in.

    Read the article

  • Help with MVC design pattern?

    - by user3681240
    I am trying to build a java program for user login but I am not sure if my MVC design is accurate. I have the following classes: LoginControl - servlet LoginBean - data holder java class with private variables getters and setters LoginDAO - concrete java class where I am running my SQL queries and doing rest of the logical work. Connection class - java class just to connect to the database view - jsp to display the results html - used for form Is this how you design a java program based on MVC design pattern? Please provide some suggestions?

    Read the article

  • Play audio file data - Spring MVC

    - by Vijay Veeraraghavan
    In my web-application, I have various audio clips uploaded by the users in the database stored in the BLOB column. The audio files are low bit rate WAV files. The clips are secured, one can see only those clips he has uploaded. Instead of user downloading the clip and playing it in his player, I need it be steamed online in the web page itself. In the jsp I use the <audio> tag with the source mapping to the controller mappping url. <td> <audio controls><source src="recfile/${au.id}" type="audio/mpeg" /></audio> </td> Where, the recfile is the request mapping and the au.id is the audio id. In the controller I process the request like below @RequestMapping(value = "/recfile/{id}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_OCTET_STREAM_VALUE }) public HttpEntity<byte[]> downloadRecipientFile(@PathVariable("id") int id, ModelMap model, HttpServletResponse response) throws IOException, ServletException { LOGGER.debug("[GroupListController downloadRecipientFile]"); VoiceAudioLibrary dGroup = audioClipService.findAudioClip(id); if (dGroup == null || dGroup.getAudioData() == null || dGroup.getAudioData().length <= 0) { throw new ServletException("No clip found/clip has not data, id=" + id); } HttpHeaders header = new HttpHeaders(); I tried this too //header.setContentType(new MediaType("audio", "mp3")); header.setContentType(new MediaType("audio", "vnd.wave"); header.setContentLength(dGroup.getAudioData().length); return new HttpEntity<byte[]>(dGroup.getAudioData(), header); } When the jsp loads, the controller get the request, it serves back the audio data fetched from the database, the jsp too shows the player with the controls. But when I play it nothing happens. Why is it? Am I missing anything in the configuration? Am I doing it right?

    Read the article

  • Spring validation @AssertTrue

    - by Eqbal
    How do I display on a view jsp validation error message that occurs as a result of @AssertTrue annotation? It isn't tied to a specific field, but I am using it to validate a combination of fields. If I use <form:errors path="*"/> that will display all the errors for that form?

    Read the article

  • using Spring JdbcTemplate for multiple database operations

    - by Joel Carranza
    I like the apparent simplicity of JdbcTemplate but am a little confused as to how it works. It appears that each operation (query() or update()) fetches a connection from a datasource and closes it. Beautiful, but how do you perform multiple SQL queries within the same connection? I might want to perform multiple operations in sequence (for example SELECT followed by an INSERT followed by a commit) or I might want to perform nested queries (SELECT and then perform a second SELECT based on result of each row). How do I do that with JdbcTemplate. Am I using the right class?

    Read the article

  • Spring MVC defaultValue for Double

    - by mlathe
    Hi All, I'm trying to build a controller like this: @RequestMapping(method = {RequestMethod.GET}, value = "/users/detail/activities.do") public View foo(@RequestParam(value = "userCash", defaultValue="0.0") Double userCash) { System.out.println("foo userCash=" + userCash); } This works fine: http://localhost/app/users/detail/activities.do?userCash=123& but in this one userCash==null despite the default value http://localhost/app/users/detail/activities.do?userCash=& From some digging it seems like the first one works b/c of a Editor binding like this: binder.registerCustomEditor(Double.class, new CustomNumberEditor(Double.class, false)); The trouble is that the second param (ie false) defines whether blank values are allowed. If i set that to true, than the system considers the blank input as valid so i get a null Double class. If i set it to false then the system chokes on the blank input string with: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'double'; nested exception is java.lang.NumberFormatException: empty String Does anyone know how to get the defaultValue to work for Doubles? Thanks --Matthias

    Read the article

  • Spring MVC validation with Annotations

    - by cdecker
    I'm having quite some trouble since I migrated my controllers from classical inheritance to use the annotations like @Controller and @RequestMapping. The problem is that I don't know how to plug in validation like in the old case. Are there any good tutorials about this?

    Read the article

  • Spring MVC and 406 Error XML request

    - by Asp1de
    Hi i have a problem when running my code outside eclipse. This is my Equinox enviroment: Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.7.0.v20110221 1 ACTIVE org.eclipse.equinox.common_3.6.0.v20110506 2 ACTIVE org.eclipse.update.configurator_3.3.100.v20100512 3 RESOLVED catalina-config_1.0.0 Master=20 4 ACTIVE org.springframework.osgi.catalina.start.osgi_1.0.0 Fragments=62 5 ACTIVE com.springsource.javax.activation_1.1.1 6 ACTIVE com.springsource.javax.annotation_1.0.0 7 ACTIVE com.springsource.javax.ejb_3.0.0 8 ACTIVE com.springsource.javax.el_1.0.0 9 ACTIVE com.springsource.javax.mail_1.4.0 10 ACTIVE com.springsource.javax.persistence_1.0.0 11 ACTIVE com.springsource.javax.servlet_2.5.0 12 ACTIVE com.springsource.javax.servlet.jsp_2.1.0 13 ACTIVE com.springsource.javax.servlet.jsp.jstl_1.1.2 14 ACTIVE com.springsource.javax.xml.bind_2.0.0 15 ACTIVE com.springsource.javax.xml.rpc_1.1.0 16 ACTIVE com.springsource.javax.xml.soap_1.3.0 17 ACTIVE com.springsource.javax.xml.stream_1.0.1 18 ACTIVE com.springsource.javax.xml.ws_2.1.1 19 ACTIVE com.springsource.org.aopalliance_1.0.0 20 ACTIVE com.springsource.org.apache.catalina_6.0.18 Fragments=3, 22 21 ACTIVE com.springsource.org.apache.commons.logging_1.1.1 22 RESOLVED com.springsource.org.apache.coyote_6.0.18 Master=20 23 ACTIVE com.springsource.org.apache.el_6.0.18 24 ACTIVE com.springsource.org.apache.juli.extras_6.0.18 25 ACTIVE com.springsource.org.apache.log4j_1.2.15 Fragments=33 26 ACTIVE com.springsource.org.apache.taglibs.standard_1.1.2 27 ACTIVE org.springframework.osgi.commons-el.osgi_1.0.0.SNAPSHOT 28 ACTIVE data_1.0.0 29 ACTIVE Api_1.0.0 30 ACTIVE connector_1.0.0 31 ACTIVE core_1.0.0 32 ACTIVE org.springframework.osgi.jasper.osgi_5.5.23.SNAPSHOT 33 RESOLVED com.springsource.org.apache.log4j.config_1.0.0 Master=25 34 ACTIVE testController_1.0.0 35 ACTIVE org.eclipse.core.contenttype_3.4.100.v20100505-1235 36 ACTIVE org.eclipse.core.jobs_3.5.0.v20100515 37 ACTIVE org.eclipse.equinox.app_1.3.0.v20100512 38 ACTIVE org.eclipse.equinox.preferences_3.3.0.v20100503 39 ACTIVE org.eclipse.equinox.registry_3.5.0.v20100503 40 ACTIVE org.eclipse.osgi.services_3.2.100.v20100503 41 ACTIVE osgi.core_4.3.0.201102171602 42 ACTIVE dataImplementation_1.0.0 43 ACTIVE org.springframework.osgi.servlet-api.osgi_2.4.0.SNAPSHOT 44 ACTIVE org.springframework.aop_3.1.1.RELEASE 45 ACTIVE org.springframework.asm_3.1.1.RELEASE 46 ACTIVE org.springframework.beans_3.1.1.RELEASE 47 ACTIVE org.springframework.context_3.1.1.RELEASE 48 ACTIVE org.springframework.context.support_3.1.1.RELEASE 49 ACTIVE org.springframework.core_3.1.1.RELEASE 50 ACTIVE org.springframework.expression_3.1.1.RELEASE 51 ACTIVE org.springframework.osgi.extensions.annotations_1.2.1 52 ACTIVE org.springframework.osgi.core_1.2.1 53 ACTIVE org.springframework.osgi.extender_1.2.1 54 ACTIVE org.springframework.osgi.io_1.2.1 55 ACTIVE org.springframework.osgi.mock_1.2.1 56 ACTIVE org.springframework.osgi.web_1.2.1 57 ACTIVE org.springframework.osgi.web.extender_1.2.1 58 ACTIVE org.springframework.oxm_3.1.1.RELEASE 59 ACTIVE org.springframework.transaction_3.1.1.RELEASE 60 ACTIVE org.springframework.web_3.1.1.RELEASE 61 ACTIVE org.springframework.web.servlet_3.1.1.RELEASE 62 RESOLVED tomcat-configuration-fragment_1.0.0 Master=4 My controller is: @RequestMapping(value = "/test1", method = RequestMethod.GET, produces = "application/json") public @ResponseBody Person test1() { logger.info(" <--- Test 1 ---> \n"); Person p = new Person("a", "b", "c"); return p; } @RequestMapping(value = "/test2", method = RequestMethod.GET, produces = "application/xml") public @ResponseBody Person test3() { logger.info(" <--- Test 1 ---> \n"); Person p = new Person("a", "b", "c"); return p; } @RequestMapping(value = "/test2", method = RequestMethod.GET, headers = "Accept=*/*") public @ResponseBody Person test4() { logger.info(" <--- Test 1 ---> \n"); Person p = new Person("a", "b", "c"); return p; } @RequestMapping(value = "/parent", method = RequestMethod.GET, headers = "Accept=application/xml") public @ResponseBody Parent test2() { logger.info(" <--- Test 1 ---> \n"); Parent p = new Parent("a", "b"); return p; } If i run the TEST 1(json request) it works perfectly but when i run the test 2, 3 and 4 the browser give me back that error: (406) The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers (). Could someone help me? PS: if i run the bundle inside ECLIPSE it works perfectly. I generate the bundles with maven.

    Read the article

  • Spring WS & Validator interceptor

    - by mada
    I have a endpoint mapping a webservice which is used to insert in the dabatabase some keywords: @Transactional(readOnly = false,isolation= Isolation.SERIALIZABLE) public Source saveKW(...). The input is a request. I would like to add an interceptor on the method in order to validate the parameters. this one will read some values from the DB. i would like that this interceptor is EMBED in the transaction declared for the endpoint (or this opposite). In other words, i want them to be in the same transaction. Ideally im looking for something like this with annotation: @Transactional(readOnly = false,isolation= Isolation.SERIALIZABLE) @validator("KeyWordValidaor.class") public Source saveKW(...) where KeyWordValidaor will be class validating the parameters. Have you any idea or short examples to implements this like this way or in a other real way?

    Read the article

  • Spring validation errors not displayed

    - by Art Vandelay
    I have the following situation. I have a validator to validate my command object and set the errors on a Errors object to be displayed in my form. The validator is invoked as expected and works okay, but the errors i set on the Errors objects are not displayed, when i am sent back to my form because of the validation errors. Validator: public void validate(Object obj, Errors err) { MyCommand myCommand = (MyCommand) obj; int index = 0; for (Field field : myCommand.getFields()) { if (field.isChecked()) { if ((field.getValue() == null) || (field.getValue().equals(""))) { err.rejectValue("fields[" + index + "].value", "errors.missing"); } } index++; } if (myCommand.getLimit() < 0) { err.rejectValue("limit", "errors.invalid"); } } Command: public class MyCommand { private List<Field> fields; private int limit; //getters and setters } public class Field { private boolean checked; private String name; private String value; //getters and setters } Form: <form:form id="myForm" method="POST" action="${url}" commandName="myCommand"> <c:forEach items="${myCommand.fields}" var="field" varStatus="status"> <form:checkbox path="fields[${status.index}].checked" value="${field.checked}" /> <c:out value="${field.name}" /> <form:input path="fields[${status.index}].value" /> <form:errors path="fields[${status.index}].value" cssClass="error" /></td> <form:hidden path="fields[${status.index}].name" /> </c:forEach> <fmt:message key="label.limit" /> <form:input path="limit" /> <form:errors path="limit" cssClass="error" /> </form:form> Controller: @RequestMapping(value = REQ_MAPPING, method = RequestMethod.POST) public String onSubmit(Model model, MyCommand myCommand, BindingResult result) { // validate myCommandValidator.validate(myCommand, result); if (result.hasErrors()) { model.addAttribute("myCommand", myCommand); return VIEW; } // form is okay, do stuff and redirect } Could it be that the paths i give in the validator and tag are not correct? The validator validates a command object containing a list of objects, so that's why i give a index on the list in the command object when registering an error message (for example: "fields["+index+"]".value). Or is it that the Errors object containing the errors is not available to my view? Any help is welcome and appreciated, it might give me a hint or point me in right direction.

    Read the article

  • UndeclaredThrowableException due to SQLException in Spring + iBatis?

    - by jr
    Hello, I am getting the following exception when I typo the SQL driver name or the database server is offline, basically any SQLException. I can't determine where the UndeclaredThrowableException is coming from. Line 194 in SqlMapClientTemplate is this: logger.debug("Obtained JDBC Connection [" + springCon + "] for iBATIS operation"); Here is the trace: java.lang.reflect.UndeclaredThrowableException $Proxy59.toString(Unknown Source) java.lang.String.valueOf(Unknown Source) java.lang.StringBuffer.append(Unknown Source) org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:249) org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296) org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:290) some of my reading points to some type of class loading problem? I can't figure out where the $Proxy is getting introduced?

    Read the article

  • Spring MVC handle button event in list

    - by GigaPr
    Hi, i created a list of Users <div class="usersList"> <c:forEach items="${users}" var="user"> <div class="listElementAction"> <c:out value="${user.id}"/> </div> <div class="listElement"> <c:out value="${user.firstName}"/> </div> <div class="listElement"> <c:out value="${user.lastName}"/> </div> <div class="listElement"> <c:out value="${user.username}"/> </div> <div class="listElementAction"> <input type="button" name="Edit" title="Edit" value="Edit" /> </div> <div class="listElementAction"> <input type="image" src="images/delete.png" name="image" value="${user.id}" alt="Delete" onclick="return confirm('Do you want to delete ${user.username}?')" > </div> <br /> </c:forEach> </div> and my controler looks like this public class UsersController implements Controller { private UserServiceImplementation userServiceImplementation; public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelAndView modelAndView = new ModelAndView("users"); modelAndView.addObject("users", this.userServiceImplementation.get()); return modelAndView; } public UserServiceImplementation getUserServiceImplementation() { return userServiceImplementation; } public void setUserServiceImplementation(UserServiceImplementation userServiceImplementation) { this.userServiceImplementation = userServiceImplementation; } } How can i handle the delete and edit button event?

    Read the article

  • Which view will be resolved, code from spring's docs

    - by Blankman
    So when you go to /appointments the get() action is called, so then would the view be get.jsp (assuming you are using .jsp, and assuming you are mapping action names to views)? And what about the getnewform? It seems to be returning an object? Is that basically passed into the view? @Controller @RequestMapping("/appointments") public class AppointmentsController { private final AppointmentBook appointmentBook; @Autowired public AppointmentsController(AppointmentBook appointmentBook) { this.appointmentBook = appointmentBook; } @RequestMapping(method = RequestMethod.GET) public Map<String, Appointment> get() { return appointmentBook.getAppointmentsForToday(); } @RequestMapping(value="/{day}", method = RequestMethod.GET) public Map<String, Appointment> getForDay(@PathVariable @DateTimeFormat(iso=ISO.DATE) Date day, Model model) { return appointmentBook.getAppointmentsForDay(day); } @RequestMapping(value="/new", method = RequestMethod.GET) public AppointmentForm getNewForm() { return new AppointmentForm(); } @RequestMapping(method = RequestMethod.POST) public String add(@Valid AppointmentForm appointment, BindingResult result) { if (result.hasErrors()) { return "appointments/new"; } appointmentBook.addAppointment(appointment); return "redirect:/appointments"; } } In the example, the @RequestMapping is used in a number of places. The first usage is on the type (class) level, which indicates that all handling methods on this controller are relative to the /appointments path. The get() method has a further @RequestMapping refinement: it only accepts GET requests, meaning that an HTTP GET for /appointments invokes this method. The post() has a similar refinement, and the getNewForm() combines the definition of HTTP method and path into one, so that GET requests for appointments/new are handled by that method.

    Read the article

  • Spring properties (property-placeholder) autowiring

    - by peperg
    I have in my applicationContext.xml <context:property-placeholder location="classpath*:*.properties" /> <bean id="clientPreferencesManager" class="pl.bildpresse.bildchat2.business.ClientPreferencesManager" > <property name="clientApiUrl" value="${clientapi.url}" /> </bean> Is it possible to do the same by autowire ? Something like : @Autowired @Qualifier("${clientapi.url}") public void setClientApiUrl(String clientApiUrl) { this.clientApiUrl = clientApiUrl; }

    Read the article

  • Spring Annotation trailing slash

    - by Eqbal
    I have a controller with @RequestMapping for root path "/". There are other controllers with say a @RequestMapping of "/test" etc. My application seems to be mapping correctly for paths like /appname/test, but if I add a trailing slash to the path, like so "/appname/test/ then it maps to the controller that has the @RequestMapping for root path "/". Any idea why?

    Read the article

  • Spring MVC 3.0: Avoiding explicit JAXBElement<> wrapper in method arg

    - by Keith Myers
    I have the following method and want to avoid having to explicitly show the JAXBElement< syntax. Is there some sort of annotation that would allow the method to appear to accept raw MessageResponse objects but in actuality work the same as shown below? I'm not sure how clear that was so I'll say this: I'm looking for some syntactic sugar :) @ServiceActivator public void handleMessageResponse(JAXBElement<MessageResponse> jaxbResponse) { MessageResponse response = jaxbResponse.getValue(); MessageStatus status = messageStatusDao.getByStoreIdAndMessageId(response.getStoreId(), response.getMessageId()); status.setStatusTimestamp(response.getDate()); status.setStatus("Complete"); }

    Read the article

  • Spring MVC, forward

    - by aauser
    Is there any difference between public class Controller1 extends AbstractController { @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { return new AnotherController().handleRequest(request, response); } } and @Controller public class Controller1 { @RequestMapping ... public String handleRequest() { return "forward:/path_to_my_another_controller"; } }

    Read the article

  • How to redirect to the same view using ModelAndview in Spring MVC framework

    - by ria
    I have a page with a link. On clicking the link a page opens up in a separate window. This new page has a form. On submitting this form, some operation takes place at the server. The result of which needs to be redirected to the same page. However after the operation on using the following: return new ModelAndView("newUser"); //This view "newUser" actually maps to the popped up window. A similar new window again pops up and the message gets displayed on this new page. Any ideas as to why this behavior or how to go about this?

    Read the article

  • Spring security - same page to deliver different content based on user role

    - by Ramesh
    Hello, i tried to search for any previous post related to my issue but couldnt find any. I have a scenario where in page handles 3 different scenarios and one of them not working. This page returns different content depending on if the user is authenticated or anonymous. localhost:8080/myApp/muUrl?test=authenticatedContent - used for Scenario 1 & 2 localhost:8080/myApp/muUrl?test=anonymousContent - used for Scenario 3 Scenario: 1) Authenticated user accesing the page url - the user gets displayed correct information. Works fine 2) Anonymous user accesing page URL with parameters that requires authentication - If anonymous, there is second level of check on the content they are accessing. for example, based on the GET parameters, there is custom logic to determine if the user has to be authenticated. In which case the page gets redirected to login page (WORKS fine). 3) Anonymous user accessing page URL with parameters that doesnt need authentication - in this case i get the SAvedRequest and redirect to the URL which is taking me to an infinite loop. Am i missing something very obvious or is there a way in AuthenticationProcessFilterEntryPoint to say "DON'T redirect to LOGIN page but process it" ? thanks.

    Read the article

  • Spring 3 MVC : problem with form:errors and bindingresult

    - by Maxime ARNSTAMM
    Hi, I want to validate my inputs but i can't make it work : nothing appear on the page. My project is in java 5, so no JSR303 (@Valid). My only solution, if i'm not mistaken, is to use BindingResult. My controller : @Controller public class MyController { @RequestMapping(method = RequestMethod.POST, value = "myPage.html") public void myHandler(MyForm myForm, BindingResult result, Model model) { result.reject("field1", "error message 1"); } } My jsp : <form:form commandName="myForm" method="post"> <label>Field 1 : </label> <form:input path="field1" /> <form:errors path="field1" /> <input type="submit" value="Post" /> </form:form> What am i missing ? Thanks !

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >