• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Strange Behavior of JSP

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 136
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 :-)
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read through this topic.
 
Greenhorn
Posts: 5
Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 672
4
Eclipse IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic