• 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

calling jsp directl from HTML form

 
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody i am calling jsp directly from HTML form but it is showing error as




HTML file which i am created is


 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP which i am having is
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell about the directory structure of your html/jsp pages. Where is the JSP relative to the HTML? Or you might try removing the "/" from the JSP page name.
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are missing a starting quote in front of the class attribute valueAnd because of that the jsp does not compile. So check that first.

But if that was the problem then I would think that you would get a different error. Depends of course what servlet container you are using and with what kind of error messages. Is there something in the server logs that would help you more? Even if missing the starting quote was you problem you should find out if you can find somewhere a more verbose error messages since it will help you in the future if you just make a similar easy mistake...

EDIT: and based on the error message itself I think mohamed sanullah may be right and you are pointing to the root of tomcat and not inside your web application.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

mohamed sanaullah wrote:Can you tell about the directory structure of your html/jsp pages. Where is the JSP relative to the HTML? Or you might try removing the "/" from the JSP page name.


both the files are there in this directory,,
F:\Servets Work\MyProject1\WebContent\


and when i tried removing the / from jsp name,then i got error related to "/" .so added it again.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What comes to my mind is that the HTML code does not even able to invoke the JSP.

Can i check the logs and able to track where the flow is going on.
i am using TOMCAT But i think the tracking JSP and HTML is not possible in logs..Is it Possible..
 
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

Shanky Sohar wrote:What comes to my mind is that the HTML code does not even able to invoke the JSP.


Incorrect. It doesn't matter how the request is generated -- it's all the same to the server.

It's most likely that your URL is incorrect. What is the context path to the web app? It appears to be missing unless the app is deployed as the root web application.

P.S. It's a poor practice to post a form to a JSP from anywhere. A servlet controller should be handling data submission.
 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you add the quote I mentioned?

What is the URL in the browser address field after you have sent the form? Is it pointing to right URL?

Can you access the JSP directly without going through the html page?

What comes to my mind is that the HTML code does not even able to invoke the JSP.

No. This can not be the problem. Think about it, every page that is created with jsp is actually html page so what you are saying actually would mean that you can not point to other jsp page from other jsp page. And that is not the case. You can use static html pages and dynamic jsp pages on you application as you like.

Can i check the logs and able to track where the flow is going on.
i am using TOMCAT But i think the tracking JSP and HTML is not possible in logs..Is it Possible..


What do you mean by flow? You can see from the browser address field where the application has directed you. If the server produces logs they are located under logs directory inside tomcat installation directory.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ilari Moilanen wrote:Did you add the quote I mentioned?

What is the URL in the browser address field after you have sent the form? Is it pointing to right URL?

Can you access the JSP directly without going through the html page?

What comes to my mind is that the HTML code does not even able to invoke the JSP.

No. This can not be the problem. Think about it, every page that is created with jsp is actually html page so what you are saying actually would mean that you can not point to other jsp page from other jsp page. And that is not the case. You can use static html pages and dynamic jsp pages on you application as you like.


Oops,sorry i didnot mean this..I mean in my code,HTML page is not even able to find the jsp..So how could it be able to invoke it.


Can i check the logs and able to track where the flow is going on.
i am using TOMCAT But i think the tracking JSP and HTML is not possible in logs..Is it Possible..


What do you mean by flow? You can see from the browser address field where the application has directed you. If the server produces logs they are located under logs directory inside tomcat installation directory.



Mean as i can debug the simple java code is it possible for me to debug the JSP and HTML files..
 
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
What URL in the browser correctly invoked the JSP page? Until you know what the correct URL is, you have no hope of solving this.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This problem is solved now.
I have changed the name of "/TestBean.jsp" as "TestBean.jsp" and restarted my server again.
But it is not working earlier i donot know how it got solved this time..
Thanks to everybody for helping me out in this..
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shanky Sohar wrote:This problem is solved now.
I have changed the name of "/TestBean.jsp" as "TestBean.jsp" and restarted my server again.
But it is not working earlier i donot know how it got solved this time..
Thanks to everybody for helping me out in this..



I think the reason would be:
/TestBean.jsp - This JSP page from the root. This doesnt consider the Appname. So it was giving you the error
TestBean.jsp- This JSP relative to the current path.
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic