This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Flow being lost

 
Sean Hetfield
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set up three .jsp pages (input.jsp and output.jsp and error.jsp).

On the input.jsp I have a listbox � single select. When the submit button is clicked, based on the value chosen, input.jsp is directed to the correct page. In the submit button action handler, I have placed the following code:

Note: I changed the actual names of the classes and methods.

public String doButton1Action() {
SomeClass ilClass = new SomeClass();
java.lang.String ilString = getListbox1().getValue().toString(); //value of the listbox

if(ilString.equals("000"))
return "input"; //navigates to the correct page
else if(ilString.equals("111"))
{
if(ilString.equals(String.valueOf(ilClass.getAnAttribute())))
{
java.lang.String ilValue = ilClass.AssembleAReallyLongString();
requestScope.put("P", ilValue); //I�ve even tried to hard code a literal but that doesn�t work either
}
return "success"; //navigates to the correct page
}
else
return "fail"; //navigates to the correct page

}

In output.jsp, I�ve declared a requestScope scripting variable called P of type java.lang.String and bound it to an output control. The output.jsp output control�s format is String.

In input.jsp, I tried both ways by declaring and not declare a requestScope scripting variable called P.

With either case, the String will not display in the output.jsp control that I bound the requestScope scripting P to.

Am I going about this wrong? Would you have any suggestions?

Any help is appreciated.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is requestScope and where does it come from?

Anyway, it looks like a weird way to pass values from one to other page. What exactly do you want to achieve? Is the managed bean request or session scoped? Can you show some snippets of the relevant JSF code?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Metariya",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic