Hi ,

I tried using

request.setAttribute("name", "newName");

try
{
String path = "/SomeJSP.jsp"
getServletConfig().getServletContext().getRequestDispatcher(path).forwar d(request, response);
}
catch(Exception ex)
{
ex.printStackTrace();
}


When i do a request.getParameter in my JSP page .. it returns a blank sting "" . This is the reason I thought maybe request.setAttribute is not the method I should be using. Do you have any clues as to why this might be happening ?

Thanks


On Thursday, March 27, 2003, at 02:37 AM, Filip Hanik wrote:


that is what request.setAttribute is there for.

you can also look at JSP forward, that allows you to set parameters, not sure how this translates to a servlet

http://java.sun.com/products/jsp/syntax/1.1/syntaxref1110.html


filip


-----Original Message-----
From: Mufaddal Khumri [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 12:33 AM
To: Tomcat List
Subject: request parameter question ...


Hi ,


In my servlet I have the following code:

String str = request.getParameter("name");

if(str.equals("xyz") == true)
{
        str = "ChangedName";
        request.setParameter("name", str);   //
<------------------------- how
do i do this ??? There is no method as request.setParameter()
}

try
{
        String path = "/SomeJSP.jsp"
        
getServletConfig().getServletContext().getRequestDispatcher(pa
th).forwar
d(request, response);
}
catch(Exception ex)
{
        ex.printStackTrace();
}

one way to do it would be to append the parameter and its
changed value
to the path:
String path = "/SomeJSP.jsp?name=str";

But is there some method like setParameter to do what I want to do ?

Thanks.


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



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



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



Reply via email to