Solved

not able update the data into the database

Posted on 2014-04-30
2
178 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 250 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 250 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

733 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