本文整理汇总了Java中org.apache.struts.action.ActionError类的典型用法代码示例。如果您正苦于以下问题:Java ActionError类的具体用法?Java ActionError怎么用?Java ActionError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionError类属于org.apache.struts.action包,在下文中一共展示了ActionError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleRecordStatusEditing
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* Handle a request to search over metadata collections and forwared to the appropriate
* jsp page to render the response.
*
* @param mapping The ActionMapping used to select this instance
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
* @param mf The DDSManageCollectionsForm
* @param rm The RepositoryManager
* @return The ActionForward instance describing where and how
* control should be forwarded
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
public ActionForward handleRecordStatusEditing(
ActionMapping mapping,
DDSManageCollectionsForm mf,
HttpServletRequest request,
HttpServletResponse response,
RepositoryManager rm)
throws IOException, ServletException {
ActionErrors errors = new ActionErrors();
SimpleLuceneIndex index =
(SimpleLuceneIndex) servlet.getServletContext().getAttribute("index");
if (index == null)
throw new ServletException("The attribute \"index\" could not be found in the Servlet Context.");
errors.add("message", new ActionError("generic.message",
"editing record number " + request.getParameter("recs")));
saveErrors(request, errors);
return mapping.findForward("edit.record.status");
}
示例2: validate
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* NOT YET DOCUMENTED
*
* @param mapping NOT YET DOCUMENTED
* @param request NOT YET DOCUMENTED
* @return NOT YET DOCUMENTED
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
// prtln ("validate()");
if (command != null && (command.equals("edit") || command.equals("save"))) {
UserManager userManager =
(UserManager) getServlet().getServletContext().getAttribute("userManager");
if (username == null) {
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.username.required"));
}
else {
user = userManager.getUser(username);
if (user == null) {
prtln("User \"" + username + "\" not found in database!");
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.username.notfound", username));
}
}
}
return errors;
}
示例3: doUploadFake
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* A stub used to develop user-interaction without requiring actuall
* uploading.
*
* @param mapping the ActionMapping
* @param form the ActionForm
* @param request the Request
* @param response the Response
* @return NOT YET DOCUMENTED
* @exception Exception NOT YET DOCUMENTED
*/
ActionForward doUploadFake(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
prtln("doUploadFake");
ActionErrors errors = new ActionErrors();
try {
FileUploadForm uploadForm = (FileUploadForm) form;
uploadForm.setContentURL("http://ndrtest.nsdl.org/api/get/2200/test.20090410170951993T/content");
} catch (Throwable t) {
errors.add("error", new ActionError("generic.error", t.getMessage()));
saveErrors(request, errors);
return mapping.findForward("ndr.upload.form");
}
String forwardPath = request.getParameter("forwardPath");
if (forwardPath != null && forwardPath.trim().length() > 0)
return new ActionForward(forwardPath);
else
return mapping.findForward("ndr.upload.confirm");
}
示例4: indexCheck
import org.apache.struts.action.ActionError; //导入依赖的package包/类
private ActionErrors indexCheck(ActionForm form, HttpServletRequest request) {
DCSBrowseForm browseForm = (DCSBrowseForm) form;
ActionErrors errors = new ActionErrors();
List sets = browseForm.getSets();
for (Iterator i = sets.iterator(); i.hasNext(); ) {
DcsSetInfo set = (DcsSetInfo) i.next();
int numIndexed = set.getNumIndexedInt() + set.getNumIndexingErrorsInt();
int numFiles = set.getNumFilesInt();
// prtln ("indexCheck for " + set.getName() + " numIndexed + numErrors = " + numIndexed + ", numFiles = " + numFiles);
if (numIndexed != numFiles) {
errors.add("indexErrors", new ActionError("generic.error", set.getName()));
}
}
return errors;
}
示例5: handleDeleteEntry
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* Remove the StatusEntry corresponding to "entryKey" from the DcsDataRecord.
*
* @param mapping NOT YET DOCUMENTED
* @param form NOT YET DOCUMENTED
* @param request NOT YET DOCUMENTED
* @param response NOT YET DOCUMENTED
* @return NOT YET DOCUMENTED
* @exception Exception NOT YET DOCUMENTED
*/
private ActionForward handleDeleteEntry(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
ActionErrors errors = new ActionErrors();
StatusForm statusForm = (StatusForm) form;
String id = statusForm.getRecId();
DcsDataRecord dcsDataRecord = statusForm.getDcsDataRecord();
String entryKey = statusForm.getEntryKey();
dcsDataRecord.deleteStatusEntry(entryKey);
repositoryService.updateRecord(id);
dcsDataRecord.flushToDisk();
statusForm.clear();
errors.add("message", new ActionError("generic.message", "status entry deleted"));
saveErrors(request, errors);
return mapping.findForward("edit.status");
}
示例6: handleUpdateEntry
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* Update the edited values for the StatusEntry corresponding to "entryKey"
*
* @param mapping NOT YET DOCUMENTED
* @param form NOT YET DOCUMENTED
* @param request NOT YET DOCUMENTED
* @param response NOT YET DOCUMENTED
* @return NOT YET DOCUMENTED
* @exception Exception NOT YET DOCUMENTED
*/
private ActionForward handleUpdateEntry(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
ActionErrors errors = new ActionErrors();
StatusForm statusForm = (StatusForm) form;
String entryKey = statusForm.getEntryKey();
String id = statusForm.getRecId();
DcsDataRecord dcsDataRecord = statusForm.getDcsDataRecord();
StatusEntry statusEntry = dcsDataRecord.getStatusEntry(entryKey);
if (statusEntry == null)
throw new Exception("status entry not found for " + entryKey);
statusEntry.setStatusNote(statusForm.getStatusNote());
dcsDataRecord.replaceStatusEntry(entryKey, statusEntry);
repositoryService.updateRecord(id);
dcsDataRecord.flushToDisk();
statusForm.setHash(entryKey);
statusForm.clear();
statusForm.setEntryKey("");
errors.add("message", new ActionError("generic.message", "status entry updated"));
saveErrors(request, errors);
return mapping.findForward("edit.status");
}
示例7: handleSaveRequest
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
*
*
*@param mapping Description of the Parameter
*@param form Description of the Parameter
*@param request Description of the Parameter
*@param response Description of the Parameter
*@param validator Description of the Parameter
*@return Description of the Return Value
*@exception ServletException Description of the Exception
*@exception MissingLockException Description of the Exception
*/
protected ActionForward handleSaveRequest(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
SchemEditValidator validator)
throws ServletException, MissingLockException {
prtln ("Stand allone handleSaveRequest()");
ActionErrors errors = saveRecord (mapping, form, request, response, validator);
if (errors.size() == 0) {
errors.add("message",
new ActionError("save.confirmation"));
}
saveErrors(request, errors);
return getEditorMapping(mapping);
}
示例8: handleOtherCommands
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* A hook for extensions of AbstractSchemEditAction to handle misc
* unanticipated requests.
*
* @param mapping the actionMapping
* @param form the actionForm
* @param request the request
* @param response Description of the Parameter
* @return Description of the Return Value
* @exception ServletException Description of the Exception
* @exception MissingLockException NOT YET DOCUMENTED
*/
protected ActionForward handleOtherCommands(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, MissingLockException {
String command = request.getParameter("command");
ActionErrors errors = new ActionErrors();
prtln("unknown command");
errors.add("message",
new ActionError("unrecognized.command", command));
saveErrors(request, errors);
return getEditorMapping(mapping);
}
示例9: confirmNdrWrite
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* Add confirmation message if this collection is managed in the ndr.
*
*@param resultDoc Description of the Parameter
*@param sef Description of the Parameter
*@param errors Description of the Parameter
*/
private void confirmNdrWrite(ResultDoc resultDoc, SchemEditForm sef, ActionErrors errors) {
try {
XMLDocReader docReader = (XMLDocReader) resultDoc.getDocReader();
String collection = docReader.getCollection();
CollectionConfig config = this.collectionRegistry.getCollectionConfig(collection);
if (config.isNDRCollection()) {
DcsDataRecord dcsDataRecord =
dcsDataManager.getDcsDataRecord(sef.getRecId(), repositoryManager);
if (dcsDataRecord == null) {
return;
}
String handle = dcsDataRecord.getNdrHandle();
String syncError = dcsDataRecord.getNdrSyncError();
if (handle != null && handle.trim().length() > 0 &&
(syncError == null || syncError.trim().length() == 0)) {
errors.add("message",
new ActionError("ndr.save.confirmation"));
}
}
} catch (Throwable t) {
prtln("could not determine ndr save success: " + t.getMessage());
}
}
示例10: getActionError
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
* Gets the <code>ActionError</code> based on the
* <code>ValidatorAction</code> message and the <code>Field</code>'s
* arg objects.
* @param request the servlet request
* @param va Validator action
* @param field the validator Field
* @deprecated Use getActionMessage() instead. This will be removed after
* Struts 1.2.
*/
public static ActionError getActionError(
HttpServletRequest request,
ValidatorAction va,
Field field) {
String args[] =
getArgs(
va.getName(),
getMessageResources(request),
RequestUtils.getUserLocale(request, null),
field);
String msg =
field.getMsg(va.getName()) != null
? field.getMsg(va.getName())
: va.getMsg();
return new ActionError(msg, args);
}
示例11: handleSaveRequest
import org.apache.struts.action.ActionError; //导入依赖的package包/类
/**
*
*
*@param mapping Description of the Parameter
*@param form Description of the Parameter
*@param request Description of the Parameter
*@param response Description of the Parameter
*@param validator Description of the Parameter
*@return Description of the Return Value
*@exception ServletException Description of the Exception
*@exception MissingLockException Description of the Exception
*/
protected ActionForward handleSaveRequest(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response,
SchemEditValidator validator)
throws ServletException, MissingLockException {
prtln ("Stand alone handleSaveRequest()");
ActionErrors errors = saveRecord (mapping, form, request, response, validator);
if (errors.size() == 0) {
errors.add("message",
new ActionError("save.confirmation"));
}
saveErrors(request, errors);
return getEditorMapping(mapping);
}
示例12: validate
import org.apache.struts.action.ActionError; //导入依赖的package包/类
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
ActionErrors errors = super.validate(mapping, request);
FicheroExportacion ficExp= (FicheroExportacion) this.getValues();
if ( request.getParameter(Constants.ALTA_PROPERTY) != null ) {
try {
if (DelegateUtil.getFicheroExportacionDelegate().findFicheroExportacion(ficExp.getIdentificadorTramite()) != null) {
errors.add("values.codigo", new ActionError("errors.ficheroExportacion.duplicado", ficExp.getIdentificadorTramite() ));
}
} catch (DelegateException e) {
errors.add("values.codigo", new ActionError("errors.delegate", e.getMessage() ));
}
}
return errors;
}
示例13: execute
import org.apache.struts.action.ActionError; //导入依赖的package包/类
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
log.debug("Entramos en BajaTramite");
ProcedimientoDelegate tramiteDelegate = DelegateUtil.getTramiteDelegate();
String idString = request.getParameter("codigo");
if (idString == null || idString.length() == 0) {
log.warn("El par�metre codigo �s null!!");
return mapping.findForward("fail");
}
if (!tramiteDelegate.puedoBorrarProcedimiento(idString)){
ActionErrors messages = new ActionErrors();
//messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("errors.elementoNoPuedeBorrarse"));
messages.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.tramiteNoPuedeBorrarse"));
saveErrors(request,messages);
return mapping.findForward("success");
}
tramiteDelegate.borrarProcedimiento(idString);
//request.setAttribute("reloadMenu", "true");
return mapping.findForward("success");
}
示例14: validate
import org.apache.struts.action.ActionError; //导入依赖的package包/类
public ActionErrors validate( ActionMapping mapping, HttpServletRequest request )
{
ActionErrors errors = super.validate(mapping, request);
if (errors == null)
{
errors = new ActionErrors();
}
FormFile fitxer = this.getFitxer();
// fichero no incluido
if ( fitxer == null )
{
errors.add( "ficheroCuaderno.importar.fitxer", new ActionError("errors.ficheroCuaderno.importar.fitxer.vacio" ) );
}
// validacion del nombre del fichero
dominio = match( DOMINIO_PATTERN, fitxer.getFileName() );
tramite = match( TRAMITE_PATTERN, fitxer.getFileName() );
form = match( FORM_PATTERN, fitxer.getFileName() );
if ( ! ( dominio || tramite || form ) )
{
errors.add( "ficheroCuaderno.importar.fitxer", new ActionError("errors.ficheroCuaderno.importar.fitxer.nombreFicheroNoAdecuado" ) );
}
return errors;
}
示例15: execute
import org.apache.struts.action.ActionError; //导入依赖的package包/类
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
{
try{
FirmarDocumentoDelegadoForm docForm = (FirmarDocumentoDelegadoForm)form;
//Buscamos Documentos pendientes de firma de la entidad delegante
BandejaFirmaDelegate firmas = DelegateUtil.getBandejaFirmaDelegate();
PluginFirmaIntf plgFirma = PluginFactory.getInstance().getPluginFirma();
FirmaIntf firma = plgFirma.parseFirmaFromHtmlForm(docForm.getFirma());
firmas.firmarDocumentoBandejaFirma(new Long(docForm.getIdentificador()),firma);
}catch(Exception e){
ActionErrors messages = new ActionErrors();
messages.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.firmar.documento.Firma"));
saveErrors(request,messages);
return mapping.findForward("fail");
}
response.sendRedirect(request.getContextPath() + "/protected/mostrarBandejaFirma.do");
return null;
}