• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

static results in JSP pages

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
I am a new member of the group.I have to build an application using JSP.
I created the .JSP files and put them in the tomcat directory jsp-examples\mydirectory\..
also i created my login.java file and put that at WEB-INF\classes directory.
Now the problem is when i called the TOMCAT i cud execute and link my JSP files with the
class java file.The deatils which i get for the 1st time remains for ever without getting
refreshed.even incase i change the contents of the .java file it doesn't change at all.
how to rectify it.please help.i have given the code for ur reference.

the codes are as follows

1) login.jsp

<html>
<body>
<FORM name="login" METHOD="POST" ACTION="Welcome.jsp">
Username:<INPUT name="id" type="text">
Password: <input name ="pwd" type="password">
</form>
</html>

2) Welcome.jsp

<%@ pageimport ="pj05t05.nata.*"%> //this is my package name
<html>
<head>
<meta http-equiv ="20" />
<body>
<%
String id=request.getParameter("id");
String pwd=request.getParameter("pwd");
login l1=new login();
String name= l1.validate(id,pwd);
%>

<%=name%>
</body>
</head>
</html>

3) login.java

package pj05t05.nata;
public class login
{
public String validate(String id,String pwd)
{

String s1,s2;
s1="t05";s2="t05";
if( s1.equals("id") & s2.equals("pwd"))
return "nata";
else
return "here";
}
}


this is my probs as i need to know the fix it ASAP please help me out.
Thanking you in advance,
nata.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if this is the problem you are talking about, but the login.validate() method is wrong - the existing code will *always* return the String "here" because it tests the String "t05" against the String "id" - *NOT* the value held in the String variable id - the actual String literal "id". The same problem exists with pwd. Leave the quotes off both id and pwd in the equals statements.
 
Sheriff
Posts: 67682
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
It also sounds like you may be expecting your .java files to automatically get recompiled when you change them. If this impression is correct, be advised that you must compile changes to your java files and be sure that their class files end up in the right place.

Also, natarajan, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

thanks,
bear
JSP Forum Bartender
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic