• Post Reply Bookmark Topic Watch Topic
  • New Topic

server handle error jsp page  RSS feed

 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have two jsp files , computearea.jsp in "/ROOT/form-data" & areaerror.jsp in "/ROOT/WEB-INF/classes/" .

whenever an error will occur in the computearea.jsp , server will handle it and display areaerror.jsp .

computearea.jsp


areaerror.jsp


whenever i run "computearea.jsp " it gives errors :


i made the method "toDouble" final because it gave error telling only "final allowed here" .

error after error i am getting it for last 3 days ,

waiting for a Reply
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just out of curiosity, what do you think this is going to do?

In any case, try using <%! ... %>.

I'm assuming there's some reason this is all being done in a JSP and not a servlet.
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:
I'm assuming there's some reason this is all being done in a JSP and not a servlet.


yeah it is for JSP , i also put <%! %> instead of <% %> , all previous error went up and two new came out .


David Newton wrote:
<%
Double length=toDouble(40);
Double width=toDouble();
%>


this is written so that the second line will definitely raise a error at runtime , because nothing will be available for conversion
and errorarea.jsp will be displayed .

David Newton wrote:
Just out of curiosity, what do you think this is going to do?


it is written so that the form will be submitted to itself and if error occurs then the errorarea.jsp will be displayed .


error i got :



 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to back up a step and read the APIs you're trying to use.
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:I think you need to back up a step and read the APIs you're trying to use.

:jumpingjoy:
i got it
1: removed the condition for "submit" because it will never allow empty string and hence i will never get the areaerror page will not be used .

2: instead of putting direct values i put "request.getParameter" , and passed values from a different html file .

once again a big thanks , for asking me on the "submit button" . i can't imagine how a simple thing left me kicking for last 2 days .

cheers
TUSHAR
:jumpingjoy:
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's great :) Glad to hear you're moving forward.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!