wood burning stoves 2.0*
The moose likes JSP and the fly likes Jsp with multiple user attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp with multiple user attributes" Watch "Jsp with multiple user attributes" New topic
Author

Jsp with multiple user attributes

Deepak Naithani
Greenhorn

Joined: Aug 30, 2012
Posts: 25
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

Joined: Aug 06, 2012
Posts: 122

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

Joined: Aug 30, 2012
Posts: 25
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

Joined: Aug 30, 2012
Posts: 90
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

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jsp with multiple user attributes
 
Similar Threads
upload an avatar or other file
Move from one project to another in jsp
Struts 2 checkboxlist error - list key could not be resolved
MultipartRequest cannot be resolved to a type
Is submitting a form send-redirect or forward?