Solved

not able update the data into the database

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now