• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

which Struts tag?

 
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 9697
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any takers, please???
 
reply
    Bookmark Topic Watch Topic
  • New Topic