Solved

A question about struts-config.xml in Struts

Posted on 2004-03-29
12
1,085 Views
Last Modified: 2012-06-27
in the action-mappings of struts-config.xml, can I create two actions with the same "path" new but different attributes, e.g. "validate", "name"?

For example: WorkflowDispatch is a subclass of DispatchAction, fileUpload is a typcial Action class. I want to use path "/Wf.do?method={valueofmethod}" for both actions. The upload.jsp need to be validated before forwarding to fileUpload action. The WorkflowDispatch doesn't need to do validation.

            <action path="/Wf"
                  type="fileUpload"
                  parameter="method">
                  input="/jsp/upload.jsp"
                  name = "UploadForm"
                  scope="request"
                  validate="true">
                  <forward name="success" path="/workflow.jsp" />
            </action>

            <action path="/Wf"
                  type="WorkflowDispatch"
                  parameter="method">
                  <forward name="success" path="/workflow.jsp" />
            </action>      
0
Comment
Question by:ggyao2003
  • 7
  • 4
12 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 10710731
no! you cannot!
but you can forward form one action to another.
0
 

Author Comment

by:ggyao2003
ID: 10719101
kennethxu,
I think your answer is right, but it does not help me much. what abot switch the problem to my essential concern:
the WorkflowDispatch.java contains quite a few methods, one of them is, for example, "fileupload". I need to do validation using an ActionForm for the "fileupload" action, but not the others. How can I achieve this goal?
Or even more broad, can I validate a specific Action (e.g. fileupload) using a specific ActionForm (e.g. UploadForm) while ignoring other Actions in the same subclass of DispatchAction (e.g. WorkflowDispatch)?
Thanks a lot!!!
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10720148
but I still don't see the reason that you have to use same path? you cannot map 2 different actions to same path, period. there is no way around it. you should use different path for different action.
0
 
LVL 14

Assisted Solution

by:kennethxu
kennethxu earned 125 total points
ID: 10720285
BTW, you can always call the validation method manually in the action.
0
 

Author Comment

by:ggyao2003
ID: 10720610
you got the point.
I have read the struts source code for requestprocessor and trying to call validation (and even setting the actionform) in the action class instead of setting them in struts-config.xml, but I still encountered exceptions. I will work on this issue tomorrow morning. I will ask more detailed questions shortly.
Or do you have some quick guide for me to do validation in action class?

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ggyao2003
ID: 10720627
btw, do you know how to set my screen name instead of ggyao2003? This is my email address, not my nick name in my profile.
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 125 total points
ID: 10720673
>> even setting the actionform
that is more difficult because you'll have to manually populate the form bean although you can use beanutil and etc.

>> but I still encountered exceptions
exception detail? stacktrace?

>> quick guide for me to do validation in action class
simply call the validation class and get the ActionErrors, then do whatever you do with normal action validation.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10720678
>> do you know how to set my screen name instead of ggyao2003?
post a 0 point question in support:
http://www.experts-exchange.com/Community_Support/
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10726867
glad to know it works for you. BTW, is there anything wrong leads to a B grade?
for you future reference:
http://www.experts-exchange.com/Web/Web_Languages/JSP/help.jsp#hi73
0
 

Author Comment

by:ggyao2003
ID: 10727825
because I also have those ideas in mind, only that I was not sure about it and wanted to get some kind of confirmation.
the most important factor is that I have abandoned this approach, which causes several other problems.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10727883
For you future reference, grading measures reliability of an expert, doesn't have to do with the decision of implementation. As an EE rule, NO is a valid answer.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ajax auto save 15 98
Best practices to work on a spring MVC project 1 118
Using Tomcat as raspberry pi java app server 13 141
main method of string class 3 103
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

17 Experts available now in Live!

Get 1:1 Help Now