Solved

how can i use xdoclet to create struts2's struts.xml?

Posted on 2008-06-11
7
688 Views
Last Modified: 2013-11-24
hi,experts
  i want use xdoclet to create struts2's config file like struts.xml,
how can i do it?
and i need what jar to do it?

Thanks!
0
Comment
Question by:jbas
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Expert Comment

by:pmartin8
ID: 21762151
I don't see how a script could do the struts.xml since you need to configure it yourself.

How could it know the actions your are using in your application? how could it know where the result are going and stuff like that?

Do you want me to send an example of a struts.xml?
0
 

Author Comment

by:jbas
ID: 21765454
hi,pmartin8 experts,
 thanks , i want write a script in my action java file,and use ant to build it's struts.xml,now i do not know what script i need to write in my action java,and  in  build.xml  i need what code,and xdoclet is support struts2?

i want write the script in java action like thils:

/**
 *
 * @struts.package name="example"  namespace="/example" extends="s20-default"
 * @struts.action name="Login_*" method="{1}" class="example.Login"
 * @struts.action-result name="startup"
 * @struts.action-result name="input"
 *
 */

but i not sure it can be work.
0
 

Expert Comment

by:kmapper
ID: 21765540
hmmm well...

in the struts.xml there is much more than just action and result definitions...
Moreover, using the best practices you should split the configuration files in many packages and many files...
For example, if you have an admin view, you will have the struts.xml include the user-view-config.xml and the admin-view-config.xml

I harldy see how you could define such things with annotations.

If you generate the struts.xml with a doclet, then you will need to recompile all the code whenever you change a result foward.

I guess I don't understand your requirements, but to me even if it's possible, this is not a good idea to generate the struts.xml with a xdoclet script
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:jbas
ID: 21765640
hi,kmappers experts,
  thanks for your reply,in struts1,i use xdoclet to create struts-config.xml,and i write some script in my action java file  ,and when i use spring ,i write script in my spring's java file to create spring.xml,i do it because i can manage some xml config file in java source,and when i need to deplay it ,i use ant to build the build.xml file,it's so easy.
>>For example, if you have an admin view, you will have the struts.xml include the user-view-config.xml and the admin-view-config.xml
yes, if possible,i want to build the admin-view-config.xml,other-config.xml..... with xdoclet,but now i not know to create  single struts.xml .

struts1 script:
in my action:
/**
 *
 * @struts.action path="/common/commonAction" scope="request" name="callForm" parameter="doaction"
 * @struts.action-forward name="userSearchCollectForward" path="/WEB-INF/webpages/call/userCollectFrame.jsp"
 * @struts.action-forward name="userSearchForward" path="/WEB-INF/webpages/call/userSearch.jsp"
 * @struts.action-forward name="userCollectForward" path="/WEB-INF/webpages/call/userCollect.jsp"
 * @struts.action-forward name="dTreeForward" path="/WEB-INF/webpages/call/dTree.jsp"
 * @struts.action-forward name="dTreeServerForward" path="/WEB-INF/webpages/call/dtreeServer.jsp"
 * @struts.action-forward name="dptuserCollectForward" path="/WEB-INF/webpages/call/dptuserCollect.jsp"
 * @struts.action-forward name="dptuserForward" path="/WEB-INF/webpages/call/deptUserTreeFrame.jsp"
 * @struts.action-forward name="ldbzForward" path="/WEB-INF/webpages/call/ldbzPage.jsp"
 */

in springImpl java file i create spring.xml use this code.
/**
 * @spring.proxy id="parameterService" parent="baseTransactionProxy"
 * @spring.bean
 * @spring.property name="paramDao" ref="paramDao"
 */
0
 

Accepted Solution

by:
kmapper earned 125 total points
ID: 21765694
well... ok

Then, with struts 2 the tags are provided by Xwork.

Here is where you'll get the information

http://xdoclet.codehaus.org/XworkTags

hope this helps
0
 

Author Comment

by:jbas
ID: 21769238
hi,kmapper,
  i don't know how to use xworktag,and how can i write   the build.xml.

Best regard!
0
 
LVL 1

Expert Comment

by:pmartin8
ID: 21771698
Well, I never used them neither...Sorry I don't have any example to provide...

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
commonTwo  challenge 63 121
what is the main difference between git clone and fetch ann pull and push commands 2 71
jar file executable 12 39
diffSum example 4 23
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now