File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes which Struts tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "which Struts tag?" Watch "which Struts tag?" New topic

which Struts tag?

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
I have a login page with username and password .After entering the credentials , a click on login button in this page would take me to a jsp which has CreateProject button.

A click on this button would take me to another jsp which consists of a form. This form has a textField called projectCreator which should be set with the username of the user.

How can I set the user name in that textfield? what tag should i use, as scriplet in not the right way?
Ankit Garg

Joined: Aug 03, 2008
Posts: 9291

There are many ways of doing this. Let's say that a session scoped attribute named "username" stores the username. Then to put that as a value in a textfield, you've gotta do just this

This will set the value of the username session attribute as the value of the textfield...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
galne vaibhav

Joined: Nov 30, 2009
Posts: 9
you only have to follow struts way of doing it you have call the setter method of the textfield
for example
my field name:
private String txtDescription;

getter and setters
public String getTxtDescription() {
return txtDescription;
public void setTxtDescription(String txtDescription) {
this.txtDescription = txtDescription;

In targeted method

place one line


reply if you want more detail.
Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
A delayed reply but yes I did that...

This is what I have,

My JSP...

Nothing is getting printed in the UI..

The output :-->


If I remove theme="none" then,

In UI:

projectCreator //line1
(textfield) //line2

what should be the changes??

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
any takers, please???
I agree. Here's the link:
subject: which Struts tag?
Similar Threads
displaying user eneterd value on jsp page
Java for log in authentication? (looking for tutorial that applies to situation)
conditionally targetting the client frame based on Server(servlet) program
imp.- j_security_check authenticates .. but how to set session as well ..?
check if user has access to a specific page.