Próbuję utworzyć niestandardowy konwerter typów, aby konwertować kolekcję obiektów tam iz powrotem z ciągu. Mam pole tekstowe w moim formularzu i chcę utworzyć nowy obiekt w Kolekcji dla każdego podziału linii w obszarze tekstowym na moim zapisie. Podczas wyświetlania informacji, chcę przechodzić między obiektami w kolekcji i przekształcać je w ciąg z liniowymi podziałami dla obszaru tekstowego. Do tej pory nie mogę nawet uruchomić mojego konwertera ani otrzymywać żadnych błędów na podstawie adnotacji, które mam. Poniżej jest moja definicja klasy:Struts 2 Konwersja typów akcji przy użyciu adnotacji
@Conversion()
public class FormsEdit extends JWebCrud{
Wewnątrz tej klasie mam listy:
private List<Formfield> formFields;
Wewnątrz klasy Formnfield Mam zestaw:
private Set<Formfieldopts> formfieldoptses = new HashSet<Formfieldopts>(0);
@TypeConversion(converter = "com.webexchange.actions.tpa.setup.forms.FormFieldOptsConverter")
public void setFormfieldoptses(Set<Formfieldopts> formfieldoptses) {
this.formfieldoptses = formfieldoptses;
}
Może ktoś proszę kierować do mnie na jak poprawnie skonfigurować te adnotacje, aby uruchomić konwerter?
Struts 2 Wersja: 2.2.1
Struts Interceptor stos:
<interceptor-stack name="stackWithSecurity">
<interceptor-ref name="closeHibernateSession" />
<!--catches exceptions pre or post action class-->
<interceptor-ref name="exceptionInterceptor" />
<interceptor-ref name="security">
<param name="excludeMethods">executeNoSecurity,executeNoSecurityOrValidation</param>
</interceptor-ref>
<interceptor-ref name="alias" />
<interceptor-ref name="servletConfig" />
<!-- Puts HTTPResponse and HTTPRequest objects on the action -->
<interceptor-ref name="openHibernateSession" />
<!-- Opens a db connection and creates a hibernate session -->
<interceptor-ref name="prepare" />
<interceptor-ref name="checkbox" /> <!-- Sets unchecked values into the action with a value of 'false' -->
<interceptor-ref name="params" /><!-- Sets the parameters from the HTTP request to the action -->
<interceptor-ref name="staticParams" />
<interceptor-ref name="conversionError" />
<!-- adds a field error when the value can't be converted to the right type -->
<interceptor-ref name="chain">
<!-- these properties should not be copied from one action to another on a chain -->
<param name="excludes">dao</param>
</interceptor-ref>
<interceptor-ref name="validation">
<param name="excludeMethods">
input,back,cancel,browse,delete,executeNoValidation,executeNoSecurityOrValidation,edit
</param>
<param name="validateAnnotatedMethodOnly">true</param>
</interceptor-ref>
<interceptor-ref name="workflow">
<param name="excludeMethods">
input,back,cancel,browse,delete,executeNoValidation,executeNoSecurityOrValidation,edit
</param>
</interceptor-ref>
</interceptor-stack>
Mapowanie Działanie:
<action name="formsSave"
class="com.webexchange.actions.tpa.setup.forms.FormsEdit"
method="save">
<result name="success">/jsp/centers/tpa/setup/forms/EditForms.jsp
</result>
<result name="input">/jsp/centers/tpa/setup/forms/EditForms.jsp
</result>
</action>
Wersja S2? Konfiguracja stosu/stosu przechwytującego? Coś na poziomie dziennika DEBUG/devMode dotyczącego procesu skanowania lub konwersji? –
Wersja S2: 2.2.1 –
Mam konfigurację Struts 2 w devMode. Włączyłem także DEBUG dla głównego programu rejestrującego. Jednak nie widzę, że Struts wyprowadza cokolwiek. –