top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

s:token doesn't accept data- attributes, cssClass ignored

+1 vote
407 views

I am creating an ajax call for a method which is protected by the TokenSessionStoreInterceptor. This means I need to pass the token onto the request.

I was expecting the s:token tag to accept data-foo="bar" attributes (they'd be passed along to the corresponding hidden elements), but this is not happening (I'd use this so I could retrieve the inputs with a
simple jquery select .find(":input[data-scope='save'], which retrieves me all the needed inputs as long as I mark them with that data-scope ).

My 2nd attempt was also unsuccessful - while doesn't break rendering, the class is not passed onto the hidden input elements.

Is there a reason for this? While in the case of data-foo this seems to be a missing feature, in the case of cssClass it's also misleading - you can set the property, but it doesn't have any consequence.

posted Oct 2, 2013 by Seema Siddique

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

The problem is that, it base on AbstractUITag and inherits all those commons attributes, but token.ftl doesn't use them at all - I now, it's misleading.

You can try define your own /template/simple/token.ftl with additional parameters or feel free to register an issue.

answer Oct 3, 2013 by Kumar Mitrasen
Similar Questions
+1 vote

I have a problem/doubt and describing here.I am using struts1.1(no plain jsp's only struts tags) and needs to implement ajax in that.Q-1) With out giving "action" property can't we write ?. If no I am using ajax in that
form(now my form having button to submit form data). Could any one please help how to add my response back to form variable in same page.

Login Success

my action class is

package app;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class DetailsAction extends Action {    
 public ActionForward execute (ActionMapping mapping, ActionForm  form, HttpServletRequest request,HttpServletResponse  response) throws Exception    
 {
 RegisterForm detailsForm = (RegisterForm)form;
 detailsForm.setUsername("Struts");
 System.out.println("inr"+detailsForm.getUsername());
 return mapping.findForward("success");
 }    
} 
+1 vote

I have a web application which is deployed on a Tomcat server (version 7). I have set the session timeout value as 10 minutes in the web.xml file. In pages with no Ajax call, the session time out value is reset promptly. But it is not renewed on pages with Ajax calls. Web application is taking user back to Login screen even though some activity is happening on the page (with Ajax).

Can anyone help me?

+2 votes

I am facing an issue related to maintaining session token value when we have window forms.

We have a main form, which needs token to submit. There is a link through which we can open a window , which also needs token and can submit the form.

Once we close the window and try to submit the main form, we get token mismatch error. Because the session token had changed by this time.

Is there any solution for this issue.

...