user2930804
user2930804

Reputation: 13

How to set default values in jsp?

Application getting first name,lastname,email address from network login screen through index pages. Those user details getting http...But this option will happen when application working under deployment environment.

I'm working local development environment , so no option to get the user details from http.Please find the below code getting from http to inilize the page.

<input type="hidden" name="fname" value="<%= fname %>">
<input type="hidden" name="lname" value="<%= lname %>">
<input type="hidden" name="email" value="<%= email %>">

My question is how to set the default values to inilize the all pages ?

Thanks,

Upvotes: 0

Views: 14131

Answers (3)

Manish Doshi
Manish Doshi

Reputation: 1193

In the example above, given a list of three well known cities and a default value in the form backing object, the HTML would be

Town:

<input type="radio" name="address.town" value="London">

London

    <input type="radio" name="address.town" value="Paris"
      checked="checked">

Paris

<input type="radio" name="address.town" value="New York">

NewYork

Upvotes: 0

Baby
Baby

Reputation: 5102

when you declare the variable fname, lname, and email, just assign your desired value directly

String fname="bill";
String lname="gates";
String email="[email protected]";

Upvotes: 0

Vimal Bera
Vimal Bera

Reputation: 10497

Simply pass the value which you want to set in input type, like this :

<input type="hidden" name="fname" value="Vimal">
<input type="hidden" name="lname" value="Bera">
<input type="hidden" name="useremail" value="[email protected]">

Upvotes: 2

Related Questions