Getting the list of parameters passed in printed

Hi, how do I print the arguments that are passed into my jsp? I remember there being a simple way to do this but have forgotten. thanks

Comments

  • : Hi, how do I print the arguments that are passed into my jsp? I remember there being a simple way to do this but have forgotten. thanks
    :

    What method do you use to pass in the arguments? via request object, session object, or query string?

    Here are examples of printing out argument passing via request object, session object, and query string:

    Via Request Object: (Assuming you have set the request attribute)
    -----------------------------------------------------------------
    String msg = (String) request.getAttribute( "greetingMessage" );
    out.println( "
    " + msg + "
    " );
    or
    <%=msg%>



    Via Session Object: (Assuming you have set the session attribute)
    -----------------------------------------------------------------
    String msg = (String) session.getAttribute( "greetingMessage" );
    out.println( "
    " + msg + "
    " );
    or
    <%=msg%>



    Via Query String:
    -----------------
    String msg = request.getParameter( "greetingMessage" );
    out.println( "
    " + msg + "
    " );
    or
    <%=msg%>



    Hope this help.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion