struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Meytin <m...@meytin.com>
Subject Re: Using relative actions in html:form attributes...
Date Thu, 01 Aug 2002 21:37:04 GMT
Hmm, interesting...  I was under impression that Struts
enforces the fact that form element tags must be inside
html:form tags.  Well, after your suggestion, I tried putting
them inside the regular form tags, and it did not complain.
So, at least in this version of Struts (1.0.2) it seems
to work.  I also had to add "name" attribute to every single
element of the form, otherwise I was getting the
following exception:

javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN in scope
null
         at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:493)
         at org.apache.struts.taglib.html.BaseFieldTag.doStartTag(BaseFieldTag.java:188)
         ....

which is understandable, since without that attribute and without
enclosing html:form, elements have no idea where to find their
values.  Well, at least now I have a workaround, albeit not a
very clean one, in my opinion.  I still don't understand why
not let html:form use relative actions, perhaps I'm missing
something here.  In any case, thanks, Troy - your input
is much appreciated!

-M-

Troy Hart wrote:

> I'm not so sure that is correct. It seems like I have done this before,
> but I don't recall for sure. I am in the middle of some other stuff and
> don't have time to test it now, but you should give it a quick try. Or,
> maybe you already have?
> 
> Good Luck,
> 
> Troy
> 
> On Thu, 2002-08-01 at 15:05, Mark Meytin wrote:
> 
>>That would work of course, but as a result I won't be
>>able to use other html tags that go inside html:form,
>>such as html:select, html:text, etc - and therefore
>>abandon a large chunk of functionality provided by Struts.
>>I'm kinda curious why Struts developers would not
>>simply allow relative action elements, perhaps if a
>>special attribute was present.  Perhaps this is
>>a question for dev-list.
>>
>>Thanks for your answer,
>>-M-
>>
>>Troy Hart wrote:
>>
>>
>>>One very simple thing to do is forgo the use of <html:form> in favor of
>>>the plain html <form>.
>>>
>>>Troy
>>>
>>>
>>>
>>>On Thu, 2002-08-01 at 13:23, Mark Meytin wrote:
>>>
>>>
>>>>Hello!
>>>>
>>>>I have the following interesting problem with Struts 1.0.2 running under
>>>>Tomcat 4.0.4 and Apache combo.  I would like to specify relative
>>>>actions in the html:form tags.  The problem now is that html:form
>>>>tag converts action attributes into absolute paths, for example
>>>>if I specify action="search.do" in html:form tags, the
>>>>resulting HTML page contains <form action="/myapp/search.do">
>>>>tag, where it gets /myapp prefix by always unconditionally making
>>>>a call to request.getContextPath().  Well, in my case this is not
>>>>working, because due to the use of Apache ProxyPass statements,
>>>>URLs of the pages do not correspond to Tomcat ContextPaths.  
>>>>Specifically, my JSP files are located in /webapps/superapp/subdir
>>>>directory, through the magic of the following ProxyPass statements:
>>>>
>>>>ProxyPass         /subdir         http://localhost:8080/superapp/subdir
>>>>ProxyPassReverse  /subdir         http://localhost:8080/superapp/subdir
>>>>
>>>>I can access my pages by going to http://<myhost>/subdir/page.jsp
>>>>and my actions as http://<myhost>/subdir/action.do.  But because
>>>>html:form tag generates a link to /superapp/subdir/action.do my
>>>>forms cannot access the action at all, resulting in Apache's 404
>>>>result.  
>>>>
>>>>Any ideas will be much appreciated!  It there a way to handle this
>>>>type of situation, when Apache URLs do not correspond to
>>>>Tomcat ContextPath URLs?  I'm getting a bit desperate here ;^)
>>>>
>>>>-M-
>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
>>>>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
>>>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>>>
>>
>>
>>--
>>To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
>>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 



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


Mime
View raw message