[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

not able update the data into the database

Posted on 2014-04-30
2
Medium Priority
?
214 Views
Last Modified: 2014-05-03
Not able to update the record in the database using edit controller
I need to edit description from  particular code

getting error

org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'code' is not present

Open in new window


@RequestMapping(value = "/editRights")
			public String editrights(
					HttpServletRequest request,
					HttpServletResponse response,
					@RequestParam("code") String code, 
					@RequestParam("Description") String Strname,
					HttpSession session,
					Model model) {
				
				

				List<Rights> groups = new ArrayList<Rigsht>();
				Rights right = null;
				EntityManager em = ToplinkUtil.getViewableEntityManager( request, "owner" );
				
				try {
					Right1 = Rights.findAll(em);
					right= em.find(Right.class, code);
					em.refresh(code);
					
					model.addAttribute("code", code);
					
			
					return "user/mainGroups";
				} catch (Exception e) {
					return "failure";
				} finally {
					em.close();
				}
			}

Open in new window


find all method

public static List<Rights> findAll( EntityManager em ) {
    List<WebdUserGroup> results = em.createQuery( "select distinct wug from Rights wug order by wug.code" ).getResultList();
    return results;
  }

Open in new window

0
Comment
Question by:roy_sanu
2 Comments
 
LVL 8

Accepted Solution

by:
Ganapathi earned 1000 total points
ID: 40031371
There is no request parameter of type "String" with name @RequestParam("code") to bind to variable code.

You must be missing "code" in the request. Check for spelling/case.
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 40031756
List<Rights> groups = new ArrayList<Rigsht>();

Open in new window


The code you posted won't actually compile, for the above reason alone
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question