Create a simple JavaBean StaticParameter.java in the "struts2tutorial\WEB-INF\src\java\net\roseindia" directory. Here the "StaticParameter" class extends the ActionSupport class. It sets and gets the three static parameters by using the setParameter1(), setParameter2(), setParameter3() and getParameter1(), getParameter2(), getParameter3() methods.
Now compile the JavaBean (StaticParameter.java) through the 'ant' command.
StaticParameter.java
package net.roseindia;
|
Create a jsp page(showparameters.jsp) to view the static parameters.
showparameters.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
|
Open web browser and give request as http://localhost:8080/struts2tutorial/roseindia/StaticParameter.action. It displays a table
that contains three static parameters in key-value format .
Output of this application:
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Static Parameter, Static Parameter in Struts 2, Struts 2 Static Parameter
Post your Comment