wood burning stoves 2.0*
The moose likes JSP and the fly likes How SCRIPT tags are handled in JSP Forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How SCRIPT tags are handled in JSP Forward" Watch "How SCRIPT tags are handled in JSP Forward" New topic
Author

How SCRIPT tags are handled in JSP Forward

Geet Pandy
Greenhorn

Joined: Jun 13, 2002
Posts: 2
I have a JSP page with a Textbox and a GO button
The page also has a readonly text which has a text like ' <SCRIPT SRC=xyz/abc/err.jz> </SCRIPT>
After entering a value in the textbox and GO button is clicked , I do a JSP forward.

My question is, will the above Readonly text value also get submitted and if so will the SCRIPT tag in the readonly text would throw error?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
I'm not sure I completely understand your question, but I'll give it a shot. It seems that you are dealing with both JavaScript and JSP issues.
Ignoring the JavaScript issues for the time being, let's talk about forwarding requests with JSP or Servlet programming. As long as you have a parameter in your request, if you forward the request to another local resource, it will still be there. So, if you have some hidden field specify your static string value, some form is submitted, and some JSP page forwards it to another, the final page will be able to successfully retrieve and use the hidden string value.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Geet Pandy
Greenhorn

Joined: Jun 13, 2002
Posts: 2
Hi,
Thanks for clearing the first issue . Comming to the second issue (which is the javascript issue) do I have to do anything before the form submit?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
If the text can be determined when your JSP page generates the HTML, you can just insert it as a <hidden> field. Otherwise, your JavaScript will have to generate it somehow, setting the value of a <hidden> field before the form is submitted. I'm no expert on JavaScript though (I hate it). You may have better luck in the JavaScript forum.
From what it sounds though, setting a hidden field's value initially will suffice for your needs. (Since it is a static field.)
[ March 16, 2004: Message edited by: Nathaniel Stoddard ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

After entering a value in the textbox and GO button is clicked , I do a JSP forward

That doesn't make much sense. Since you cannot execute a forward as a result of a button press, I am assuming that you are submitting a form to a page (perhaps this very same page) where you would perform a forward? You need to better explain the sequence of events you are attempting.
And, if the script is the value of a form text field, it will just be submitted as text with no interpretation as script.
How about backing off a mile or so and explaining what it is you are trying to do in the first place?
[ March 16, 2004: Message edited by: Bear Bibeault ]
[ March 16, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: How SCRIPT tags are handled in JSP Forward
 
Similar Threads
pressing a button so that it can go back and edit the fields
Using browser back button
Text field not updating
Speed up Application Created USing Servlets and JSP
How do i create dynamic input fields after click a button?