Back Forum Reply New

sitemesh + decorator + spring

.JIoEndpoint$SocketProce  ssor.run(JIoEndpoint.java:288)
at java.util.concurrent.ThreadPoolExecutor.runWorker(  ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run  (ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)Here is my LoginController..Code:
package org.iit.helloworld.web.controller;

import java.io.IOException;

import javax.servlet.from.fromServletResponse;
import javax.servlet.from.fromSession;

import org.iit.helloworld.db.LoginCommand;
import org.iit.helloworld.db.User;
import org.iit.helloworld.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org..beans.factory.annotation.Autowired;
import org..stereotype.Controller;
import org..ui.ModelMap;
import org..validation.BindingResult;
import org..validation.ValidationUtils;
import org..web.bind.annotation.ModelAttribute;
import org..web.bind.annotation.RequestMapping;
import org..web.bind.annotation.RequestMethod;

@Controller
public class LoginController {
private static final Logger log = LoggerFactory
.getLogger(LoginController.class);

@Autowired
UserService userService;

@RequestMapping(value = quot;/loginquot;, method = RequestMethod.GET)
public void showForm(ModelMap model) {
log.debug(quot;entered showLoginFormquot;);
model.put(quot;commandquot;, new LoginCommand());
}

@RequestMapping(value = quot;/loginquot;, method = RequestMethod.POST)
public void processForm(@ModelAttribute() LoginCommand command,
BindingResult result, fromSession session) {
validate(command, result);
if (result.hasErrors()) {
return;
}
User user = userService.getUserByNameAndPassword(command.getUserName(),
command.getPassword());
if (user != null) {
log.debug(quot;user login successfully, id={},userName={}quot;, command
.getUserName(), command.getPassword());
session.setAttribute(quot;USERquot;, user);
}
}

@RequestMapping(value = quot;/logoutquot;, method = RequestMethod.GET)
public void logout(fromSession session, fromServletResponse response)
throws IOException {
session.invalidate();
response.sendRedirect(quot;loginquot;);
}

private void validate(LoginCommand command, BindingResult result) {
ValidationUtils.rejectIfEmptyOrWhitespace(result, quot;userNamequot;,
quot;common.requiredquot;);
ValidationUtils.rejectIfEmptyOrWhitespace(result, quot;passwordquot;,
quot;common.requiredquot;);
}
}

Can anyone please help me...
¥
Back Forum Reply New