Re: Rewriting the URL in a form:form action

2000-12-07 Thread Erik Horstkotte

Westbay-san wrote:

 Please try something like:
 
 form:form action="%= request.getContextPath() %/x"
 
 While I'm still learning the Struts' tag libraries, I believe that
 this is the way to do it.  I belive that scriplets parse before
 taglibs, so the result of %= request.getContextPath() % will be put
 into the action attribute before the form:form is parsed.  (Please,
 somebody correct me if I'm wrong on that point.)

Unfortunately, it appears that scriptlets parse *after* taglibs. When
I use this, the generated html is:

action="lt;%= request.getContextPath() %gt;/x"

G.

It seems that I may be writing my own taglib sooner than I thought!

-- Erik





Re: Rewriting the URL in a form:form action

2000-12-07 Thread Michael Westbay

McClanahan-san wrote:

 This approach definitely works ... but it would seem to make sense for the
 form:form tag to assume a path starting with "/" should be interpreted as
 context relative.  Let me think about it a little more -- if there are no
 gotchas, I will make the tag smarter about this.

The only "gotchas" I can think of is when you WANT to go to a different
context.  Several people have expressed that they want to break up development
into several contexts for each subproject, but they should all act as a whole
in the end.  Therefore, it wouldn't be unusual to post to a different context.

Of course, that would most likely be the exception to most circumstances, so
a flag to override action.startsWith("/") would probably allow for both types
to live together.

--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:   http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/



Re: Rewriting the URL in a form:form action

2000-12-07 Thread Erik Horstkotte

Craig R. McClanahan wrote:

 Michael Westbay wrote:
 
  Please try something like:
 
  form:form action="%= request.getContextPath() %/x"
 
 
 This won't work (invalid tag attribute syntax), but the following
 will:
 
 form:form action='%= request.getContextPath() + "/x" %'

Thanks! That works fine.

-- Erik





Rewriting the URL in a form:form action

2000-12-06 Thread Erik Horstkotte

I've got a system with a large number of JSPs that I'm developing
using Tomcat 3.2 and Struts 1.0 (12/4 nightly build). Because of the
large number of files, I've started organizing the them in
subdirectories. This has caused me to run into a problem, however.
There doesn't appear to be any way to cause the URL in a form:form
tag's "action" parameter to be rewritten using the webapp's context
path. As a result, if I use an action="x", it directs the action to
x in the current directory, which in my case isn't what I want. If I
use an action="/x", it directs the action to the x in the web server's
root directory - not the root of my webapp context, which is what I
want.

I tried embedding form:rewrite page="x" inside the action= of the
form:form, but predictably that does not make jasper happy at all:
"Attribute  has no value" - note the empty attribute name in the
message.

Does anyone have ideas on how to make this fly, or do I simply have to
go back to a flat directory structure?

-- Erik





RE: Rewriting the URL in a form:form action

2000-12-06 Thread Colin Sampaleanu

The action parameter can handle a runtime expression, so you should be able
to build a custom value in there that includes the context path...

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: December 6, 2000 2:48 PM
 To: [EMAIL PROTECTED]
 Subject: Rewriting the URL in a form:form action
 
 I've got a system with a large number of JSPs that I'm developing
 using Tomcat 3.2 and Struts 1.0 (12/4 nightly build). Because of the
 large number of files, I've started organizing the them in
 subdirectories. This has caused me to run into a problem, however.
 There doesn't appear to be any way to cause the URL in a form:form
 tag's "action" parameter to be rewritten using the webapp's context
 path. As a result, if I use an action="x", it directs the action to
 x in the current directory, which in my case isn't what I want. If I
 use an action="/x", it directs the action to the x in the web server's
 root directory - not the root of my webapp context, which is what I
 want.
 
 I tried embedding form:rewrite page="x" inside the action= of the
 form:form, but predictably that does not make jasper happy at all:
 "Attribute  has no value" - note the empty attribute name in the
 message.
 
 Does anyone have ideas on how to make this fly, or do I simply have to
 go back to a flat directory structure?
 
 -- Erik
 
 



Re: Rewriting the URL in a form:form action

2000-12-06 Thread Michael Westbay

I had suggested:

 form:form action="%= request.getContextPath() %/x"

as a possible solution to the form URI getting the context
problem.  But in another thread, Richards-san pointed out
(asked?):

 And although we can so things within % % tags, it is not
 preferred?

So, I guess that the politically correct way would be to
extend the form tag to take an attribute like:

form:form action="/x" usecontextpath="true"

Wasn't something like this brought up with another tag ealier?

--
Michael Westbay
Work: Beacon-IT http://www.beacon-it.co.jp/
Home:   http://www.seaple.icc.ne.jp/~westbay
Commentary: http://www.japanesebaseball.com/