0

how to pass parameter to zul page from login form using spring security in zk

asked 2017-01-16 13:03:54 +0800

lovasoa gravatar image lovasoa
1

I create a crud zk project by following a tutorial ij this site, which uses spring security.It works when i use a simple login form, but not, with spring security, is there any way to pass parameter to zul page using spring security,

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2017-01-16 18:05:02 +0800

Darksu gravatar image Darksu
1991 1 4

Hello lovasoa,

Have you checked out the official documentation?

https://www.zkoss.org/wiki/ZKDeveloper'sReference/Integration/Security/Spring_Security

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2017-01-17 01:19:09 +0800

lovasoa gravatar image lovasoa
1

Thank you for your response Darksu, but I still can't resolve my problem What I want to do is to get data from login form and show it in an other zul page I tried this example by using HashMap<string, object="">, This is the login.zul,

... <groupbox> <h:form id="f" name="f" action="j_spring_security_check" method="POST" xmlns:h="<a href=" http:="" www.w3.org="" 1999="" xhtml"="">http://www.w3.org/1999/xhtml"> <grid >="" <columns="" sizable="false"> <column width="50%"/> <column width="50%"/> </columns> <rows> <row> <label value="LOGIN"/> <textbox id="u" name="j_username"/> </row> <row> <label value="MOT DE PASSE"/> <textbox id="p" type="password" name="j_password"/> </row> <row >="" <h:input="" sclass="btn-primary" type="submit" value="SE CONNECTER" onclick="@command('set')"/> <h:input sclass="btn-primary" type="reset" value="RESET"/>

                </row>
            </rows>
        </grid>
    </h:form>
</groupbox>

...

And this is the MyUserDetailsService class, the example I follow uses MySQL asdatabase(it works well), I added PassParameter class in this class, as shown:

--//-- ... public class MyUserDetailsService implements UserDetailsService { ... //public UserDetails loadUserByUsername(String username) // throws UsernameNotFoundException, DataAccessException { ... @SuppressWarnings("serial") public class Passparameter extends SelectorComposer<window>{ @Wire Textbox u; @Wire Textbox p; @Listen("onClick=#showWindow") public void submit() { final HashMap<string, object=""> map = new HashMap<string, object="">(); map.put("u", u.getValue()); } }

--//--

And in Informations.zul page,

<window title="new page title" border="normal" apply="crudexample.controller.Informations"> <label value="You have entered as username: "></label> <separator></separator> <textbox id="u" value="@{$composer.u}"></textbox> <separator></separator> </window> </zk>

The Informations class is:

... package domain;

import org.zkoss.zk.ui.Execution; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.select.SelectorComposer; import org.zkoss.zk.ui.select.annotation.Wire; import org.zkoss.zul.Textbox; import org.zkoss.zul.Window;

@SuppressWarnings("serial") public class Informations extends SelectorComposer<window> { @Wire Textbox u; public void doAfterCompose(Window comp) throws Exception { super.doAfterCompose(comp); final Execution execution = Executions.getCurrent(); u.setValue((String) execution.getArg().get("u")); comp.setAttribute("cp", this); }

} --//--

Could you tell me where is the problem, because I don't know what doesn't work in the code,

link publish delete flag offensive edit
0

answered 2017-01-17 08:44:49 +0800

Darksu gravatar image Darksu
1991 1 4

updated 2017-01-17 13:16:03 +0800

Hello lovasoa,

Please refer to the following documentation in order to save the user credentials:

https://www.zkoss.org/wiki/ZKEssentials/Chapter8:_Authentication

Only concern if you actually want to save the information in the session.

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2017-01-17 12:10:29 +0800

alice1021 gravatar image alice1021
1

sorry,I don't know.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2017-01-16 13:03:54 +0800

Seen: 62 times

Last updated: Jan 17 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More