This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Internal servlet error?

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have the following two simple files and i'm getting internal servlet error,would you please tell me what is wrong?
login.jsp code:
//---------------
<html>
<body bgcolor="#999999">

<form action="/examples/jsp/lloTest/response10.jsp" action="POST" >
<table>
<tr><tr><tr><tr>
<td><td><td><td><td><td><td><b>ID</b></td><td><input type="text" name="id" ></td></td></td></td></td>
</tr></tr></tr></tr>
</table>
</form>
</body>
</html>

//---------------
response10.jsp code
//----------
<% String s= request.getParameter("id"); %>
<html>
<form>
id is <input type="text" name=id value=s ><br>
</form>
</html>

//------------
 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darine,
What does the error say exactly? When do you get the error?
I think you have a problem with the configuration of the JSP/Servlet engine, since these files will compile and run just fine on my machine.
Also, to comment on your code:

It shouldn't read action="POST". If you want to post the info, the correct attribute is method.

The form in login.jsp has no submit button, so there is no way to send the data to response10.jsp. You need a submit button inside the <form></form> tags.

I also not quite sure why you need all the table rows and cells, you could get more bang for your buck and make your stuff easier to read without it. If you want to make it in a table, you could use cell padding or spacing and less <tr><td></td></tr>.
This first file could be named .html and it would work exactly the same as static content.
In the second .jsp, you get the value id from the form, but the way you are trying to display it won't work.

This will make a text box with the letter s inside.
You need to have <%...%> to access the java variables.
You could change it to:

Or since it isn't going to be submitted to anything, you could drop the textbox and <form></form> tags altogether and do something like this.

None of this will solve the error you are getting, but it should help once you get the server configured.
Also, understanding html is fundamental to 90% of what you are going to do with servlets and 99.99% of .jsp. So getting a better grasp of this technology will be invaluable. There are lots of resources, I suggest webmonkey.com. I'm always using their html cheatsheet. They have tutorials for more html than you want to know.
Happy coding
Andrew
P.S. Give us more information about the server you are trying to run the files on and the specifics of the message you receive.
 
darine darine
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks alot.
that is a big help.
 
A feeble attempt to tell you about our stuff that makes us money
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic