So I have a big long query string that can either be …
//url=z&surl=y&time=z&codec=a264&acodec=mp3&width=400×100
or
//url=z&surl=y&time=z&optlevel=w
Im using request.getQueryString(“url”) to check if a) the qs is there and b) make sure its not null. This is all leading to a big messy set of if statements. I was just wondering if there is a better way to do it.
example..
if(request.getParameter("originalURL") != null &&
request.getParameter("originalURL").equals("") && ................)
Thanks guys
Sure, just refactor the duplicated code into methods or make use of an existing framework.
Basic kickoff example of refactored code:
You can of course go a step further and adopt an existing MVC framework with validation (and conversion) capabilities, such as Sun JSF or Apache Struts.