aspose file tools*
The moose likes JSP and the fly likes Strange Behavior of JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Strange Behavior of JSP" Watch "Strange Behavior of JSP" New topic
Author

Strange Behavior of JSP

Paddy Joshi
Greenhorn

Joined: Oct 13, 2010
Posts: 10
Hi,
i am new to jsp. I tried to read html form data into jsp page ... . I have taken two input fields of text and one submit button ... on clicking of submit jsp page shows first and last name. but problems arises when i run html file on server first time and submit it ... it won't work and field gets reseted ... but when i enter data again it works correctly. its strange thing that happened ... please help me with this

Sabarish Venkat
Ranch Hand

Joined: Jan 18, 2012
Posts: 136

May i know why you are using that html form in out.println() line.. I think that is the prob it reloads your form once again so you are not getting it... try to remove that line and run it.. hope it will work.
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 510

First, if you are new to JSP, learn the good habits, that is no Java inside JSP, its discredited 10 years back.

As far as the problem, in your JSP, make type of submit to button, its should not be submit, also, there is no action, where do you expect the page to submit?


Regards, Prasad
SCJP 5 (93%)
Paddy Joshi
Greenhorn

Joined: Oct 13, 2010
Posts: 10
no Java inside JSP


can you please tell me why? can you give example regarding this i mean .... the code i written ...how to write in good jsp format... thnks in advance :-)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Read through this topic.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jowel Poquiz
Greenhorn

Joined: Apr 25, 2011
Posts: 5

jsp pages with inline java codes is simply hard to maintain and debug. in your situation, having inline java codes is acceptable while learning jsp pages, that's how i started too. have you tried the suggestions of prasad and sabi? you should learn next about jsp el in order to replace inline java codes.


OCPJP6, OCE WCD
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 510

Jowel Poquiz wrote:having inline java codes is acceptable while learning jsp pages

I would not accept that, you will not use that, so what's the point in wasting time to learn things which you don't use? It's better to invest these time in learning EL and JSTL..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61066
    
  66

Indeed, it's like saying that using vacuum tubes is ok while learning how to design TVs. It's wasted effort and just creating bad habits.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strange Behavior of JSP