Struts URL problem with switching modules
[email protected] Tue, 9 Dec 2003 13:12:32 -0600
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. ------_=_NextPart_001_01C3BE88.6585C0C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have an application that I converted from 1.0 to 1.1. It used to be one single application and now I separated it into two modules. I am able to switch from one module to another using the SwitchAction. But I have an issue with my href in my JSP's. I was using tiles to set the HREF of my menu items and such. The URLs look like /default.do?action=3Dinitialize I have since created an action mapping called switchToModule of type SwitchAction and replaced the URLs : /switchToModule.do?prefix=3D/admin&page=3D/default.do?action=3Dinitia= lize I am able to go from my default module to the admin module without any problem. But since I do a forward and not a redirect, the address bar is still = http://localhost:8080/app/defaultmodule/default.do?action=3Dinitialize. But if I have a hyperlinkn on a page in the admin module, with a URL validateCustomer.do, the browser appends http://localhost:8080/app/defaultmodule (where app is the application context root and defaultmodule is the previous module) in front of it even though I am already in the admin module. if I click on the hyperlink, the wrong moduleConfig gets loaded because of the wrong module name in the URL and I get an error saying the actionmapping was not found. How does the host name, application name and module name get prepended to my hyperlink url? Is that caused by the browser? How can I get around this so that my URLs point to the current module I am in? I would greatly appreciate your help. Nripesh Palikhya ------_=_NextPart_001_01C3BE88.6585C0C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 6.0.6487.1"> <TITLE>Struts URL problem with switching modules</TITLE> </HEAD> <BODY> <!-- Converted from text/rtf format --> <P><FONT SIZE=3D2 FACE=3D"Courier New">I have an application that I = converted from 1.0 to 1.1. It used to be</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">one single application and now I = separated it into two modules. I am</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">able to switch from one module = to another using the SwitchAction. But</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">I have an issue with my href in = my JSP's.</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier New">I was using tiles to set the HREF = of my menu items and such. The URLs</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">look like</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier = New">/default.do?action=3Dinitialize</FONT> </P> <BR> <P><FONT SIZE=3D2 FACE=3D"Courier New">I have since created an action = mapping called switchToModule of type</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">SwitchAction and replaced the = URLs :</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier = New">/switchToModule.do?prefix=3D/admin&amp;page=3D/default.do?action= =3Dinitialize</FONT> </P> <BR> <P><FONT SIZE=3D2 FACE=3D"Courier New">I am able to go from my default = module to the admin module without any</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">problem. But since I do a = forward and not a redirect, the address bar</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">is still <A = HREF=3D"http://localhost:8080/app/defaultmodule/default.do?action=3Diniti= alize">http://localhost:8080/app/defaultmodule/default.do?action=3Dinitia= lize</A>.</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier New">But if I have a hyperlinkn on a = page in the admin module, with a URL</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">validateCustomer.do, the browser = appends</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New"><A = HREF=3D"http://localhost:8080/app/defaultmodule">http://localhost:8080/ap= p/defaultmodule</A> (where app is the application</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">context root and defaultmodule = is the previous module) in front of it</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">even though I am already in the = admin module.</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier New">if I click on the hyperlink, the = wrong moduleConfig gets loaded</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">because of the wrong module name = in the URL and I get an error saying</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">the actionmapping was not = found.</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier New">How does the host name, = application name and module name get prepended</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">to my hyperlink url? Is that = caused by the browser?</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier New">How can I get around this so that = my URLs point to the current module</FONT> <BR><FONT SIZE=3D2 FACE=3D"Courier New">I am in?</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Courier New">I would greatly appreciate your = help.</FONT> </P> <BR> <BR> <BR> <P><FONT SIZE=3D2 FACE=3D"Arial">Nripesh Palikhya</FONT> </P> </BODY> </HTML> ------_=_NextPart_001_01C3BE88.6585C0C0--