Struts 2: параметры между Действиями

Как сказал rgiller, вы не можете создать приложение ios без Mac.

Но если вы не можете купить Mac или просто не хотите его покупать, вы можете использовать сервис сборки phonegap, позволяющий собирать apk и ipa с помощью одного и того же процесса.

К сожалению, для сборки и развертывания и IPA (это APK, но для Apple) вам нужна учетная запись Apple dev и файл P12 И mobileprovision.

P12 и mobileprovision должны генерироваться с Mac, но вы можете арендовать его с услугой, подобной https://www.macincloud.com/

. ] http://docs.phonegap.com/phonegap-build/

8
задан Roman C 15 April 2013 в 15:27
поделиться

2 ответа

You used the word "forward" but it sounds like you want to go to a new page (address.html) to collect more information about the address. If this is the case, you need to redirect to the address page after the user action completes.

<action name="user" class="UserAction">
  <!-- Redirect to another namespace -->
  <!-- for Struts 2.2 --> <result type="redirectAction">
  <!-- for Struts 2.0 <result type="redirect-action"> -->
    <param name="actionName">collect-address</param>
    <param name="userId">${userId}</param>
  </result>
</action>

The ${userId} syntax will call getUserId on your UserAction and pass that parameter as you showed in your question: addressForm.html?user_id=X. collect-address can have a success result that goes to addressForm.html. Docs here. If you want to avoid using another action, you can try using the result type="redirect" and pass things through that way.

If you really want to forward, you can use action chaining. This is discouraged by Ted Husted on the Struts2 team but it may work for you.

Instead of action chaining, try to bring all the code to complete this request into a single action and use helper or service classes for User and Address to separate and reuse the code instead of "action chaining".

29
ответ дан 5 December 2019 в 05:19
поделиться

Не очень понятно, что вы хотите сделать.

Похоже, что после успешного выполнения действия запрос перенаправляется другому действию. В первом действии вы хотите передать идентификатор параметра и использовать его во втором действии. Поскольку оба действия используются в одном и том же вызове запроса, вы можете сохранить параметр ID в запросе, как этот запрос

.

3
ответ дан 5 December 2019 в 05:19
поделиться
Другие вопросы по тегам:

Похожие вопросы: