开发者

Web roo and user session

开发者 https://www.devze.com 2023-03-05 23:36 出处:网络
I am new to spring roo and I have had some difficulties finding out the ressources needed to go forward with my projet.

I am new to spring roo and I have had some difficulties finding out the ressources needed to go forward with my projet.

I would like to use a finder, see this answer:

In Spring Roo : what is a dynamic finder?

Now I would like to use the logged-in username as parameter of a finder. Ho开发者_Go百科w could I do ?


You can list all available finders and add the finder you need to your application using the following documentation. You can read more in corresponding question.

Then you can modify corresponding method in corresponding Spring MVC controller adding Principal parameter the following way:

@RequestMapping(method = RequestMethod.GET)   
public ModelAndView showResults(final HttpServletRequest request, Principal principal) {
    final String currentUser = principal.getName();
    ...
}

Remember you should't modify it right in ITD but you should copy it to the corresponding *.java controller first. In this method you should modify list which used inside with usage of your finder.

And finally you can exclude your dynamic finders from scaffolding by using exposeFinders=false of RooWebScaffold annotation.

0

精彩评论

暂无评论...
验证码 换一张
取 消