Servlet with Helper method

I have a Servlet in Tomcat that works where it gets parameters from a form and I have condtions for the parameters. Here is an example shortened for this post:

if((fieldOne ==null) && (fieldTwo !=null))

{

varOne ="fieldTwo is populated";

varTwo ="fieldTwo condition setting here";

}

if((fieldOne !=null) && (fieldTwo ==null))

{

varOne ="fieldOne is populated";

varTwo ="fieldOne condition setting here";

}

if((fieldOne !=null) && (fieldTwo !=null))

{

varOne ="fieldOne and fieldTwo are populated";

varTwo ="fieldOne and fieldTwo conditions setting here";

}

Now I want to move this part of the Servlet into a helper class or bean and call it in the Servlet but not sure how to do this?

Here is what I have so far but need help. Please advise.

Helper.java

class Helper()

{

public Helper()

{

//default constructor here

}

public String conditionMethod()

{

if((fieldOne ==null) && (fieldTwo !=null))

{

varOne ="fieldTwo is populated";

varTwo ="fieldTwo condition setting here";

}

if((fieldOne !=null) && (fieldTwo ==null))

{

varOne ="fieldOne is populated";

varTwo ="fieldOne condition setting here";

}

if((fieldOne !=null) && (fieldTwo !=null))

{

varOne ="fieldOne and fieldTwo are populated";

varTwo ="fieldOne and fieldTwo conditions setting here";

}

//return statement here? Not sure how to do this part

}

}

Then call it in Servlet like this?

...

String varOne = Helper.conditionMethod();

...

[3281 byte] By [Evergreana] at [2007-11-27 5:18:46]
# 1
If you're about to return two strings at once, put it in a String[] or a VO.
BalusCa at 2007-7-12 10:41:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...