File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes global forward not overwriting url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "global forward not overwriting url" Watch "global forward not overwriting url" New topic

global forward not overwriting url

srinivas mandayam

Joined: Aug 24, 2005
Posts: 3
Hi i am using struts 1.1 i am calling login action servlet from my index.jsp and if login fails i am forwarding it back to index.jsp using mapping.findforward("welcome") but the url is not getting overwritten

my struts-config.xml is <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" ""> <struts-config> <global-forwards> <forward name="success" path="/html/Forward_To_next.jsp" /> <forward name="welcome" path="/index.jsp" /> </global-forwards> <action-mappings> <!-- Start of Login module related actions --> <action name="logonForm" type="myweb.web.login.LoginAction" input="logon" path="/logon" /> </action-mappings> <!-- Controller Configuration --> <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" /> <!-- Plug Ins Configuration --> <!-- Tiles plugin --> <!-- comment following if struts1.0.x --> <plug-in className="org.apache.struts.tiles.TilesPlugin"> <set-property value="/WEB-INF/tiles-defs.xml" property="definitions-config" /> <set-property value="0" property="definitions-debug" /> <set-property value="0" property="definitions-parser-details" /> <set-property value="true" property="definitions-parser-validate" /> </plug-in> <!-- end comment if struts1.0.x --> <plug-in className="org.apache.struts.validator.ValidatorPlugIn"> <set-property value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" property="pathnames" /> </plug-in> </struts-config>

my web.xml is <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" ""> <web-app> <!-- Display Name and Description --> <display-name>myWeb</display-name> <description>myWeb</description> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>3</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>3</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <!-- Standard Action Servlet Mapping --> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>/do/*</url-pattern> </servlet-mapping> <!-- Welcome File for the application--> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <!-- Struts Tag Library Descriptors --> <taglib> <taglib-uri>/tags/struts-bean</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-html</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-logic</taglib-uri> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-nested</taglib-uri> <taglib-location>/WEB-INF/struts-nested.tld</taglib-location> </taglib> <taglib> <taglib-uri>/tags/struts-tiles</taglib-uri> <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location> </taglib> </web-app>
the url used is http://localhost:8080/myWeb/index.jsp after i submit from index.jsp the url stays at http://localhost:8080/myWeb/do/logon; it does not get forwarded to the index.jsp i am using jboss3.2.3 and built an ear file with war and jar file can anyone please help me
Vicky Mohan
Ranch Hand

Joined: Oct 14, 2004
Posts: 130
If you're going to post more than a line or two of your code, wrap it in UBB Code tags (there is a button on the edit screen to assist with this). They preserve your indening which makes the code easier to read. This usually results in more people reading it an helping you.

in your web.xml


i think the URL pattern could be wrong.


[ August 25, 2005: Message edited by: Mohen Vijay ]
[ August 25, 2005: Message edited by: Mohen Vijay ]
I agree. Here's the link:
subject: global forward not overwriting url
It's not a secret anymore!