You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by PEGASUS84 <pe...@hotmail.it> on 2009/03/16 12:04:53 UTC
System.out into interceptor
excuse me!!!
how can I show in a jsp page the text which is into an interceptor
[snipp]
public String intercept(.....
System.out.print("text")
[/snipp]
In result page the text doesn't appear
--
View this message in context: http://www.nabble.com/System.out-into-interceptor-tp22535922p22535922.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: System.out into interceptor
Posted by Chris Pratt <th...@gmail.com>.
Even simplester solution ${param.caio}
(*Chris*)
On Mon, Mar 16, 2009 at 11:05 AM, Lukasz Lenart <
lukasz.lenart@googlemail.com> wrote:
> On Mon, Mar 16, 2009 at 5:31 PM, PEGASUS84 <pe...@hotmail.it> wrote:
> > <%out.print(request.getParameter("ciao"))%>
>
> Simplest solution
> <%= request.getParameter("ciao") %>
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: System.out into interceptor
Posted by Lukasz Lenart <lu...@googlemail.com>.
On Mon, Mar 16, 2009 at 5:31 PM, PEGASUS84 <pe...@hotmail.it> wrote:
> <%out.print(request.getParameter("ciao"))%>
Simplest solution
<%= request.getParameter("ciao") %>
Regards
--
Lukasz
http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: System.out into interceptor
Posted by Dave Newton <ne...@yahoo.com>.
PEGASUS84 wrote:
> please can you tell me
> any quicly method to implement this
> because i've not time
O_o
Dave
>
>
>
>
>
>
> Nils-Helge Garli wrote:
>> You're setting a request attribute, but trying to access a request
>> parameter. Also, I would recommend that you do not access the output
>> stream directly. I suggest you take some time to study some
>> servlet/jsp tutorials, and then move on to the Struts 2 bootstrap
>> guides.
>>
>> Nils-H
>>
>> On Mon, Mar 16, 2009 at 5:31 PM, PEGASUS84 <pe...@hotmail.it> wrote:
>>> that's right!
>>> now i realize this:
>>>
>>> import com.opensymphony.xwork2.ActionInvocation;
>>> import com.opensymphony.xwork2.interceptor.Interceptor;
>>> import com.opensymphony.xwork2.Action;
>>> import javax.servlet.http.HttpServletRequest;
>>> import com.opensymphony.xwork2.ActionContext;
>>> import java.util.*;
>>>
>>>
>>> public class filtro implements Interceptor {
>>>
>>> private HttpServletRequest request;
>>> public void setServletRequest(HttpServletRequest request){
>>> this.request = request;
>>> }
>>>
>>> public HttpServletRequest getServletRequest(){
>>> return request;
>>> }
>>>
>>>
>>>
>>> public void destroy() {
>>> }
>>> public void init() {
>>> }
>>> public String intercept( ActionInvocation actionInvocation) throws
>>> Exception{
>>>
>>> Map session = actionInvocation.getInvocationContext().getSession();
>>> utente user = (utente)session.get("autenticato");
>>> if (user != null)
>>> request.setAttribute("ciao","condizione");
>>> return Action.ERROR;
>>>
>>>
>>> }
>>>
>>> }
>>>
>>> and into jsp page:
>>>
>>> <%out.print(request.getParameter("ciao"))%>
>>>
>>> but it doesn't work
>>> --
>>> View this message in context:
>>> http://www.nabble.com/System.out-into-interceptor-tp22535922p22541213.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: System.out into interceptor
Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
http://www.google.com/search?q=java+servlet+tutorial
http://struts.apache.org/2.1.6/docs/tutorials.html
Nils-H
On Mon, Mar 16, 2009 at 9:02 PM, PEGASUS84 <pe...@hotmail.it> wrote:
>
> please can you tell me
> any quicly method to implement this
> because i've not time
>
>
>
>
>
>
> Nils-Helge Garli wrote:
>>
>> You're setting a request attribute, but trying to access a request
>> parameter. Also, I would recommend that you do not access the output
>> stream directly. I suggest you take some time to study some
>> servlet/jsp tutorials, and then move on to the Struts 2 bootstrap
>> guides.
>>
>> Nils-H
>>
>> On Mon, Mar 16, 2009 at 5:31 PM, PEGASUS84 <pe...@hotmail.it> wrote:
>>>
>>> that's right!
>>> now i realize this:
>>>
>>> import com.opensymphony.xwork2.ActionInvocation;
>>> import com.opensymphony.xwork2.interceptor.Interceptor;
>>> import com.opensymphony.xwork2.Action;
>>> import javax.servlet.http.HttpServletRequest;
>>> import com.opensymphony.xwork2.ActionContext;
>>> import java.util.*;
>>>
>>>
>>> public class filtro implements Interceptor {
>>>
>>> private HttpServletRequest request;
>>> public void setServletRequest(HttpServletRequest request){
>>> this.request = request;
>>> }
>>>
>>> public HttpServletRequest getServletRequest(){
>>> return request;
>>> }
>>>
>>>
>>>
>>> public void destroy() {
>>> }
>>> public void init() {
>>> }
>>> public String intercept( ActionInvocation actionInvocation) throws
>>> Exception{
>>>
>>> Map session = actionInvocation.getInvocationContext().getSession();
>>> utente user = (utente)session.get("autenticato");
>>> if (user != null)
>>> request.setAttribute("ciao","condizione");
>>> return Action.ERROR;
>>>
>>>
>>> }
>>>
>>> }
>>>
>>> and into jsp page:
>>>
>>> <%out.print(request.getParameter("ciao"))%>
>>>
>>> but it doesn't work
>>> --
>>> View this message in context:
>>> http://www.nabble.com/System.out-into-interceptor-tp22535922p22541213.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/System.out-into-interceptor-tp22535922p22544593.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: System.out into interceptor
Posted by PEGASUS84 <pe...@hotmail.it>.
please can you tell me
any quicly method to implement this
because i've not time
Nils-Helge Garli wrote:
>
> You're setting a request attribute, but trying to access a request
> parameter. Also, I would recommend that you do not access the output
> stream directly. I suggest you take some time to study some
> servlet/jsp tutorials, and then move on to the Struts 2 bootstrap
> guides.
>
> Nils-H
>
> On Mon, Mar 16, 2009 at 5:31 PM, PEGASUS84 <pe...@hotmail.it> wrote:
>>
>> that's right!
>> now i realize this:
>>
>> import com.opensymphony.xwork2.ActionInvocation;
>> import com.opensymphony.xwork2.interceptor.Interceptor;
>> import com.opensymphony.xwork2.Action;
>> import javax.servlet.http.HttpServletRequest;
>> import com.opensymphony.xwork2.ActionContext;
>> import java.util.*;
>>
>>
>> public class filtro implements Interceptor {
>>
>> private HttpServletRequest request;
>> public void setServletRequest(HttpServletRequest request){
>> this.request = request;
>> }
>>
>> public HttpServletRequest getServletRequest(){
>> return request;
>> }
>>
>>
>>
>> public void destroy() {
>> }
>> public void init() {
>> }
>> public String intercept( ActionInvocation actionInvocation) throws
>> Exception{
>>
>> Map session = actionInvocation.getInvocationContext().getSession();
>> utente user = (utente)session.get("autenticato");
>> if (user != null)
>> request.setAttribute("ciao","condizione");
>> return Action.ERROR;
>>
>>
>> }
>>
>> }
>>
>> and into jsp page:
>>
>> <%out.print(request.getParameter("ciao"))%>
>>
>> but it doesn't work
>> --
>> View this message in context:
>> http://www.nabble.com/System.out-into-interceptor-tp22535922p22541213.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/System.out-into-interceptor-tp22535922p22544593.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: System.out into interceptor
Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
You're setting a request attribute, but trying to access a request
parameter. Also, I would recommend that you do not access the output
stream directly. I suggest you take some time to study some
servlet/jsp tutorials, and then move on to the Struts 2 bootstrap
guides.
Nils-H
On Mon, Mar 16, 2009 at 5:31 PM, PEGASUS84 <pe...@hotmail.it> wrote:
>
> that's right!
> now i realize this:
>
> import com.opensymphony.xwork2.ActionInvocation;
> import com.opensymphony.xwork2.interceptor.Interceptor;
> import com.opensymphony.xwork2.Action;
> import javax.servlet.http.HttpServletRequest;
> import com.opensymphony.xwork2.ActionContext;
> import java.util.*;
>
>
> public class filtro implements Interceptor {
>
> private HttpServletRequest request;
> public void setServletRequest(HttpServletRequest request){
> this.request = request;
> }
>
> public HttpServletRequest getServletRequest(){
> return request;
> }
>
>
>
> public void destroy() {
> }
> public void init() {
> }
> public String intercept( ActionInvocation actionInvocation) throws
> Exception{
>
> Map session = actionInvocation.getInvocationContext().getSession();
> utente user = (utente)session.get("autenticato");
> if (user != null)
> request.setAttribute("ciao","condizione");
> return Action.ERROR;
>
>
> }
>
> }
>
> and into jsp page:
>
> <%out.print(request.getParameter("ciao"))%>
>
> but it doesn't work
> --
> View this message in context: http://www.nabble.com/System.out-into-interceptor-tp22535922p22541213.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: System.out into interceptor
Posted by PEGASUS84 <pe...@hotmail.it>.
that's right!
now i realize this:
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import com.opensymphony.xwork2.Action;
import javax.servlet.http.HttpServletRequest;
import com.opensymphony.xwork2.ActionContext;
import java.util.*;
public class filtro implements Interceptor {
private HttpServletRequest request;
public void setServletRequest(HttpServletRequest request){
this.request = request;
}
public HttpServletRequest getServletRequest(){
return request;
}
public void destroy() {
}
public void init() {
}
public String intercept( ActionInvocation actionInvocation) throws
Exception{
Map session = actionInvocation.getInvocationContext().getSession();
utente user = (utente)session.get("autenticato");
if (user != null)
request.setAttribute("ciao","condizione");
return Action.ERROR;
}
}
and into jsp page:
<%out.print(request.getParameter("ciao"))%>
but it doesn't work
--
View this message in context: http://www.nabble.com/System.out-into-interceptor-tp22535922p22541213.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: System.out into interceptor
Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Please don't create new threads for existing questions. Obviously,
System.out won't print to the JSP. So you have to put the message
somewhere (request, session, action) your JSP can look it up and use
it.
Nils-H
On Mon, Mar 16, 2009 at 12:04 PM, PEGASUS84 <pe...@hotmail.it> wrote:
>
> excuse me!!!
> how can I show in a jsp page the text which is into an interceptor
>
>
> [snipp]
>
> public String intercept(.....
>
> System.out.print("text")
>
> [/snipp]
>
> In result page the text doesn't appear
>
>
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/System.out-into-interceptor-tp22535922p22535922.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org