Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

A question about struts-config.xml in Struts

Posted on 2004-03-29
12
Medium Priority
?
1,093 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 14

Assisted Solution

by:kennethxu
kennethxu earned 375 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
 

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 375 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

What monsters are hiding in your child's room? In this article I will share with you a tech horror story that could happen to anyone, along with some tips on how you can prevent it from happening to you.
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

610 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