jsp - get the value selected in dropdownlist in spring mvc hibernate mysql -


Hi, I am writing an application in Spring MVC Hibernate Annotation. Here two tables are used to keep employee details. And the other to keep the team's expanses (team tables) Here I am using the drop down box in my JSP to select the team name so that all the staff can be related to that team. But I'm stuck here, I can not get the selected team.What do I want to do when I select a team, like Team 1, I want to show all the employees come under Team 1.

To select the name of the team from my SSP database, my Jasps sprite and dropdown list here show all the names from the team table

MySpace

 < Code> & lt; Tr & gt; & Lt; TD & gt; & Lt; Form: label path = "teams.teamId" & gt; Team name & lt; / Form: label & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Form: Select Path = "teams.teamId" cssStyle = "width: 150px;" & Gt; & Lt; Option value = "- 1" & gt; Choose a type & lt; / Options & gt; & Lt; Almost every item for c: "$ {teamKey}" var = "teams" & gt; & Lt; Option value = "$ {teams.teamId}" & gt; $ {Teams.teamName} & lt; / Options & gt; & Lt; / C: foreach & gt; & Lt; / Form: Selection & gt; & Lt; / TR & gt;  

Hibernate the selection query to be used in the ResourceDown implementation class

  @Override Public Zero Search Resource (ET Timid) {// TODO Auto generated Method stub system Out .println ("Timed is ----------:" + Timid); Sessionfactory.getCurrentSession () CreateQuery ("resource WHERE Team ID =" + Timid); System.out.println ("Query timed is given after - *************************************************** Public model and view search release (@model attribute ("command");  

control class

  @RequestMapping (value = "/ searchResult", method = RequestMethod.GET) ) Resource Resources, Binding Results Results) {resourceServices.serchResources (resource.getTeams (.) GetTeamId ()); Map & lt; string, object & gt; model = new hashmop & lt; string; object & gt; (); Model.put ("resourcekey", resourceServices.listResources ()); Model.put ("teamKey", addteamServices.listTeams ()); New model and visual flame ("Search", model);}  

console

  HTTP status 500 - request process failed; nested exception java.lang.NullPointerException - ----------------------------------------- --------- ----------------------------- Type exception report failed message request process; nested exceptions java.lang.NullPointerException Description Server has an internal error Found that prevented this request from fulfilling Exception org.springframework.web.util.NestedServletException: The request process fails; Nested exception java.lang.NullPointerException org.springframework.web.servlet.FrameworkServlet.processRequest (FrameworkServlet.java:659) org.springframework.web.servlet.FrameworkServlet.doGet (FrameworkServlet.java:552) is javax.servlet.http. HttpServlet.service (HttpServlet.java:620) javax.servlet.http.HttpServlet.service (HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:52) Java root cause. Lang.NullPointerException com.resource.ResourceController.ResourceController.searchResult (ResourceController.java:130) sun.reflect.NativeMethodAccessorImpl.invoke0 (Basic method) sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57) sun.reflect.DellegatingMethodAccessorImpl. Call (DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke (Method.java:601) org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod (HandlerMethodInvoker.java:710) org.spri Ngframework .web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod (HandlerMethodInvoker.java:167) org.springframework.web.servlet.mvc.annotation.nnnation.AnnotationMethodHandlerAdapter.invokeHandlerMethod (AnnotationModerHandlerAdapter.javascript 14) org.springframework.web.servlet. Mvc.annotation.notation.AnnotationMethodHandlerAdapter.handle (AnnotationMandularRadder.Java 402) org.springframework.web.servlet.DispatcherServlet.Dispatch (DispatcherServlet.java:771) org.springframework.web.servlet.DispatcherServlet.doService (DispatcherServlet.java:716) ) Orgkspringfrmevorkkvebksserwletkfrmevorksserwletkprosssrekuast (Frmevorksserwletkjawa:647) Orgkspringfrmevorkkvebksserwletkfrmevorksserwletkdoget (Frmevorksserwletkjawa:552) Jvksksserwlet.actiteepikhttpsserwletksrvis (Httpsserwletkjawa : 620) javax.servlet.http.HttpServlet.service (HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter (WsFilter.java:52)  

Please help ... Thanks in one Dvance ..


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -