Solved

STRUTS: Tags inside innerHTML

Posted on 2004-03-28
1
2,604 Views
Last Modified: 2007-12-19
Hi!

I seem to be having problems using struts tags inside an innerHTML. The design of the page (in this case, it's a popup) is that I have a dropdown (let's say it's DropDown1 for now) box and beside it will be either a textbox or another dropdown(let's call this DropDown2 for now) box (depending on the value selected on DropDown1, it will either show a textbox of DropDown2). All the values for the dropDown boxes are taken from a db and stored in a collection(in my action for initializing the popup). I decided to use innerHTML for this one, but I seem to always get an error with the javascript code I have below. If I don't use struts tags (I tried it out with the regular html tags just to see test) it works fine...any help would be greatly appreciated. =)

I have the following declaration on my page:

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

Here's my javascript function:

function changeField()
{
      var value = document.advanceFilterForm.field.selectedIndex.value;
      
      if ( value == "Release Dates")
      {
            
          document.getElementById( 'valuediv' ).innerHTML =  '<html:select property="value" style="width:116px"><html:options collection="values" property="value" labelProperty="description" /> <html:select>'
      }
      
      else
      {
          document.getElementById( 'valuediv' ).innerHTML = '<html:text property="value" style="width:200px" />'
      }
}

</script>

Here's the error:

org.apache.jasper.JasperException: Cannot find bean under name org.apache.struts.taglib.html.BEAN
0
Comment
Question by:rusco
1 Comment
 
LVL 7

Accepted Solution

by:
searlas earned 75 total points
Comment Utility
Using struts tags implies that you have an object holding the values in your form.  As you do not specifyc a name attribute on the struts tags, struts searches for a bean with the key 'org.apache.struts.taglib.html.BEAN' in page, request, session, application scope (in that order.)

As you haven't set one up, the obvious question is, why are you using struts tags for this?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now