This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes request time expression Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "request time expression" Watch "request time expression" New topic
Author

request time expression

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1240
<jsp:setProperty name="address"
property="city"
value="<%= theCity %>" />

what is the theCity in here:

I used it as follows ,But it says name cann't be resolve

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

If you didn't define it, and it's not a JSP implicit variable, then it does not exist.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1240
what is mean not created.
this is my form


what else shuld i have to created ?
sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1240
cann't i used this to retrive the forms detail

Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874




What is "<%= name %>" here ? If you say its form input element "name" , i m afraid you can use like that.
How do you retrieve form element in Servlet ? using request object ? the same applies to JSP also . But JSP has 2 way to go

Use EL , the most simple way to get it. ${param.name}

Other bad way is to use scriplets like request.getParameter("name");
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

aruna sameera wrote:cann't i used this to retrive the forms detail

No. In a modern JSP, you'd do that with the EL param built-in map; or better yet, you'd submit to a controller rather than a JSP.

But since you are still using old-fashioned scriptlets, you'd use the API on the request as Balu pointed out.

You really either need to read the JSP Specification, or find a good JSP tutorial. The questions you are asking show that you do not have a basic understand of what JSP is and how it operates. You can start with this article that describes JSP concepts and basic operation.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: request time expression
 
It's not a secret anymore!