Struts StyleId in Mozilla
I have <html:form styleId="name" action=""> in my JSP. When I use this styleId for accessing the elements of my Form, it is working well in IE, but it is not working in Mozilla Firefox. Can anyone help me out?
One change in Firefox 4 is to by default stop Firefox displaying the warning message, but it can be turned back on by changing some preferences.
# Type '''about:config''' into the location bar and press enter
# Accept the warning message that appears, you will be taken to a list of preferences
# Locate the preference '''browser.tabs.warnOnClose''', if its value is set to '''false''', double-click on it to change its value to '''true'''
# Repeat this for these 3 preferences '''browser.warnOnQuit''', '''browser.warnOnRestart''' and '''browser.showQuitWarning'''
If you always open the last set of tabs, an alternative approach is this:
# Click the orange Firefox button, then select options to open the options window
# Go to the General panel
# Change the setting "When Firefox starts" to "Show my windows and tabs from last time"
Similar Messages
-
Call struts action from javascript?
Hi all
I'm having problem already discussed here quite a lot, but I have idea to solve it different way. And need to know is it possible or I'm doing mission impossible here :(
I have JSP with 2 drop down lilsts, where the second is populated according to selected value from first - that's basically my problem.
Is it possible to somehow only call my struts action which will return all needed values using javascript and onchange event handler?
I dont have any experience with javascript, and I'm trying to avoid it as much as possible at the moment.
Thanks in advancewell as far your requirement is concern if at all you are planning to implement AJAX try to use the below link which might be of some help...
http://www.it-eye.nl/weblog/2005/12/13/ajax-in-struts-implementing-dependend-select-boxes/
However,I somehow feel there are few loopholes in the author's approach...
i advice to use XmlHttpRequest.reponseXML property there.
However, i've mentioned a sample code snippet for you reference.
XML Response Pattern :
======================
<? xml version="1.1" ?>
<dropdown>
<option>
<val>CUSTOMIZED_VALUE</val>
<text>CUSTOMIZED_VALUE</text>
</option>
</dropdown>Sample.jsp:
===========
<%@page language="java" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Automatic Drop-Down Updation</title>
<script language="javascript">
// Global Variable for XmlHttp Request Object
var xmlhttp
// Timer Variables
var c = 0
var t
/* A function which calls a servlet named AjaxServlet to get XmlData using XmlHttpObject */
function refreshCombo(txt){
xmlhttp = null
// code for initializing XmlHttpRequest Object On Browsers like Mozilla, etc.
if (window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest()
// code for initializing XmlHttpRequest Object On Browsers like IE
else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp != null){
// Setting the Action url to get XmlData
url = "dropdown.do?count="+txt;
// Course of Action That Should be Made if their is a change in XmlHttpRequest Object ReadyState NOTE : it is 4 when it has got request from CGI
xmlhttp.onreadystatechange = getResponseAction;
// Open the Request by passing Type of Request & CGI URL
xmlhttp.open("GET",url,true);
// Sending URL Encoded Data
xmlhttp.send(null);
else{
// Only Broswers like IE 5.0,Mozilla & all other browser which support XML data Supports AJAX Technology
// In the Below case it looks as if the browser is not compatiable
alert("Your browser does not support XMLHTTP.")
/* Used for verifing right ReadyState & Status of XmlHttpRequest Object returns true if it is verified */
function verifyReadyState(obj){
// As Said above if XmlHttp.ReadyState == 4 then the Page Has got Response from WebServer
if(obj.readyState == 4){
// Similarly if XmlHttp.status == 200 it means that we have got a Valid response from the WebServer
if(obj.status == 200){
return true
else{
alert("Problem retrieving XML data")
/* Action that has to take place after getting reponse */
function getResponseAction(){
// Verifying State & Status
if(verifyReadyState(xmlhttp) == true){
// Building a DOM parser from Response Object
var response = xmlhttp.responseXML.documentElement
// Deleting all the Present Elements in the Drop-Down Box
drRemove()
// Checking for the Root Node Tag
var x = response.getElementsByTagName("option")
var val
var tex
var optn
for(var i = 0;i < x.length; i++){
optn = document.createElement("OPTION")
var er
// Checking for the tag which holds the value of the Drop-Down combo element
val = x.getElementsByTagName("val")
try{
// Assigning the value to a Drop-Down Set Element
optn.value = val[0].firstChild.data
} catch(er){
// Checking for the tag which holds the Text of the Drop-Down combo element
tex = x[i].getElementsByTagName("text")
try{
// Assigning the Text to a Drop-Down Set Element
optn.text = tex[0].firstChild.data
} catch(er){
// Adding the Set Element to the Drop-Down
document.SampleForm.SampleCombo.options.add(optn)
/* Function removes all the elements in the Drop-Down */
function drRemove(){
var x = document.SampleForm.SampleCombo
for(var i = document.SampleForm.SampleCombo.length - 1 ; i >= 0 ; i--){
x.remove(i)
</script>
</head>
<body onload="syncCount()">
<pre> <h1>Refresh Drop-Down <div id='txt'> </div> </h1></pre>
<form name="SampleForm">
<!-- Drop Down which has country list -->
<select name="x" onchange="refreshCombo(this.value)">
<option value="1">United States</option>
<option value="2">United Kingdom</option>
<option value="3">United Arab Emriates</option>
</select>
<!-- Drop Down which is dependent on Country Drop down get list of states -->
<select name="SampleCombo">
<option value="-1">Pick One</option>
</select>
</form>
</body>
</html>
struts-config.xml:
==================
<action-mappings>
<action path="/dropdown" type="com.controlleraction.AjaxActionClass">
<forward name="error" path="/error.jsp"/>
</action>
</action-mappings>AjaxActionClass.java:
=====================
package com.controlleraction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class AjaxActionClass extends DispatchAction {
public ActionForward execute( ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
String req = new String("");
try{
req = request.getParameter("count");
} catch(Exception exp){
if(!req.equals("")){
response.setContentType("text/xml");
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache,post-check=0,pre-check=0");
PrintWriter out = response.getWriter();
/*a sample bean where we trying to call a service from Model*/
com.Biz.XmlBean xml = new XmlBean();
String buffer = xml.getXmlData(req);
if(xml.close() == true && buffer.equals("") == false)
out.write(buffer);
return(null);
} else {
return new ActionForward("error");
}XmlBean.java:
=============
* XmlBean.java
import java.sql.*;
import java.util.*;
import java.io.*;
* @author RaHuL
public class XmlBean {
private Connection con = null;
private PreparedStatement pstmt = null;
private ResultSet rs = null;
// Setting CLASSURL path to TYPE I Driver
private String CLASSURL = "sun.jdbc.odbc.JdbcOdbcDriver";
/* Specifing CONNECTION PATH to a DSN named TestDsn
* Please Make Sure you create a DSN Named TestDsn to your database which holds EMP table
private String CONNECTIONURL = "jdbc:odbc:TestDsn";
boolean IS_ESTABLISHED = false;
/** Creates a new instance of XmlBean and also establishes DB Connections */
public XmlBean() {
try{
Class.forName(CLASSURL);
con = DriverManager.getConnection(CONNECTIONURL,"admin","");
IS_ESTABLISHED = true;
} catch(SQLException sqe){
sqe.printStackTrace();
} catch(Exception exp){
exp.printStackTrace();
/* Generates XmlData For the Business Logic Specified */
public String getXmlData(String req){
String XmlBuffer = new String("");
if(IS_ESTABLISHED == true){
try{
pstmt = con.prepareStatement("SELECT stateid,statename FROM STATE_TABLE where countryid = ?");
pstmt.setString(1,req);
rs = pstmt.executeQuery();
if(rs != null){
XmlBuffer = XmlBuffer + "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
XmlBuffer = XmlBuffer + "<!-- Edited by Rahul Sharma -->";
// Root Node
XmlBuffer = XmlBuffer + "<dropdown>";
while(rs.next()){
String value = rs.getString(1);
String text = rs.getString(2);
// Sub-root Node
XmlBuffer = XmlBuffer + "<option>";
// node which holds value of drop-down combo
XmlBuffer = XmlBuffer + "<val>"+value+"</val>";
// node which holds text for drop-down combo
XmlBuffer = XmlBuffer + "<text>"+text+"</text>";
XmlBuffer = XmlBuffer + "</option>";
XmlBuffer = XmlBuffer + "</dropdown>";
}catch(SQLException sqe){
sqe.printStackTrace();
} catch(Exception exp){
exp.printStackTrace();
return(XmlBuffer);
/* Closes the DB Connection Conmpletely */
public boolean close(){
if(IS_ESTABLISHED == true){
try{
pstmt.close();
con.close();
return(true);
} catch(SQLException sqe){
sqe.printStackTrace();
} catch(Exception exp){
exp.printStackTrace();
return(false);
NOTE: I understand i'm not completely coded things as per proper coding standards.please execuse me for that as this example was just given to enable user to learn how XmlHttpRquest,reponseXML
can be used for better purposes instead of devising manual parsing.
where i've used XmlHttpResponse pattern to be in XML. you may make use of other practices like JSON & so on depending on your requirement..
and and if you are more instrested in integrating Struts with AJAX using few frameworks & customized tag based support please go though the below link.
http://struts.sourceforge.net/ajaxtags/index.html
Hope that might help :)
REGARDS,
RaHuL -
Runtime Struts Exception on WinXP but not on Linux
I have developed a Struts based application on a Red Hat EL WS machine with JDeveloper 9.5.0.2. Every thing works as expected when I run the application in JDev's OC4J. The views are tested in both Opera and Mozilla browsers.
An other developer (my customer in this case) imports the application to his JDev 9.0.5.2 running on a Win XP box. The application compiles without errors or warnings. At runtime it fails at a Struts <html:form> element in both IE and Firefox with the same exception error 500 with a stack traces starting with:
"javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection"
I have search the web for this exception and found several reasons, but no procurement.
Here is the stack-trace:
500 Internal Server Errorjavax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at ItemTester.jspService(ItemTester.jsp:13)
[ItemTester.jsp]
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
When the application initializes in JDev it throws an exception which I do not observe on the Linux box:
19-08-2004 18:34:48 org.apache.struts.action.ActionServlet initServletSEVERE: nulljava.net.MalformedURLException: unknown protocol: classloader at java.net.URL.<init>(URL.java:544) at java.net.URL.<init>(URL.java) at java.net.URL.<init>(URL.java) at oracle.xml.parser.v2.NonValidatingParser.pushExternalDTD(NonValidatingParser.java:510) at oracle.xml.parser.v2.NonValidatingParser.parseDoctypeDecl(NonValidatingParser.java:454) at oracle.xml.parser.v2.NonValidatingParser.parseProlog(NonValidatingParser.java:287) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:266) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149) at org.apache.commons.digester.Digester.parse(Digester.java:1568) at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java:1433) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:466) at javax.servlet.GenericServlet.init(GenericServlet.java:259) at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2094) at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4523) at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4617) at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:765) at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:497) at com.evermind.server.Application.getHttpApplication(Application.java:886) at com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:688) at com.evermind.server.http.HttpSite.getApplication(HttpSite.java:420) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:422) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270) at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186) at java.lang.Thread.run(Thread.java:534)Frank,
It is possible that he did use OC4J with SSL before this project, but I cannot say for sure.
Could you point me to some resource on the issue?
--Flemming -
Question about struts inside javascript variable
Hi, actually i'm using a struts + javascript to create HTML code that i use inside a popup window...
My (working) code is:
idoc="";
/* var cols = parent.document.getElementById('rowA').getElementsByTagName('THEAD')[0].getElementsByTagName('TH'); */
var idoc='<html:form styleId="InsertNewItem" action="/nw/insertnewitem.do?target='+parent.newPop.action+'">';
idoc+='<TABLE><TBODY>';
var hiddenForm = getParentObj('hidden_data_form');
var cols = hiddenForm.getElementsByTagName('INPUT');
var test;
test="cippa";
for(k = 0; k < cols.length; k++) {
if(cols[k].id.substring(0,3) == "hh_")
idoc += "<TR><TD>";
idoc += cols[k].id.substring(3);
idoc += "</TD><TD>";
idoc += '<html:text property="'+cols[k].id+'" value=""/>';
idoc += "</TD></TR>";
idoc+='</TBODY></TABLE>';
idoc+='</html:form>';
var towr = document.getElementById("subwin_body");
towr.innerHTML = idoc;
The problem is when i try to add a <html:select> to the code, more precisely i added just before the end of the table these lines:
idoc += "<TR><TD>Ditta:";
idoc += "</TD><TD>";
idoc += '<html:select property="ditta_id">';
idoc += '<html:options collection="sel_ditta_list" labelProperty="label" property="value"/>';
idoc += '</html:select>';
idoc += "</TD></TR>";
... but i cannot get it to work because struts seems to make some mistake with quotes and in javascript console window i get this error:
Error: unterminated string literal
File source: http://localhost:8180/nw/jsp/insertNewItemOperatore.jsp
Row: 121, Column: 10
Source Code:
idoc += '<option value="1">1</option>
(note the missing ending single-quote)
I can't understand why because with <html:text> field the same "trick" works fine... any ideas?
Thanks in advance
Luca
Message was edited by:
spallaredcan you post all of your source code for the .jsp and then try running the page and once it fails do a View Source and then paste in all the generated code so that we can look at that as well.
i'm not totally positive but i have a pretty good feeling what is going wrong. the struts optionsCollection tag will render a bunch of <option> elements but print a newline after each one, which means you probably end up with something like
var whatever = '<option ...>.........<option>
<option ...>.........<option>
<option ...>.........<option>
<option ...>.........<option>';
correct? if so, that is not valid javascript.
Message was edited by:
den2681 -
Inconsistent Form Behavior on Failed Struts Validation
So I'm working on a strange bug regarding an Edit User form for an application, where some fields revert to their default and some fields do not.
We have a form for editing users in our system, with most of the usual information inputted in text boxes (login, first name, last name, password, password confirmation). We also have three possible levels of 'admin' - none, admin, and superadmin. These are chosen via radio buttons. There are also a couple of checkboxes (like 'user is active'). Overall, it's a fairly simple form.
When the form is submitted, we do struts validation. We've set up the validation via comment annotation in our Java code, like so:
* @struts.validator type="minlength"
* arg1value="${var:minlength}"
* @struts.validator-var name="minlength" value="8"
* @struts.validator type="maxlength"
* arg2value="${var:maxlength}"
* @struts.validator-var name="maxlength" value="50"
public void setPassword1(String string) {
password1 = string;
}All of the fields in our form are set from user properties, so they're initialized by the values in the user object. For example, if we had user John Smith, an admin, with login 'jsmith,' we'd have the first name and last name fields initialized to John and Smith, and the radio buttons for Admin set to 'admin.' For reference, here's the EditUser.jsp code for the radio buttons, based off of the selectedAdminRole property:
<div class="InputElement">
<label for="selectedAdminRole"><bean:message key="userForm.adminType"/></label>
<html:radio styleId="selectedAdminRole" property="selectedAdminRole" value="None"
disabled="${userForm.loggedInUser.admin and userForm.userId == userForm.loggedInUser.id}">None</html:radio>
<html:radio property="selectedAdminRole" value="Admin"
disabled="${userForm.loggedInUser.admin and userForm.userId == userForm.loggedInUser.id}">Admin</html:radio>
<c:if test="${userForm.loggedInUser.superAdmin}">
<html:radio property="selectedAdminRole" value="SuperAdmin">Super</html:radio>
</c:if>
</div>As you can see above, the struts validator requires passwords to be at least 8 characters long. So if the user tries to change their password to something with less than that, they'll fail validation and they'll end up back on the form with the validation errors in red at the top of the page. However, the form data that they've edited will be preserved. So if John had tried to change his first name to 'Fred,' he'd still see 'Fred' in the First Name text field, even though it wouldn't actually get saved to the user object until he submitted the form with no errors. This works with radio buttons too - if John had tried to set his admin status down to 'none' from 'admin,' the radio button 'none' would still be checked. Basically, it preserves all your progress on the form until you navigate away.
Unfortunately, it does NOT do this when you create a new user. Creating a new user uses the same form, and since there's no user object to get the fields from, they all get initialized to blank - except for one of the checkboxes ('user is active') and the radio buttons for admin (starts with 'none' checked). Now, if the user fills out the form and hits submit, but fails the struts validation, it preserves all the form data in the text fields, but reverts the checkboxes and the radio buttons to their default state.
This leads to the following problem: say I'm trying to create a new admin, Jane Smith. I fill out the whole form, check the 'admin' button, and then enter a four-letter password. I submit, and the form fails struts validation and throws me back to the page with an error message informing me that passwords need to be at least 8 characters. I look over the form again - the login field is still 'janesmith,' the first name field is still 'Jane,' the last name field is still 'Smith,' everything looks fine except I screwed up the password. I enter an 8 letter password and resubmit. Jane then logs in and complains that she's not an admin, because I didn't notice that the 'admin' button had reset itself to the default of 'none' when I failed validation.
My question is, why does it reset the radio buttons and checkboxes - but not the text fields - on failed validation when a new user is being created, but resets nothing at all when an existing user is being edited? I'd like it to reset none of the information when a new user is being created, but I cannot figure out the reason for this inconsistent behavior.
If anyone can help me figure out how to get this working so that nothing gets reset - or at least explain to me the reason for this inconsistent behavior - I would be very grateful. I will also try to provide any additional information I can if this isn't enough.So what you are saying is that radio and checkboxes don't retain their state when validation fails?
Checkboxes are always troublesome because of their design. If not selected, they don't submit any value - so you have to specifically unset them.
My first instinct would be to look at the formbean which you are populating from, and see what (if anything) modifies its values.
- for originally loading the new user page is it an action or JSP? Does it apply any default values to the form?
- check the "input" page you redirect to when validation fails. Is it an action or a JSP?
- is the same form being uses on the newUser jsp and whatever action you are submitting it to?
- is there a form reset() method?
My theory is that the "input" page you are redirecting to when validation fails is an action, and it sets some values on the form prior to loading.
But thats just a guess at this point. Its hard to debug this without a working example. Its been a while since I worked with struts, and never with annotations providing the validation.
Suggestion for debugging: dump the contents of the form bean at strategic points in the process to see that the values are what you think they should be.
- running the save action
- just after validation
- on the jsp page.
Hope this helps some,
evnafets -
ServletFileUpload.parseRequest return empty list in Struts 1.3?
I used ServletFileUpload.parseRequest(request) to get my list of items, with Struts 1.3, JBoss 4.2.2GA(migrated from JBoss 4.0.5GA) I am using JDK 1.5, on myEclipse 6.6 ( migrated from myEclipse 5.5.1GA).
My file upload application used to work and ServletFileUpload.parseRequest(request) used to return non empty results as a List<FileItem>. I am not sure ( that's the frustrating part) what has changed, but now I am getting a empty list!
I have switched to previous version of JBoss 4.0.5.GA, and myEclipse 5.5.GA and still it didn't work. I know what I need to have for this to work, i.e. :
JSTL tag in JSP:
<html:form enctype="multipart/form-data"....>
<html:file styleId="uploadFile" property="uploadFile" size="40" />
My FormBean has uploadFile as FormFile and getter and setter for it.
I wrote a Utility class to include this apache commons fileupload API and my action class calls the Util class.
The Util class looks like this:
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List<FileItem> items = (List<FileItem>) upload.parseRequest(request);
Like I said, items used to return non-empty results and I was uploading file just fine. I am using Struts 1.3, Spring 2.0, which hasn't changed. And even though my myEclipse and JBoss version changed, I did revert back to the previous version just to test them and still am getting empty list.
I am pulling my hair out on this, I'd really appreciate any input and if you need more info, I'd be happy to replenish them!
Thanks in advance!The current release BEA Workshop 3.2 (build 569), does not bundle Struts 1.3.5 and is also not aware of Struts 1.3 release.
However, this should not stop you from manually importing the Struts 1.3 libraries or samples into Workshop.
Preferences | Workshop Studio Facet Libraries | Struts Libraries, is used by the New Web app and Project Facet wizard to import the libraries on creation. Instead you can manually copy/overwrite Struts 1.3 libraries in your existing Struts project.We will keep you posted on the 1.3 support release. -
How to use form name in struts html:form tag
Hi,
I want to validate text box value, if it is ordinary html form I would have done like this <form name="myform" action="xxxx.jsp" onsubmit="return validate()">
But am using struts html:form tags. In this case how can I use/specify name for a form.
Can any one help me.
ThanksThe name of the form comes from the actionForm you have defined backing it.
View source on the generated page to see what HTML it constructs.
You are able to use the onsubmit event with the <html:form> tag just like the standard one, so if all you want to do is that:
<html:form action="/saveUser" onsubmit="return validate()">
...You can also give it a styleId, which will generate an id in the HTML.
See the tag documentation for details: http://struts.apache.org/1.2.x/userGuide/struts-html.html#form -
How to use bean write in struts html:text tag
hi,
i'm new to struts concepts.here i'm trying to write a value in html struts tag using <bean:write>
my current tag is
<html:text property="empname" value='<bean:write name="employee" property="empid">' />
but it gives same tag in the text box.how i can solve this.what am I doing wrong?You will notice above that I mentioned
YOU CAN'T USE CUSTOM TAGS AS ATTRIBUTES TO OTHER CUSTOM TAGS
(was that loud enough for you to notice this time)?
Try
<html:text styleId="instruction" styleClass="text" size="50" name="instruction" property="value"/>
//or
<html:text styleId="instruction" styleClass="text" size="50" property="instruction" value="<%= instruction.getValue() %>"/>
better alternative: populate your formbean with your action and just have:
<html:text styleId="instruction" styleClass="text" size="50" property="instruction"/>
If you set the "instruction" property of your formBean in the action, the value will be automagically reflected here.
Cheers,
evnafets -
How to use nested tag in Struts
Hi..
Can any one guide me how to use nested tag in Struts. So far i already tried bean tag with no error but when i try to use nested tag i got error like
javax.servlet.ServletException: Cannot find bean: "" in any scope
Below are my class:
action class
session.setAttribute ("MyDetailList", detailList);
JSP page
<logic:iterate id="list" name="MyDetailList">
Company ID : <bean:write name="list" property="companyID" />
</logic:iterate>
For bean tag, i got no error at all and below are my code for nested tag
action class
session.setAttribute ("MyDetailList", detailList);
JSP Page
<nested:nest property="MyDetailList">
Make : <nested:text property="make"/>
Car ID : <nested:text property="carID"/>
</nested:nest>
When i run the code, i got error message
javax.servlet.ServletException: Cannot find bean: "" in any scope
Any body can help me?
zulwhat am I doing wrong?You will notice above that I mentioned
YOU CAN'T USE CUSTOM TAGS AS ATTRIBUTES TO OTHER CUSTOM TAGS
(was that loud enough for you to notice this time)?
Try
<html:text styleId="instruction" styleClass="text" size="50" name="instruction" property="value"/>
//or
<html:text styleId="instruction" styleClass="text" size="50" property="instruction" value="<%= instruction.getValue() %>"/>
better alternative: populate your formbean with your action and just have:
<html:text styleId="instruction" styleClass="text" size="50" property="instruction"/>
If you set the "instruction" property of your formBean in the action, the value will be automagically reflected here.
Cheers,
evnafets -
html:text styleid problem while using document.getElementById -very urgent
Hi all,
I am using the following struts code in my jsp.
Each time when I click the checkbox corresponding to each record, I want the screencode to be displayed using the javascript alert.
But always I am getting the same screencode (only the first screencode).
What I should do to get the screencode for the corresponding selection of the checkbox
<logic:iterate id="slist" name="scrlist" scope="session" >
<html:text property="screencode" name="slist" styleId="sc" indexed="true"/>
<bean:write name="slist" property="screen"/>
<html:checkbox property="readchk" alt="Select to enable read right" onclick="javascript:alert(document.getElementById('sc').value)"/>
</logic:iterate>
Could anybody help me to fix this problem as soon as possible
parvathyThe tricky thing about Ajax is that it's asynchronous. That's the point...
What you need to do is return a success or fail status from your servlet (or whatever ServiceAuth is...), let's say a 1 or 0. (0 bad, 1 good). You could even get real fancy and return 0 for username doesn't exist, 1 for password doesn't match user name or 2 for success.
Then have your javascript update the page based on the response received. On a fail response call some javascript method that displays your related Uh-oh message, and on a successresponse call some method that updates the document.location of the page.
HTH. -
Hello there
I've been trying to integrate with WSRP a Struts 1.1 web app which provides a simple File Upload functionality.
It works fine as a standalone web application (direct access to the web app).
But I can't get it to work through WSRP from BEA Weblogic Portal 8.1SP4 to BEA Weblogic Server 8.1SP4.
I followed all the steps indicated at http://e-docs.bea.com/wlp/docs81/wsrp/workprod.html#1010271.
Plus I set up the wsrp-producer-config.xml file to handle attachments as follows:
<markup secure="false" rewrite-urls="true" transport="attachment" accepts-mime="true"/>
The start page of the portlet displays fine on the Consumer side.
But upon file upload it never reaches the actual Struts Action on the Producer side.
No error is displayed either on the Consumer or on the Producer side but the file does not get uploaded.
Any idea why ?
Am I missing anything in the configuration ?
Thanks
Patrick
==================================
All I get in the Producer logs is
<6-mar-2006 18.30.32 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP request from/to 10.102.194.96>
<6-mar-2006 18.30.32 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP response from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP request from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP response from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP request from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP response from/to 10.102.194.96>
========
For info here's the Request from the monitor:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<urn:performBlockingInteraction xmlns:urn="urn:oasis:names:tc:wsrp:v1:types">
<urn:registrationContext xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<urn:portletContext>
<urn:portletHandle>stdgui243 portlet</urn:portletHandle>
</urn:portletContext>
<urn:runtimeContext>
<urn:userAuthentication>wsrp:none</urn:userAuthentication>
<urn:portletInstanceKey>T8005</urn:portletInstanceKey>
<urn:namespacePrefix>T8005</urn:namespacePrefix>
<urn:sessionID>GMlX1KDR8G2dTCHX12FLZy2htBzz5rsTy9H592pWMx0YBtthZgfs!-383570453</urn:sessionID>
<urn:extensions>
<urn1:LookAndFeelDescriptor xmlns:urn1="urn:bea:wsrp:ext:v1:types">
<urn1:skeletonId>default</urn1:skeletonId>
<urn1:skeletonPath>/framework/skeletons/</urn1:skeletonPath>
<urn1:skinId>avitek</urn1:skinId>
<urn1:skinPath>/framework/skins/</urn1:skinPath>
</urn1:LookAndFeelDescriptor>
</urn:extensions>
</urn:runtimeContext>
<urn:userContext xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<urn:markupParams>
<urn:secureClientCommunication>false</urn:secureClientCommunication>
<urn:locales>it</urn:locales>
<urn:mimeTypes>text/html</urn:mimeTypes>
<urn:mimeTypes>image/gif</urn:mimeTypes>
<urn:mimeTypes>image/x-xbitmap</urn:mimeTypes>
<urn:mimeTypes>image/jpeg</urn:mimeTypes>
<urn:mimeTypes>image/pjpeg</urn:mimeTypes>
<urn:mimeTypes>application/x-shockwave-flash</urn:mimeTypes>
<urn:mimeTypes>application/vnd.ms-powerpoint</urn:mimeTypes>
<urn:mimeTypes>application/vnd.ms-excel</urn:mimeTypes>
<urn:mimeTypes>application/msword</urn:mimeTypes>
<urn:mimeTypes>*/*</urn:mimeTypes>
<urn:mode>wsrp:view</urn:mode>
<urn:windowState>wsrp:normal</urn:windowState>
<urn:clientData>
<urn:userAgent>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)</urn:userAgent>
</urn:clientData>
<urn:navigationalState/>
<urn:markupCharacterSets>UTF-8</urn:markupCharacterSets>
<urn:markupCharacterSets>UTF-8</urn:markupCharacterSets>
</urn:markupParams>
<urn:interactionParams>
<urn:portletStateChange>readOnly</urn:portletStateChange>
<urn:interactionState>action=%2Fstdgui243%2Fupload%26module=%2Fstdgui243</urn:interactionState>
</urn:interactionParams>
</urn:performBlockingInteraction>
</soapenv:Body>
</soapenv:Envelope>Hi Patrick,
Can you try this without accept-mime attribute?
Subbu
>
I've been trying to integrate with WSRP a Struts 1.1 web app which provides a simple File Upload functionality.
It works fine as a standalone web application (direct access to the web app).
But I can't get it to work through WSRP from BEA Weblogic Portal 8.1SP4 to BEA Weblogic Server 8.1SP4.
I followed all the steps indicated at http://e-docs.bea.com/wlp/docs81/wsrp/workprod.html#1010271.
Plus I set up the wsrp-producer-config.xml file to handle attachments as follows:
<markup secure="false" rewrite-urls="true" transport="attachment" accepts-mime="true"/>
The start page of the portlet displays fine on the Consumer side.
But upon file upload it never reaches the actual Struts Action on the Producer side.
No error is displayed either on the Consumer or on the Producer side but the file does not get uploaded.
Any idea why ?
Am I missing anything in the configuration ?
Thanks
Patrick
==================================
All I get in the Producer logs is
<6-mar-2006 18.30.32 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP request from/to 10.102.194.96>
<6-mar-2006 18.30.32 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP response from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP request from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP response from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP request from/to 10.102.194.96>
<6-mar-2006 18.30.33 CET> <Debug> <WSRP-Consumer> <BEA-420550> <SOAP response from/to 10.102.194.96>
========
For info here's the Request from the monitor:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<urn:performBlockingInteraction xmlns:urn="urn:oasis:names:tc:wsrp:v1:types">
<urn:registrationContext xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<urn:portletContext>
<urn:portletHandle>stdgui243 portlet</urn:portletHandle>
</urn:portletContext>
<urn:runtimeContext>
<urn:userAuthentication>wsrp:none</urn:userAuthentication>
<urn:portletInstanceKey>T8005</urn:portletInstanceKey>
<urn:namespacePrefix>T8005</urn:namespacePrefix>
<urn:sessionID>GMlX1KDR8G2dTCHX12FLZy2htBzz5rsTy9H592pWMx0YBtthZgfs!-383570453</urn:sessionID>
<urn:extensions>
<urn1:LookAndFeelDescriptor xmlns:urn1="urn:bea:wsrp:ext:v1:types">
<urn1:skeletonId>default</urn1:skeletonId>
<urn1:skeletonPath>/framework/skeletons/</urn1:skeletonPath>
<urn1:skinId>avitek</urn1:skinId>
<urn1:skinPath>/framework/skins/</urn1:skinPath>
</urn1:LookAndFeelDescriptor>
</urn:extensions>
</urn:runtimeContext>
<urn:userContext xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<urn:markupParams>
<urn:secureClientCommunication>false</urn:secureClientCommunication>
<urn:locales>it</urn:locales>
<urn:mimeTypes>text/html</urn:mimeTypes>
<urn:mimeTypes>image/gif</urn:mimeTypes>
<urn:mimeTypes>image/x-xbitmap</urn:mimeTypes>
<urn:mimeTypes>image/jpeg</urn:mimeTypes>
<urn:mimeTypes>image/pjpeg</urn:mimeTypes>
<urn:mimeTypes>application/x-shockwave-flash</urn:mimeTypes>
<urn:mimeTypes>application/vnd.ms-powerpoint</urn:mimeTypes>
<urn:mimeTypes>application/vnd.ms-excel</urn:mimeTypes>
<urn:mimeTypes>application/msword</urn:mimeTypes>
<urn:mimeTypes>*/*</urn:mimeTypes>
<urn:mode>wsrp:view</urn:mode>999
<urn:windowState>wsrp:normal</urn:windowState>
<urn:clientData>
<urn:userAgent>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)</urn:userAgent>
</urn:clientData>
<urn:navigationalState/>
<urn:markupCharacterSets>UTF-8</urn:markupCharacterSets>
<urn:markupCharacterSets>UTF-8</urn:markupCharacterSets>
</urn:markupParams>
<urn:interactionParams>
<urn:portletStateChange>readOnly</urn:portletStateChange>
<urn:interactionState>action=%2Fstdgui243%2Fupload%26module=%2Fstdgui243</urn:interactionState>
</urn:interactionParams>
</urn:performBlockingInteraction>
</soapenv:Body>
</soapenv:Envelope> -
Struts html:text tag background colour
How to change the background colour of Struts <html:text> tag?
styleClass and styleId, you can put css value on it
-
Playing gif images Flex +Struts.
Hi All ,
I have a Flex Application which is working fine, and i am integrating this with Java Struts .
My problem is In my flex application i have written a code for GIF image play.{Playing Animated gif images}.
But when i am integrating with Struts .. this is throwing ERROR #2032 .and GIF image is not loading (Showing loading failed).
But when i am running my flex separately its working fine.
For GIF images playing i used GIFPlayer.as , its giving error :
I dont know whats happening.
Please help........Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Firefox/Tools > Add-ons > Appearance).
*Do NOT click the Reset button on the Safe Mode start window.
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
See also:
*http://kb.mozillazine.org/Animated_images -
Struts dynamic html:text property truncated
hello!
I am tring to dynamically generate the property of an indexed property in struts, my property name seems to get truncated after submission. What am I doing wrong?
<html:text property="quantity('quantity(0)')" styleId="quantity" styleClass="text" size="15" value=""/>
The value comes out like this and the key is truncated (it doesn't have a
close bracket)
quantity(QUANTITY-0 = 10 piecesThanksThe key:value comes out like this:
quantity(0 = 10 pieces -
Uix:dateField inside struts html:form
this renders calendar:
<uix:form name="f8">
<uix:dateField name="e2" />
</uix:form>
this not:
<html:form styleId="f3" action="showsth.do">
<uix:dateField name="e2" />
</html:form>
where html:form is struts form
why?
what am I doing wrong?
I thing use uix and struts together would be amazing but ...Unfortunately, we do not support uix elements inside struts form element.
Maybe you are looking for
-
ORDER BY in line chart with more than 1 lines
Hello, I created a line chart and added 3 chart rows. The x-axis shows the calendar week, which should be ordered. It works perfectly with only one row, but if I add a 2nd or a 3rd row and execute it, the chart shows nothing and stays blank. If I del
-
EJB Deployment error in Weblogic 8.1 very urgent
Hi Mark I forgot to send my error message. So I am sending again. Sorry for the trouble. Murali [weblogicerr1.txt]
-
How can I have the permission to modified my windows files from OSX?
I've had installed the Windows OS on my macbook pro and I want to modified some files on the windows 7 folder from the OSX . I can do some operation like copying the file from the windows user folder and paste it on the Macintosh partition hardisk,
-
Catalyst Control Center ATI graphics card error message
This error message keeps popping up: "The Catalyist Control Center is not supported by the driver version of your enabled graphics adapter. Please update your ATI graphics driver or enable your ATI adapter using the Displays Manager." I have the late
-
Gradient (not smooth) has ripples on TV but looks good in Motion canvas?
Could someone help me fix these ripples in my gradient? I have a gradient color as the background (pink fades to black), it looks smooth on my computer but on my TV monitor it is ripply and choppy as it fades out to black. I am working in NTSC DV. Th