Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

which Struts tag?

 
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?
 
Sheriff
Posts: 9674
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • 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...
 
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???
 
I'm full of tinier men! And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic