Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt on Scriptless JSPs

 
Swati Udas
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am refering to page 357 of HFSJ.
It says :

<jsp:setproperty name="person" property="name"
value="<%=request.getParameter("userName")%>"/>

is correct code..

but on page 362 it says sthing else ??


I know simple q.. just a beginner on SCWCD

:roll: :roll: :roll:
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On P-357 we have
<jsp:setproperty name="person" property="name"
value="<%=request.getParameter("userName")%>"/>

This is to set the Person's bean property i.e name with a value that comes form field username

but on P-362
<jsp:setProperty name="person" property="empid" value="<%=request.getParameter("empID")%> "/>

This is to set the Person's bean property i.e empid with a value that comes form field empid

As in the second case we need to set the value in int (primitive) format so String to primitive conversion will not happen and will give error.
 
Swati Udas
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh so its just about..whether it satisfies string to primitive conversion or not.!!
thanks
I kept thiking abt params/scope/attributes etc..craZee
 
Shilpi M Ag
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swati

It works fine for me. Can you give more details?

Shilpi
 
Neeraj Chaturvedi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most probably you are woring with Java-Tiger.

because in java 5 there is implicit conversion between primitives and wrappers.
 
Swati Udas
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Shilpi,
I havent yet tried if it works on my machine, I was trying to clear my concept on what is the difference between those two statements and what should we expect .

THank you for your interest

Swati
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic