Solved

not able update the data into the database

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 91
servlet doXXX methods 3 49
hibernate example for saving data 19 42
iterator/ListIterator approach 17 27
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

777 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