Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7940167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:18:30+00:00 2026-06-03T23:18:30+00:00

I have two jsp files as follow: myform.jsp <%@ page contentType=’text/html; charset=UTF-8′ errorPage=” %>

  • 0

I have two jsp files as follow:

myform.jsp
<%@ page contentType='text/html; charset=UTF-8' errorPage='' %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<s:form id="myform" name="myform" namespace="/" theme='simple' action='createPage' method='post'>
    <table  width='100%'>
        <tr>
            <td>
                <table width='100%'> 
                    <s:select id='parameterDataType' name='parameterDataType' theme="xhtml" required="true" key='param.datatype' list='#application.myList' emptyOption="true" listKey='listKey' listValue='listValue'/>
                </table>
                <table width='100%'>
                    <s:if test="parameterDataType != null">
                        <tr id='defParameterDefaultValue'>
                            <td class="tdLabel" >
                                <s:label cssClass="label" key="param.value"/></td>
                            <td ><%@ include file='/pages/datatypes.jsp' %></td>
                        </tr> 
                    </s:if>
                </table>
            </td>
        </tr>
    </table>
</s:form>
<script language='JavaScript' type='text/JavaScript'>
    <s:url id="reloadPage" namespace="/" action="reloadPage" />

        function reloadPage()
        {
            var form = document.forms[0];
            form.action = '<s:property value="reloadPage"/>';
            form.action += '?parameterDefaultValue=';
            form.submit();
        }    

        $("#parameterDataType").change(function()
        {
            reloadPage();
        });
</script>

and

datatype.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>

<s:if test="parameterDataType == 'CODE' ">
    <s:textfield id='parameterDefaultValue' name='parameterDefaultValue' theme="simple" size='27'/>
</s:if>

<s:if test="parameterDataType == 'DATE' ">
    <sj:datepicker id='parameterDefaultValue' name='parameterDefaultValue' parentTheme="simple" displayFormat="%{session.sessionAttr.pref.dateDisplayformat}" appendText="%{session.sessionAttr.pref.dateAppendText}" changeMonth="%{session.sessionAttr.pref.changeMonth}" changeYear="%{session.sessionAttr.pref.changeYear}"/>
</s:if>
<s:if test="parameterDataType == 'BUSINESS_UNIT' ">
    <s:select id='parameterDefaultValue' name='parameterDefaultValue' theme="simple" list='#session.businessUnitSelectList' listKey='id' listValue='name' emptyOption='true' />
</s:if>
<s:if test="parameterDataType == 'TERM' ">
    <s:select id='parameterDefaultValue' name='parameterDefaultValue' theme="simple" list='#session.termList' listKey='id' listValue='description' emptyOption='true' />
</s:if>

and an action class method

public String reloadPage()
{
    return SUCCESS;
}

My aim is to display the a field in the datatype.jsp based on the value selected in myform.jsp.
When a user for example selects CODE from the myform.jsp select, the page reloads to include the datatype.jsp. If i use the property tag i.e.

 <s:property value="parameterDataType" /> 

to print the value of parameterDataType in the datatype.jsp, i get the value CODE but it never enters the if statement.
Please is there anything that i am doing wrong? if there is a better way of achieving this, i will appreciate it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:18:32+00:00Added an answer on June 3, 2026 at 11:18 pm

    I later solved the issue using a similar technique i got on this site

    <s:if test="parameterDataType == @com.myenum.Values@CODE">
        DO SOMETHING
    </s:if>
    

    thanks for your responses

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jsp file <%@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1%> <%@ page
I have two text boxes in my jsp page. After entering data on first
I currently have two files, register.html and register.jsp. The HTML file asks the user
I have two external JavaScript lib files I have to load on same JSP
I have two JSP pages that are just about identical. Each page has an
In my application, I have both html and JSP files. I need them both
I have two iframes added in a jsp page, with same name, display name
I have created two JSP programs as follows. First One: Addmulti.jsp <html> <head><title>Upload Excel
In Spring 3.0 if i have a jsp page with two different links each
I have two list on my request on jsp. First one is productGroupName, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.