Amit
asked on
how to add new optional parameter to JSP
Hi,
I have an old JSP project in which the request is sent like this
http://myhost:8080/myjava/WBCM?triggername=sysmgrtest&cmd=mstrsysmgr&cmddelay=0&projname=
and is handled in the code at the end
This kind of URL is shared with many existing users. Now I need to add a new request parameter inpfilename
http://myhost:8080/myjava/myjsp?triggername=alpha&cmd=beta&cmddelay=0&projname=omega&inpfilename=abcdefg
but i need to make inpfilename as optional request parameter or else all the old URLs (100s of them) will have to be modified which is not possible
How can I do that ? in the following code to ensure that I can keep adding new request parameters but the OLD URLs don't break
thanks
-anshu
public static void handleRequest(HttpServletR equest req, HttpServletResponse res) throws IOException {
//out = res.getWriter();
//res.setContentType("text /plain");
String paramName="";
paramName = "cmd";
commandType = req.getParameter(paramName );
paramName = "triggername";
triggerName = req.getParameter(paramName );
paramName="cmddelay";
commandDelay=Integer.parse Int(req.ge tParameter (paramName ));
paramName = "projname";
projectName = req.getParameter(paramName );
}
I have an old JSP project in which the request is sent like this
http://myhost:8080/myjava/WBCM?triggername=sysmgrtest&cmd=mstrsysmgr&cmddelay=0&projname=
and is handled in the code at the end
This kind of URL is shared with many existing users. Now I need to add a new request parameter inpfilename
http://myhost:8080/myjava/myjsp?triggername=alpha&cmd=beta&cmddelay=0&projname=omega&inpfilename=abcdefg
but i need to make inpfilename as optional request parameter or else all the old URLs (100s of them) will have to be modified which is not possible
How can I do that ? in the following code to ensure that I can keep adding new request parameters but the OLD URLs don't break
thanks
-anshu
public static void handleRequest(HttpServletR
//out = res.getWriter();
//res.setContentType("text
String paramName="";
paramName = "cmd";
commandType = req.getParameter(paramName
paramName = "triggername";
triggerName = req.getParameter(paramName
paramName="cmddelay";
commandDelay=Integer.parse
paramName = "projname";
projectName = req.getParameter(paramName
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.