• Post Reply Bookmark Topic Watch Topic
  • New Topic

Modified Code Barn Simple MVC not works  RSS feed

 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

I copied the Code Barn SimpleMVC.war file and paste it to tomcat\web-apps\ and it works fine... Then i made some changes with the program and create a WAR file and paste it to webapps folder.. but now it shows error that

HTTP Status 404 - /SimpleMVC/

--------------------------------------------------------------------------------

type Status report

message /SimpleMVC/

description The requested resource (/SimpleMVC/) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.16

Here is the modified code
--------------------------
ControllerServlet.java


ModelBean.java


view.jsp




What is the problem.. did i do any mistake? please help me get rid of this..
 
Nickolas Case
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Tomcat says it is unavailable, you may want to check your DD. That seems to be the most common fix for this issue.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not following the Javabean coding conventions (which is necessary for use with EL).

If you have a property named "thing", the setter should be spelled "setThing" and the getter should be spelled "getThing". Notice the capital "T".

When you use the EL expression ${modelBean.thing}, the JSP engine is going to add the "get" and capitalize the first letter, turning it into "getThing". Since Java is case sensitive, a method named getthing would not match.
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now i change the username to UserName.. all works fine it executes and displays the login page but when i click the submit button it shows an error like this...


HTTP Status 500 -

org.apache.jasper.JasperException: An exception occurred processing JSP page /view.jsp at line 16

13: <td>
14: <input type="text"
15: name="username"
16: value="${modelBean.UserName}" />
17: </td>
18: </tr>
19: <tr>




But i have changed the username to UserName but still it troubles me... what should i do now?

Help me regards this...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are still not following the JavaBean rules that Ben outlined.
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr.Bear Bibeault could you please tell me whats wrong with my EL. Because i dont know much about EL. Even though i changed message to Message it doesnt seems to be work. Can you spot my mistake and give me the answer. Please help me as i am a beginner. Thanks in advance
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be "userName", not "UserName". The Java class then needs to have methods called setUserName and getUserName.

I think it would be helpful for you to go through an introduction to JSP; you might start with this free book.
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mr.Ulf Dittmer
Now i got a clear idea on EL and modify the program again.. yes it's working. The online free ebook is very helpful to understand JSP and Servlet concept for a beginner like me.. Anyway thanks for everybody helps regrding this problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!