Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Button

 
Matt Hoffman
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to do a demo of a application that I started in Struts. All I want is a user to click a button and it takes them to another page. Can this be done without adding and Action code..

This is what I have thus far...
<a href="#"><html:button styleClass="formButton" value="Next" forward="caseDetails"/></a>

How can I get this to work?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want Struts semantics to your button, why use a Struts tag at all? Why not use a plain and simple HTML <button> tag?
 
Nitin Singh
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try this.
1. Add this entry in yr struts-config.xml file's action-mappings section
<action path="/welcome" forward="/YourTargetPage.jsp"/>
2. Add a button as follows in yr page
<html:form action="/welcome">
<html:submit value="TakeMe"/>
</html:form>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin,

JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "yr" instead of spelling out "your" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

thanks,
bear
JSP Forum Bartender
 
Nitin Singh
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
Thanks for pointing it out. I will take care of it in my future posts.

-Nitin
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We'd all appreciate that Nitin. Thank you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic