This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes calling jsp directl from HTML form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "calling jsp directl from HTML form" Watch "calling jsp directl from HTML form" New topic
Author

calling jsp directl from HTML form

Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

Hi everybody i am calling jsp directly from HTML form but it is showing error as




HTML file which i am created is



SCJP6.0,My blog Ranchers from Delhi
Shanky Sohar
Ranch Hand

Joined: Mar 17, 2010
Posts: 1051

JSP which i am having is
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

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.


Mohamed Sanaulla | My Blog
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
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

Joined: Mar 17, 2010
Posts: 1051

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

Joined: Mar 17, 2010
Posts: 1051

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..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
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

Joined: Mar 17, 2010
Posts: 1051

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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

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

Joined: Mar 17, 2010
Posts: 1051

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
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3064
    
  33

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling jsp directl from HTML form
 
Similar Threads
requested resource not found error
Need help with a servlet problem
Simple examples of JSP
405 error
Strange Behavior of JSP