public String addMetadataProperty()
{
- ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
- String errorMsg = null;
+ String errorMsg = null;
+ ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
if( projectMetadata == null )
{
addActionError( errorMsg != null ? errorMsg : "Artifact not found" );
genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
}
+ if( propertyName == null || "".equals( propertyName.trim() ) || propertyValue == null || "".equals( propertyValue.trim() ) )
+ {
+ model = projectMetadata;
+ addActionError( errorMsg != null ? errorMsg : "Property Name and Property Value are required." );
+ return INPUT;
+ }
+
genericMetadata.put( propertyName, propertyValue );
GenericMetadataFacet genericMetadataFacet = new GenericMetadataFacet();
</action>
<action name="addMetadataProperty" class="showArtifactAction" method="addMetadataProperty">
- <result>/WEB-INF/jsp/showArtifact.jsp</result>
+ <result name="input">/WEB-INF/jsp/showArtifact.jsp</result>
+ <result name="success">/WEB-INF/jsp/showArtifact.jsp</result>
</action>
<action name="deleteMetadataEntry" class="showArtifactAction" method="deleteMetadataEntry">
<%@ taglib prefix="archiva" uri="/WEB-INF/taglib.tld" %>
<div>
-
+
<div>
<s:form action="addMetadataProperty" namespace="/" method="post" validate="true" theme="simple">
<s:hidden name="groupId" value="%{groupId}" />
</c:if>
</div>
+
+ <p>
+ <s:if test="hasActionMessages()">
+ <div id="messages">
+ <s:actionmessage/>
+ </div>
+ </s:if>
+ <s:if test="hasActionErrors()">
+ <div id="messages">
+ <s:actionerror/>
+ </div>
+ </s:if>
+ </p>
+
<%-- <archiva:project-metadata object="${projectMetadata}" groupId="${groupId}" artifactId="${artifactId}" version="${version}" /> --%>
</div>