Author Login
Post Reply
user Digest 8 Aug 2010 06:10:39 -0000 Issue 9141
Topics (messages 207148 through 207150):
Re: Struts2+json question
207148 by: Steven Yang
s:url tag - multiple params with same name
207149 by: Stephen Turner
Re : s:url tag - multiple params with same name
207150 by: François Rouxel
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_207148.ezm (zipped)this is the matter with how you handle your result in your javascript and
how you communicate with your javascript
in you case, you should always return a json because your doing your
validation by AJAX right?
its in your javascript that you need to tell whether the login was
successful or not, if it is then redirect.
I havent used Extjs for a while, so i dont remember whether ur syntax
actually submits the page or Ext will submit by AJAX for you
On Thu, Aug 5, 2010 at 11:49 PM, red phoenix <rodphoenix@(protected):
> I use struts2.1.8 and extjs3.2, I make a login page, if login
> failed,it will alert a message and it will still stay this login page;
> if it login success,it will go to another new page,such as main.jsp
> page
>
> My login page is follows:
> var win=new Ext.Window({
> el:'hello-win',
> ....
> items:
> loginForm,
> buttons:[{
> text:'OK',
> handler:function(){
> if(win.getComponent('loginForm').form.isValid()){
> win.getComponent('loginForm').form.submit({
> url:'/Test/test.do',
> success:function(form,action){
> Ext.Msg.alert("Login success!",action.result.message);
> },
> failure:function(form,action){
> Ext.Msg.alert('Login fail",action.result.message);
> }
> });
> }
> }
> }
> });
>
> Action class is follows:
> public String login() throws Exception{
> boolean success;.
> ....
> if(success){
> return SUCCESS;
> }
> else{
> setMessage("Your ID or password is wrong");
> return null;
> }
> }
>
> configure file is follows:
> <struts>
> <package name="Test" namespace="" extends="json-default">
> <action name="login" class="Test.Login" method="test">
> <result type="json"/>
> </action>
> </package>
> </struts>
>
> If I set <result>main.jsp</result>, when I click OK button,it will
> raise javascript error,because extjs don't get json message.
> If I set <result type="json"/>,whether I login success or fail,the
> login page will don't redirect,If login success,I want to redirect
> this page to main.jsp,but it don't redirect.What can I do about
> configure file? I don't know how to do it.I have no idea about it.
> Any idea will be appreciated!
>
> Thanks in advance
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_207149.ezm (zipped)
Hello all,
I'd like to format a URL with multiple parameters having the same name, eg:
?pn=firstval&pn=secondval&pn=thirdval
Is this possible using <s:url> ? I've tried this:
<s:url...>
<param name="pn" value="firstval" />
<param name="pn" value="secondval" />
<param name="pn" value="thirdval" />
</s:url>
This doesn't work - I get:
?pn=thirdval
Doing something similar with the JSTL <c:url> tag does work, but I'd like
to stick with the struts tag if possible.
Thanks,
Steve

Attachment:
user_207150.ezm (zipped)should be working, did you put in s:url tag includeParameters='get' ?
____________________________________________
____________________________________________
----- Message d'origine ----
De : Stephen Turner <sturner@(protected)>
À : user@(protected)
Envoyé le : Ven 6 août 2010, 16h 48min 06s
Objet : s:url tag - multiple params with same name
Hello all,
I'd like to format a URL with multiple parameters having the same name, eg:
?pn=firstval&pn=secondval&pn=thirdval
Is this possible using <s:url> ? I've tried this:
<s:url...>
<param name="pn" value="firstval" />
<param name="pn" value="secondval" />
<param name="pn" value="thirdval" />
</s:url>
This doesn't work - I get:
?pn=thirdval
Doing something similar with the JSTL <c:url> tag does work, but I'd like to
stick with the struts tag if possible.
Thanks,
Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)