You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Purcell <sp...@vertisinc.com> on 2005/02/25 22:17:25 UTC

Need Help With Action

Hello,
 
I have been working on a new struts site for a couple of days now, and I have some issues that I was hoping to get some resolve on.
 
In my JSP pages. I am using this tag for an action:
<html:form action="login" focus="password">
 
When I source the file, I have this: " <form name="loginForm" method="POST" action="/uniquepear/uniquepear/login"> "
Why is it adding multiple webapp URI's to my actions? My struts-config.xml is below. But all I am doing is calling the admin.jsp and I get the wierd action.
 
Also, I am using the "  <html:base />"
in my JSP pages. I am new to this, I believe I normally just use a "/" from the webroot.
 
My setup is as follows:
/uniquepear
/stylesheets/my.css
/includes
/images
/WEB-INF/etc.
 
Something new I am running into is the fact when I use a href like this: "/images/myjpg.jpg" it does not get it. Sometimes I have to access it like "../images/myjpg.jpg"
 
Can anyone try and help me out with these issues. 
 
Thanks,
Scott 
 

 

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
       "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
       " http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>


  <form-beans>
    <form-bean name="loginForm" type="com.skp.form.LoginForm"/>  
  </form-beans>

 <global-exceptions>
    <exception 
   key="global.error.invalidlogin"
     path="/admin.jsp"
     scope="request"
     type="com.skp.user.InvalidLoginException"/>
   </global-exceptions>

  <global-forwards>
    <forward name="welcome" path="/uniquepear/loginpage" />
    <forward name="Main" path="/main.jsp" />
    <forward name="Login" path="/login.jsp" />
    <forward name="SystemFailure" path="/systemerror.jsp" />
    <forward name="SessionTimeOut" path="/sessiontimeout.jsp" />    
  </global-forwards>

  <action-mappings>

  <action
    path="/loginpage"
    type="com.skp.action.LoginAction"
    input="/welcome.jsp">
      <forward name="Success" path="/loggedin.jsp" redirect="true"/>
      <forward name="Failure" path="/admin.jsp" redirect="true"/>
  </action>

  <action
    path="/login"
    type="com.skp.login.LoginAction"
    scope="request"
    name="loginForm"
    validate="true"
    input="/admin/menu.jsp">
  </action>


  </action-mappings>

  <controller
    contentType="text/html;charset=UTF-8"
    debug="3"
    locale="true"
    nocache="true"/>

  <message-resources parameter="globalResources" null="false"/>


</struts-config>


 


RE: Need Help With Action

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Scott,

What container are you using?  Are you going through something like Apache
to Tomcat using mod_jk or mod_jk2?  Those can change the context so the
/uniquepear/uniquepear webapp path could be something Apache is accidentally
mapping into your webapp so your webapp thinks that is the invoking context.

Regards,
David

-----Original Message-----
From: Scott Purcell [mailto:spurcell@vertisinc.com]
Sent: Friday, February 25, 2005 4:17 PM
To: user@struts.apache.org
Subject: Need Help With Action


Hello,

I have been working on a new struts site for a couple of days now, and I
have some issues that I was hoping to get some resolve on.

In my JSP pages. I am using this tag for an action:
<html:form action="login" focus="password">

When I source the file, I have this: " <form name="loginForm" method="POST"
action="/uniquepear/uniquepear/login"> "
Why is it adding multiple webapp URI's to my actions? My struts-config.xml
is below. But all I am doing is calling the admin.jsp and I get the wierd
action.

Also, I am using the "  <html:base />"
in my JSP pages. I am new to this, I believe I normally just use a "/" from
the webroot.

My setup is as follows:
/uniquepear
/stylesheets/my.css
/includes
/images
/WEB-INF/etc.

Something new I am running into is the fact when I use a href like this:
"/images/myjpg.jpg" it does not get it. Sometimes I have to access it like
"../images/myjpg.jpg"

Can anyone try and help me out with these issues.

Thanks,
Scott




<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
       "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
       " http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>


  <form-beans>
    <form-bean name="loginForm" type="com.skp.form.LoginForm"/>
  </form-beans>

 <global-exceptions>
    <exception
   key="global.error.invalidlogin"
     path="/admin.jsp"
     scope="request"
     type="com.skp.user.InvalidLoginException"/>
   </global-exceptions>

  <global-forwards>
    <forward name="welcome" path="/uniquepear/loginpage" />
    <forward name="Main" path="/main.jsp" />
    <forward name="Login" path="/login.jsp" />
    <forward name="SystemFailure" path="/systemerror.jsp" />
    <forward name="SessionTimeOut" path="/sessiontimeout.jsp" />
  </global-forwards>

  <action-mappings>

  <action
    path="/loginpage"
    type="com.skp.action.LoginAction"
    input="/welcome.jsp">
      <forward name="Success" path="/loggedin.jsp" redirect="true"/>
      <forward name="Failure" path="/admin.jsp" redirect="true"/>
  </action>

  <action
    path="/login"
    type="com.skp.login.LoginAction"
    scope="request"
    name="loginForm"
    validate="true"
    input="/admin/menu.jsp">
  </action>


  </action-mappings>

  <controller
    contentType="text/html;charset=UTF-8"
    debug="3"
    locale="true"
    nocache="true"/>

  <message-resources parameter="globalResources" null="false"/>


</struts-config>






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org