Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp with multiple user attributes

 
Deepak Naithani
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm doing simple JSP program for taking user input and producing output the same way data was entered.

I'm creating method for taking the input but it is not working properly (set and get method in JSP). I've read that we have to make method name such that it should match the name property of input type like

In JSP file<br>
<input type="text" name="userName" />

In java file




for one input i can do it but but for multiple input like name , number , age, etc i am not getting it done correctly help me for this.

Thanks.
 
Kathleen Angeles
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the entire class?

By the way, if the field is userName, the method should be setUserName, not setuserName.
 
Deepak Naithani
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have solved the problem.

I was only asking for this thing and also for multiple attribute there should be a getter and setter method.
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For this, you can make use of JSP tags like :
<jsp:useBean>

Also, make use of camel casing
public void setuserName(String name){}


It should be like:
public void setUserName(String name){}

See some examples of JSP, Servlet and Java Beans.

Thanks,
Ashwini Kashyap | www.infocepts.com

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic