aspose file tools*
The moose likes JSP and the fly likes Repopulating fields? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Repopulating fields?" Watch "Repopulating fields?" New topic
Author

Repopulating fields?

rajesh mara
Greenhorn

Joined: Nov 30, 2006
Posts: 11
Hi everyone,

I have a doubt of how to repopulate fields with error messages below the fields when one of the fields left with blank.


For example

User name -------(Text Box)
Password ------ (Text Box)
Submit(Button)
if user doesn't enters user name or password i should get display like the following

User name -------(Text Box)
Password ------ (Text Box)
Submit(Button)
- User Name Required(in red marks)
please help me anyone how to get display like above instead of getting an alert prompt.

Thank You.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

What are you using on the server? This is something easily accomplished in JSP.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
rajesh mara
Greenhorn

Joined: Nov 30, 2006
Posts: 11
how it can be achieved using jsp, it will be thankful if you send me an example using jsp i.e repopulating
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

You have all the information on the server -- including the nature of the error that your code just detected. It's an easy matter to use JSP technology to format the HTML as appropriate. You can conditionally create an error message on the page, and fill in the form fields with the previous submitted value for a parameter.

For example, assuming that the JSP is being generated in the same request as the form submission (not always true):



Conditional markup is easy with the JSTL <c:if> action:


[ June 17, 2007: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Repopulating fields?