Subversion Repositories general

Compare Revisions

Ignore whitespace Rev 1241 → Rev 1242

/PhotoAlbum/trunk/src/ak/photoalbum/webapp/IndexForm.java
0,0 → 1,49
package ak.photoalbum.webapp;
 
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
 
public class IndexForm
extends PathForm
{
protected String page;
protected int pageInt;
 
public String getPage()
{
return page;
}
 
public int getPageInt()
{
return pageInt;
}
 
public void setPage(String page)
{
this.page = page;
}
 
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
 
try {
pageInt = (page == null) ? 0 : Integer.parseInt(page);
}
catch(Exception ex) {
errors.add(null, new ActionError("Cannot parse page number"));
}
 
if(errors.size() == 0) {
if(pageInt < 0)
errors.add(null, new ActionError("Wrong page number"));
}
 
return errors;
}
}