Is ${pageContext.request.servletPath} returning anything? Try something like

<html:hidden property="requestedPage"><c:out value="${pageContext.request.servletPath}"/></html:hidden>

Use the JSTL core tag library at http://java.sun.com/jstl/core to get "c:out" ...

Arne Brutschy wrote:

Hello,

I'm having a problem with the html:hidden tag. What I'm trying to do is:

On every page, there is a logout button included. When the user hits
the button, the request will be send to an logoutAction. Afterwards,
the request should be redirected back to the page where the user was
before he hit the button. My problem is, that the including page is
every time another one. So I tried to get it by
${pageContext.request.servletPath}. This works, but I cannot use it as
value in the html:hidden tag. I've seen people on this list doing
this, but my html-el.tld permits it. Does anyone know why? I'm using
struts 1.1 with the standard taglib ea 1.1, tomcat 5.0.12.

Here is my jsp include:

   <%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el"; prefix="html" %>
     .
     .
     .
   <html:form action="login.do">
     <html:hidden property="dispatch" value="logout"/>
     <html:hidden property="requestedPage" value="${pageContext.request.servletPath}"/>
     <html:submit><bean:message key="login.button.logout"/></html:submit>
   </html:form>


and the action:


 public ActionForward logout(ActionMapping mapping, ActionForm form, 
HttpServletRequest request,
                              HttpServletResponse response) throws Exception {

   // get session and loginForm
   HttpSession session = request.getSession(true);
   DynaActionForm loginForm = (DynaActionForm)form;

   // remove the user from the session
   session.removeAttribute("user");
     .
     .
   // stay on this page
   String requestedPage = loginForm.get("requestedPage").toString();
   response.sendRedirect(requestedPage);

   return null;
 }


Regards, Arne Brutschy



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to