Struts2 conversation plugin - struts2

Anyone has successfully used Struts conversation plugin?
The documentation says that fields annotated with #ConversationField annotation in Action class is supposed to be retained for the entire conversation, which is not happening.
Can you help me with any other plugin for Struts 2 for developing wizard-like application?
Following is my structure of struts.xml
<package name="wstest" namespace="/wstest" extends="struts-conversation-default">
<action name="*" class="com.bla.bla.WebServiceTestController" method="{1}">
<result name="upload">/WEB-INF/content/wstest/UploadWSDL.jsp</result>
<result name="selectoperation">
/WEB-INF/content/wstest/selectoperation.jsp
</result>
</action>
</package>

Related

Get request from two different name space and to call same action

I have below struts configuration file with me,I need add another "namespace"(/mservice) to same action,In that config file I need to remove <param name="excludeNullProperties">false</param>
<struts>
<package name="com.web.mobile" namespace="/service" extends="mobile-default">
<action name="ticketSupport!*" class="com.web.mobile.TicketSupport"
method="{1}">
<result type="json">
<!-- This parameter should remove to the "/mservice" namesapce -->
<param name="excludeNullProperties">false</param>
</result>
<result name="input" type="json"/>
</action>
</package>
</struts>
I have two mobile apps, need to call same action with different parameters,I am thinking to maintain 2 struts configuration files, How can I modify existing config file to work with both apps?

url including extra word in path

I am using struts2 for web development.
after deploying
it is showing url http://localhost:8084/iland/ which is login page of my site
which is correct but after login it is redirected to 'about' action which fetch user details so in this case url should be http://localhost:8084/iland/about,
but it is showing url http://localhost:8084/iland/pages/about.
Here 'pages' is included, due to this change my css are not get loaded.
How to resolve this
my struts.xml for above is
<package name="myprofile" extends="struts-default">
<action name="login" class="action.LoginAction">
<result name="success" type="redirect">about</result>
<result name="input">/pages/login.jsp</result>
</action>
<package name="default" extends="struts-default">
<action name="about" class="social.action.fetchBasicProfile">
<result name="success">/pages/profile/about.jsp</result>
<result name="input">/pages/profile/about.jsp</result>
<result name="login">/pages/pleaselogin.jsp</result>
</action>
</package
There must be problem with your namespace, so please check your struts.xml and change the namespace="pages" to namespace="/". this will resolve your issue. let me know if u find any difficulty

Struts 2 and Tiles with Netbeans

I am trying get Struts 2 and Tiles to work and I am using netbeans 7.1 as my IDE. Most of the examples are built on eclipse and I can seem to find a working example , So i tried to follow a tutorial And tried to get it sorted. Now I have the proeject runningwell and I can access individual tiles by url.
ie.
http://localhost:8088/sample2/example/body.jsp
But the action to mapping doesnt seem to work.
below are the files :
struts.xml = http://pastebin.com/5uWLSXWj
example.xml = http://pastebin.com/UQh68YNE
web.xml = http://pastebin.com/ZgVXfW1E
LinkAction.Java = http://pastebin.com/8cvKdmai
Appreciate any guidance , and links to netbeans and struts 2 example code.
<package name="example" namespace="/example" extends="struts-default">
Problem with Struts.xml file. You are loading two <package>s with same configuration.
Thats why one package is loading(with plain JSP result), and another is silently dropped (with Tiles results.) Try combining them into one, like this :
<struts>
<package name="example" namespace="/example" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="HelloWorld" class="example.HelloWorld">
<result>/example/HelloWorld.jsp</result>
</action>
<action name="Body" class="example.HelloWorld">
<result>/example/body.jsp</result>
</action>
<action name="*Link" method="{1}" class="example.LinkAction">
<result name="welcome" type="tiles">welcome</result>
<result name="friends" type="tiles">friends</result>
<result name="office" type="tiles">office</result>
</action>
</package>
</struts>

I want to call/redirect to a Portal page from Struts2Portlet Action Class?

Hi We are developing a Struts2Portlet Application in WebSpherePortal6.0.1. In my application I want to redirect to another portlet page after fullfilling the validations in my struts action class.How to achieve it. Please help me.
Thanks in Advance.
I have done some R&D to fix this issue,finally i found a solution.We cant call/redirect the portal page from struts2Portlet Action class.We can have to give a result type in strut action class,then we have to configure the action in the result.
<action name="view" class="com.ibm.rock.ViewAction" method="prepareview">
<result name="view">*/view/viewportalpage.action*</result>
</action>
<action name="viewportalpage" class="com.ibm.rock.ViewAction" method="prepareview">
<result name="preview">/_Rock/jsp/html/Preview.jsp</result>
</action>
Synatax:
<result name="success">*/Namespace/view.action*</result>
<action name="view" class="com.ibm.rock.ViewAction" method="prepareview">
<result name="preview">/_Rock/jsp/html/Preview.jsp</result>
</action>

Please explain Action in Struts 2.0 XML file

<action name="userLogin" class="com.cc.ad.web.common.UserLoginAction">
<result name="error">/user-login.jsp</result>
<result name="redirect" type="redirect">${retUrl}</result>
<result name="customerRedirect" type="redirect">${customerRedirect}</result>
<result name="supplierRedirect" type="redirect">${supplierRedirect}</result>
<result name="diamondViewRedirect" type="redirect">${diamondViewRedirect}</result>
<result name="supplierPopupRedirect" type="redirect">${supplierPopup}</result>
<result name="customerPopupRedirect" type="redirect">${customerPopup}</result>
</action>
Above I show one of many things written in my Struts XML file. Here nothing is define in the method attributes so I am confused about which method of UserLoginAction class is called when this action is called.
If method name is not specified in the action configuration, Struts will look for a method named execute by default.
Struts 2.0 Action Configuration Doc

Resources