This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange Behavior of JSP

 
Paddy Joshi
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 136
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 665
4
Eclipse IDE Java Spring
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Paddy Joshi
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read through this topic.
 
Jowel Poquiz
Greenhorn
Posts: 5
Eclipse IDE Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Prasad Krishnegowda
Ranch Hand
Posts: 665
4
Eclipse IDE Java Spring
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64185
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic