Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

struts html:form resolving action  with double slashes

Thread view: 
ramakrishna - 08 May 2007 16:01 GMT
Dear all,

I have a problem in html:form form tag.

Iam using following html code.

<html:form action="/addUser.do">
</html>

while resolving the aciton it is giving the following result.

<form method="post" name="userForm" action="//addUser.do">
</form>

Iam getting "//addUser.do" double slashes in action element.

Could you please send me the solution for this.

Please send me reply.

Thanks In Advance.

Please find the struts-config.xml entry

- <form-beans>
 <form-bean name="userForm" type="com.ebg.formbean.UserForm" />
 </form-beans>

- <!--  ========== Action Mapping Definitions
==============================
 -->
- <action-mappings>
- <action path="/addUser" name="userForm"
type="com.ebg.actions.AddUserAction" scope="request" validate="true"
input="fail">
 <forward name="success" path="/work/blackListSearch.jsp" />
 <forward name="fail" path="/displayUser" />
 </action>
 <action path="/displayUser" scope="request" forward="/work/
addUser.jsp" />
 </action-mappings>
Tarkin - 08 May 2007 16:09 GMT
On May 8, 11:01 am, ramakrishna <ramakrishna.nelava...@gmail.com>
wrote:
> Dear all,
>
[quoted text clipped - 37 lines]
> addUser.jsp" />
>   </action-mappings>

I don't think you have to use the '/' in the tag, especially
if it's a globally-mapped action. I'm not 100% certain on
this; it's just a guess. Check the docs or API for
the html:form tag.

HTH,
 Tarkin
Tim Slattery - 08 May 2007 17:41 GMT
>Dear all,
>
[quoted text clipped - 11 lines]
>
>Iam getting "//addUser.do" double slashes in action element.

I can tell you that we don't use a leading "/" in the 'action" names
in our tags. Struts prefixes the appname and a leading slash. This
tag:

<html:form action="entryFormUpdate.do" styleId="updform"
scope="request">

renders this way:

<form name="EntryFormBean" method="post"
action="/CES/entryFormUpdate.do" id="updform">

Signature

Tim Slattery
Slattery_T@bls.gov
http://members.cox.net/slatteryt

ramakrishna - 09 May 2007 09:59 GMT
I got the solution..

I'm using Tomcat 5.0.19 and Struts 1.1 on W2K.

My problems started when I moved my web application from a context, to
the
container root.

Struts generated urls with double leading slash such as //Login.do
which
caused all sorts of problems.

My <html:form action="/myAction">

generated <form action="//myAction.do">

or if the page was in a module called test it generated

<form action="//test/myAction.do">

The problem?  I had incorrectly deployed the application into the root
by
specifying the context path as / instead of null.

Tomcat took it so I thought all was well, (a few <html:img> problems
which I
worked around by using <c:url...> ) but of course
javax.servlet.ServletContext.getServletContextName returns what I
typed (
"/" ) and thus the double slashes.

My incorrect <context> read:
<Context path="/" docBase="D:/Website/" ... >

and the correct one:

<Context path="" docBase="D:/Website/" ... >

Although it's pretty hard to search the archives (even google) for //
double
slashes maybe this will help someone else out.

> >Dear all,
> >
[quoted text clipped - 28 lines]
> Slattery_T@bls.gov
> http://members.cox.net/slatteryt


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.