You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Met @ Uber" <me...@uberstats.com> on 2003/05/06 01:44:55 UTC

request.getAttribute() Error

In a JSP page I have the following:

<%
  String url = request.getAttribute("redirectUrl");
  response.sendRedirect(url);
%>

This generates the following error:

Generated servlet error:
    [javac] Since fork is true, ignoring compiler setting.
    [javac] Compiling 1 source file
    [javac] Since fork is true, ignoring compiler setting.
    [javac] /usr/local/java/src/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/thepaperclipse/forward_0002durl_jsp.java:10: cannot resolve symbol
    [javac] symbol  : variable request 
    [javac] location: class org.apache.jsp.forward_0002durl_jsp
    [javac]  String url = request.getAttribute("redirectUrl"); 
    [javac]               ^
    [javac] 1 error

But if I do <%= request.getAttribute("redirectUrl")%> it prints my desired 
string.  But I need that string inside of the response.sendRedirect() so 
that I can forward my users off of the site and to this link.

Any suggestions?

~ Matthew
-- 
Met @ Uber <me...@uberstats.com>
Uberstats


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: request.getAttribute() Error

Posted by Dan Tran <da...@hotmail.com>.
request.getAttribute() returns Object, you need to cast it to String.
-D
----- Original Message ----- 
From: "Met @ Uber" <me...@uberstats.com>
To: "Struts Users" <st...@jakarta.apache.org>
Sent: Monday, May 05, 2003 4:44 PM
Subject: request.getAttribute() Error


> In a JSP page I have the following:
>
> <%
>   String url = request.getAttribute("redirectUrl");
>   response.sendRedirect(url);
> %>
>
> This generates the following error:
>
> Generated servlet error:
>     [javac] Since fork is true, ignoring compiler setting.
>     [javac] Compiling 1 source file
>     [javac] Since fork is true, ignoring compiler setting.
>     [javac]
/usr/local/java/src/tomcat/jakarta-tomcat-4.1.24/work/Standalone/localhost/t
hepaperclipse/forward_0002durl_jsp.java:10: cannot resolve symbol
>     [javac] symbol  : variable request
>     [javac] location: class org.apache.jsp.forward_0002durl_jsp
>     [javac]  String url = request.getAttribute("redirectUrl");
>     [javac]               ^
>     [javac] 1 error
>
> But if I do <%= request.getAttribute("redirectUrl")%> it prints my desired
> string.  But I need that string inside of the response.sendRedirect() so
> that I can forward my users off of the site and to this link.
>
> Any suggestions?
>
> ~ Matthew
> -- 
> Met @ Uber <me...@uberstats.com>
> Uberstats
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org