• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

which Struts tag?

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9520
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
galne vaibhav
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

setTxtDescription(txtDescription);

reply if you want more detail.
 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A delayed reply but yes I did that...

This is what I have,

LoginAction.java



My JSP...



Nothing is getting printed in the UI..

The output :-->
---------------------

projectCreator:emptyspace

If I remove theme="none" then,

In UI:
---------

projectCreator //line1
(textfield) //line2


what should be the changes??

 
Pradeep Adibatla
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any takers, please???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic