• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How SCRIPT tags are handled in JSP Forward

 
Geet Pandy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Geet Pandy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic