Validation with wildcards
Hi Guys, I expreinced another trouble with my validator using wildcards definitions. I've got the following in my struts.xml /index.jsp /login/login.jsp /login/login.jsp I've got two methods: login and logout. So my action url is http://mywebsite.com/Login_login.action I've created a xml validator named: Login_login-validation.xml Unfortunetly its doesn't work. I submit my login form and the validator does not valid my fields. It goes directly to process the action method. Did i miss something ? Does someone can help me ? Thanks in advance. E
Re: Mgnt Error message
Hi, Thanks for your help but I found my mistake. Ive had the parameter type="redirect" in the result (struts.xml): /register/step1.jsp and since i removed it, it works /register/step1.jsp Rgs, E Hi, I dont see <%@ taglib prefix="s" uri="/struts-tags" %> in your jsp page, this may be the problem. Thanks, Nuwan. - Original Message - From: "ekoje ekoje" <[EMAIL PROTECTED]> To: "user" Sent: Wednesday, February 28, 2007 12:04 PM Subject: Mgnt Error message HI Guys, I tried to manage some custom error messages using ActionMessage and ActionError. I set the text message in the Action and redirect to the ERROR result but I don't have any text displayed in the JSP when I use actionmessage tag and actionerror tag. Did i miss something ? any configuration ? Please find my code, Action: import javax.servlet.http.HttpServletRequest; import org.apache.struts2.interceptor.ServletRequestAware; import com.opensymphony.xwork2.ActionSupport; public class TestAction extends ActionSupport implements ServletRequestAware { private static final long serialVersionUID = -7505437345373234225L; private HttpServletRequest request; public String execute(){ addActionMessage("TE"); addActionError("SECONDDD"); return ERROR; } public void setServletRequest(HttpServletRequest httpServletRequest) { this.request = httpServletRequest; } } JSP COde: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Insert title here Error Message Error Message Error Message I will apreciate any help. Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mgnt Error message
HI Guys, I tried to manage some custom error messages using ActionMessage and ActionError. I set the text message in the Action and redirect to the ERROR result but I don't have any text displayed in the JSP when I use actionmessage tag and actionerror tag. Did i miss something ? any configuration ? Please find my code, Action: import javax.servlet.http.HttpServletRequest; import org.apache.struts2.interceptor.ServletRequestAware; import com.opensymphony.xwork2.ActionSupport; public class TestAction extends ActionSupport implements ServletRequestAware { private static final long serialVersionUID = -7505437345373234225L; private HttpServletRequest request; public String execute(){ addActionMessage("TE"); addActionError("SECONDDD"); return ERROR; } public void setServletRequest(HttpServletRequest httpServletRequest) { this.request = httpServletRequest; } } JSP COde: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Insert title here Error Message Error Message Error Message I will apreciate any help. Thanks,
[S2] Filter Cookie
Hi Guys, I would like to check a cookie every time a user try to access my website. So, I've created an interceptor, it work fine but it didn't work if the user ask for a JSP page. The interceptor was never called. So, I've created a filter who check all cookies at every request to my server. Unfortunetly it doesn't work too, every time my request parameters and cookies are empty even if I'm sure that I can find a cookie. Is there anything in Struts 2 who remove all data in the request object ??? Please find the code: public final class LoginFilter implements Filter { private final static String FILTER_APPLIED = "_clickstream_filter_applied"; private FilterConfig filterConfig = null; public void init(FilterConfig filterConfig) throws ServletException { this.filterConfig = filterConfig; } public void destroy() { this.filterConfig = null; } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request.getAttribute (FILTER_APPLIED) == null) { request.setAttribute(FILTER_APPLIED, Boolean.TRUE); Cookie[] cookies = ((HttpServletRequest) request).getCookies(); if (cookies != null) { System.out.println(cookies.length); for (int i = 0; i < cookies.length; i++) { System.out.println(cookies[i].getName()); if (cookies != null && cookies[i].getName().equals("ebespoke")) { System.out.println("cookie found"); if (AccountManager.isCookieLogin(cookies[i].getValue())) { System.out.println("cookie alive"); String[] values = StringUtils.split(cookies[i].getComment(), "|"); ((HttpServletRequest) request).getSession().setAttribute("userD", AccountManager.getUserDetails (values[0])); } } } } } chain.doFilter(request, response); } } Thanks for your help