0

I have an application which called authenticateAD() on context root, http:localhost:8080/lcsd/

<%@ page contentType="text/html; charset=UTF-8" %> 
<%@ taglib prefix="s" uri="/struts-tags" %> 
<s:action namespace="/" name="authenticateAD" executeResult="true"></s:action>

What I want to achieve

when upload is passed

http:localhost:8080/lcsd/upload

I want to call some other method so I wrote the same in other jsp

<%@ page contentType="text/html; charset=UTF-8" %> 
<%@ taglib prefix="s" uri="/struts-tags" %> 
<s:action namespace="/upload" name="authenticateDUC" executeResult="true"></s:action>

but this is not working, It shows no action mapped in namespace, but I mapped authenticateDUC in my struts.xml

STRUTS.XML

    <struts>
        <package name="default" extends="struts-default">
            <global-results>
                <result name="exception">/jsp/error.jsp</result>
                <result name="sessionexpire">/jsp/error.jsp</result>
            </global-results>

        <action name="authenticateDUC" method="authenticateDUC" class="com.lear.web.DirectUploadAccessAction">
                    <result name="error">/jsp/error.jsp</result>
                    <result name="success">/jsp/redirect_uploadchapter.jsp</result>
                </action>

//// LOT OF ACTIONS

</struts>

please help me

user9634982
  • 565
  • 5
  • 24
  • You need to provide more details; you don't show the namespaces you actually have in your S2 config, you need to explain what "when `upload` is passed" means, etc. – Dave Newton Jul 16 '19 at 15:27
  • Please see my edits – user9634982 Jul 17 '19 at 03:53
  • No Namespace in my struts.xml, only default package, namespace declared only in jsp where we intend to redirect to different action, – user9634982 Jul 17 '19 at 04:00
  • you asked me about upload, please note this is a kind of shortcut, user will manually append the same after context root – user9634982 Jul 17 '19 at 04:02
  • Then why do you give the `` tag a `namespace` property? – Dave Newton Jul 17 '19 at 04:15
  • I want a way to call a method after appending upload, I thought it will be handle by namespace declaration, if I am wrong here then please correct me and suggest me the bets practice for the same – user9634982 Jul 17 '19 at 04:21
  • The `namespace` property is used to... tell S2 what the namespace of the action is. I don't know what you mean by "call a method after appending upload". – Dave Newton Jul 17 '19 at 04:33
  • Its simple Dave,this is the URL http:localhost:8080/lcsd/, now what I want, i will manually add upload, http:localhost:8080/lcsd/upload, hit the enter in browser and it shoul invoke action name : authenticateDUC – user9634982 Jul 17 '19 at 04:36
  • Then configure an action at that URL. – Dave Newton Jul 17 '19 at 04:37
  • I alreayd configured that in my struts xml, also I created an action class for this, what I want, when my application deploy first time the URL http:localhost:8080/lcsd/ hit the – user9634982 Jul 17 '19 at 04:43
  • I also want to achieve the same functionality, let say if i manually type upload in URL – user9634982 Jul 17 '19 at 04:43
  • this should be work for http:localhost:8080/lcsd/upload – user9634982 Jul 17 '19 at 04:44
  • That is *not* what the `namespace` property does, as I already stated. **Configure** an action, whichever one you want, at the URL you want it to be hit from. The same way you've configured all your other actions. – Dave Newton Jul 17 '19 at 04:48
  • Ok Dave, I think I need to configure the same as other actions in struts xml – user9634982 Jul 17 '19 at 04:51
  • Hey Dave can you please look at my new post https://stackoverflow.com/questions/57068819/java-util-arraylist-cannot-be-cast-to-java-lang-comparable – user9634982 Jul 17 '19 at 05:05
  • See https://stackoverflow.com/a/42497452/573032 – Roman C Jul 17 '19 at 14:00

0 Answers0