Oh I definitely think it's more than okay to use tags to help generate JavaScript. In fact, using server-side code to generate client-side code is a telltale sign of a very seasoned and very respected developer ;-). The only reason I jumped in at all (and yes, it was late, sorry if I missed some of the back-story) was to help clarify that this:

<html:rewrite page="/'+action+'.do"/>

is busted as far as tag syntax goes. Other than that...

Rick Reumann wrote:
Durham David Contr 805 CSPTS/SCE wrote the following on 9/14/2004 1:31 PM:

I tested the code -- not that I needed to do so, but still.


I'm sure you didn't need to test it "Oh almighty coding God."

Just throw it into a JSP and look at the resulting HTML.


Here's an index.jsp that I've ran in Tomcat 5.x:


<html> <head> <script> function swapAction( formName, action) { formAction = document.getElementById( formName ).action; newAction = '<html:rewrite page="/'+action+'.do"/>'; document.getElementById( formName ).action = newAction; } </script> <body> </body> </html>


Are you saying that's how the resulting HTML looked? If so then you don't have a clue what the javascript was attempting to do because that's not what the resulting HTML will look like if you are correctly using the Struts html tag. Sorry for sounding harsh but I've been nothing but patient and instead all you've said, as of late, is stuff like "That no one sees it is blowing my mind" or "This is ludicrous" yet you haven't explained what part you are seeing as "ludicrous." On top of that I've clearly showed what the html:rewrite tag will display as HTML and showed how I could swap out using the html:rewrite tag if I wanted (but would lose the nice URL encoding and sessionid stuff).

I really hope that I don't need to go further with this.  In the words
of Mike Tyson, "This is ludicrous!"


Your initial comment in this thread was:

"It looks like JavaScript is being used to generate an <html:rewrite/>."

and as Michael pointed out JavasScript isn't 'generating' anything and as I've mentioned a bunch of times now all that the html:rewrite does is write to the page encoding the URL and appending jsessionid if necessary.

And I'm sure Kris jumped in the thread late or else he would have seen my post about "I knew there was a reason I used html:rewrite verses using the ${pageContext.request.contextPath}" stuff. (Which I mentioned that later was a wrong approach).

David, Kris is actually clarifing EXACTLY what we are talking about when he mentions:

"Tags like <html:rewrite> and <c:url> are great for generating
URLs to be used by JavaScript code that needs to interact with web apps. One of the reasons they're so useful is that they have built-in support for URL rewriting (encoding of session info)."


and Michael... I think Kris is saying it is ok.. since above he mentions how they are "great for generating.."

The problem David is you keep complaining how we don't "see" what you're talking about yet I haven't seen an explanation of what we aren't "seeing." If by "what we are not seeing" you mean the generated HTML you mention above... what you are displaying as generated HTML is not the same generated HTML that I see when I run the same code.

Does this whole problem revolve around you not importing the struts html tag on the page?

Besides just saying how things are ludicrous, or how blind we must be, and acting all arrogant with comments like "I tested the code -- not that I needed to do so," instead why don't you be more specific about what the problem is? And if we are wrong about something have a bit of humility. Nobody in this industry knows it all.

-- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to